Skip to content

Commit de4153e

Browse files
committed
use podcasts supported in UI
1 parent f1d864d commit de4153e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Submariner/SBDatabaseController.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,6 @@ - (BOOL)validateUserInterfaceItem: (id<NSValidatedUserInterfaceItem>) item {
19621962
if (action == @selector(showIndices:)
19631963
|| action == @selector(showAlbums:)
19641964
|| action == @selector(showDirectories:)
1965-
|| action == @selector(showPodcasts:)
19661965
|| action == @selector(reloadCurrentServer:)
19671966
|| action == @selector(openCurrentServerHomePage:)
19681967
|| action == @selector(addPlaylistToCurrentServer:)
@@ -1971,6 +1970,10 @@ - (BOOL)validateUserInterfaceItem: (id<NSValidatedUserInterfaceItem>) item {
19711970
return self.server != nil;
19721971
}
19731972

1973+
if (action == @selector(showPodcasts:)) {
1974+
return self.server != nil && [self.server.supportsPodcasts boolValue];
1975+
}
1976+
19741977
if (action == @selector(toggleServerUsers:)) {
19751978
return self.server != nil && [self.server.supportsNowPlaying boolValue];
19761979
}

Submariner/SBServer.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public class SBServer: SBResource {
3636
// items either; if the dictionary grows to where it becomes a problem, just restart.
3737
// This is NSNumber for Cocoa binding's sake
3838
fileprivate static var _supportsNowPlaying: [NSManagedObjectID: NSNumber] = [:]
39-
// TODO: Need to bind this to the UI so it'll hide in menu bar
40-
var supportsPodcasts: Bool = true
39+
fileprivate static var _supportsPodcasts: [NSManagedObjectID: NSNumber] = [:]
4140

4241
@objc dynamic var supportsNowPlaying: NSNumber {
4342
get {
@@ -49,6 +48,16 @@ public class SBServer: SBResource {
4948
}
5049
}
5150

51+
@objc dynamic var supportsPodcasts: NSNumber {
52+
get {
53+
// ?? true is because we only set this if overriden to be unsupported
54+
return SBServer._supportsPodcasts[self.objectID] ?? true
55+
}
56+
set {
57+
SBServer._supportsPodcasts[self.objectID] = newValue
58+
}
59+
}
60+
5261
func markNotSupported(feature: SBSubsonicRequestType) {
5362
switch (feature) {
5463
case .getNowPlaying:
@@ -57,7 +66,7 @@ public class SBServer: SBResource {
5766
// we don't need to show a message here, since SBServerUserViewController will display this for us
5867
case .getPodcasts:
5968
// TODO: UI stuff beyond an initial dialog displayed once (switch away, hide UI like now playing SwiftUI view does, etc.)
60-
if supportsPodcasts {
69+
if supportsPodcasts.boolValue {
6170
DispatchQueue.main.async {
6271
let alert = NSAlert()
6372
// XXX: suppressable?

0 commit comments

Comments
 (0)