File tree 2 files changed +16
-4
lines changed 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1962,7 +1962,6 @@ - (BOOL)validateUserInterfaceItem: (id<NSValidatedUserInterfaceItem>) item {
1962
1962
if (action == @selector (showIndices: )
1963
1963
|| action == @selector (showAlbums: )
1964
1964
|| action == @selector (showDirectories: )
1965
- || action == @selector (showPodcasts: )
1966
1965
|| action == @selector (reloadCurrentServer: )
1967
1966
|| action == @selector (openCurrentServerHomePage: )
1968
1967
|| action == @selector (addPlaylistToCurrentServer: )
@@ -1971,6 +1970,10 @@ - (BOOL)validateUserInterfaceItem: (id<NSValidatedUserInterfaceItem>) item {
1971
1970
return self.server != nil ;
1972
1971
}
1973
1972
1973
+ if (action == @selector (showPodcasts: )) {
1974
+ return self.server != nil && [self .server.supportsPodcasts boolValue ];
1975
+ }
1976
+
1974
1977
if (action == @selector (toggleServerUsers: )) {
1975
1978
return self.server != nil && [self .server.supportsNowPlaying boolValue ];
1976
1979
}
Original file line number Diff line number Diff line change @@ -36,8 +36,7 @@ public class SBServer: SBResource {
36
36
// items either; if the dictionary grows to where it becomes a problem, just restart.
37
37
// This is NSNumber for Cocoa binding's sake
38
38
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 ] = [ : ]
41
40
42
41
@objc dynamic var supportsNowPlaying : NSNumber {
43
42
get {
@@ -49,6 +48,16 @@ public class SBServer: SBResource {
49
48
}
50
49
}
51
50
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
+
52
61
func markNotSupported( feature: SBSubsonicRequestType ) {
53
62
switch ( feature) {
54
63
case . getNowPlaying:
@@ -57,7 +66,7 @@ public class SBServer: SBResource {
57
66
// we don't need to show a message here, since SBServerUserViewController will display this for us
58
67
case . getPodcasts:
59
68
// 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 {
61
70
DispatchQueue . main. async {
62
71
let alert = NSAlert ( )
63
72
// XXX: suppressable?
You can’t perform that action at this time.
0 commit comments