diff --git a/Catch.xcodeproj/project.pbxproj b/Catch.xcodeproj/project.pbxproj index 4a9336c..7ab42af 100644 --- a/Catch.xcodeproj/project.pbxproj +++ b/Catch.xcodeproj/project.pbxproj @@ -160,12 +160,12 @@ 44BA5D131DAEC3B600A9CE9A /* RecentsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RecentsController.swift; path = Sources/App/RecentsController.swift; sourceTree = ""; }; 44BA5D151DAECF1A00A9CE9A /* RecentsCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RecentsCellView.swift; path = Sources/App/RecentsCellView.swift; sourceTree = ""; }; 44BA5D191DB81A8E00A9CE9A /* Application.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Application.swift; path = Sources/App/Application.swift; sourceTree = ""; }; - 44BA5D1B1DB8220100A9CE9A /* MenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MenuController.swift; path = Sources/App/MenuController.swift; sourceTree = ""; }; + 44BA5D1B1DB8220100A9CE9A /* MenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; name = MenuController.swift; path = Sources/App/MenuController.swift; sourceTree = ""; tabWidth = 2; }; 44C8926E1D1814A7008F8543 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Sources/App/AppDelegate.swift; sourceTree = ""; }; 44E2CEA21DBC0B8F00ED7A8D /* PreferencesController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PreferencesController.swift; path = Sources/App/PreferencesController.swift; sourceTree = ""; }; 44E2CEA41DBC134E00ED7A8D /* FeedParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedParser.swift; path = "Sources/Feed Helper/FeedParser.swift"; sourceTree = SOURCE_ROOT; }; 44FBC67A196312A400434B01 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 44FFCE3E1DCB92F4006E6DF0 /* Defaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Defaults.swift; path = Sources/App/Defaults.swift; sourceTree = ""; }; + 44FFCE3E1DCB92F4006E6DF0 /* Defaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; name = Defaults.swift; path = Sources/App/Defaults.swift; sourceTree = ""; tabWidth = 2; }; 8D1107310486CEB800E47090 /* Catch-Info.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; fileEncoding = 4; name = "Catch-Info.plist"; path = "Resources/App/Catch-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* Catch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Catch.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ diff --git a/Resources/App/Base.lproj/UI.xib b/Resources/App/Base.lproj/UI.xib index 8ded401..5ca9488 100644 --- a/Resources/App/Base.lproj/UI.xib +++ b/Resources/App/Base.lproj/UI.xib @@ -23,7 +23,9 @@ + + @@ -126,7 +128,7 @@ - + @@ -140,7 +142,7 @@ - + @@ -156,7 +158,7 @@ - + @@ -452,12 +454,13 @@ DQ + - + @@ -467,7 +470,7 @@ DQ - + diff --git a/Resources/App/de.lproj/UI.strings b/Resources/App/de.lproj/UI.strings index bbab609..9764ed9 100644 Binary files a/Resources/App/de.lproj/UI.strings and b/Resources/App/de.lproj/UI.strings differ diff --git a/Resources/App/nl.lproj/UI.strings b/Resources/App/nl.lproj/UI.strings index 17eb231..e3293c1 100644 Binary files a/Resources/App/nl.lproj/UI.strings and b/Resources/App/nl.lproj/UI.strings differ diff --git a/Resources/App/zh-Hans.lproj/UI.strings b/Resources/App/zh-Hans.lproj/UI.strings index 1bd3c83..bfabf7f 100644 Binary files a/Resources/App/zh-Hans.lproj/UI.strings and b/Resources/App/zh-Hans.lproj/UI.strings differ diff --git a/Resources/App/zh-Hant.lproj/UI.strings b/Resources/App/zh-Hant.lproj/UI.strings index b534f8c..8aaa613 100644 Binary files a/Resources/App/zh-Hant.lproj/UI.strings and b/Resources/App/zh-Hant.lproj/UI.strings differ diff --git a/Sources/App/Defaults.swift b/Sources/App/Defaults.swift index 19cb8af..07e429f 100644 --- a/Sources/App/Defaults.swift +++ b/Sources/App/Defaults.swift @@ -101,13 +101,21 @@ final class Defaults: NSObject { return true } + + var isShowRSSFeed: Bool { + guard + let host = feedURL?.host, + host.hasSuffix("showrss.info") + else { + return false + } + return true + } var isFeedURLValid: Bool { guard let url = feedURL, - let scheme = url.scheme, - let host = url.host, - let query = url.query + let scheme = url.scheme else { return false } @@ -117,14 +125,11 @@ final class Defaults: NSObject { return false } - guard host.hasSuffix("showrss.info") else { - NSLog("Bad host in feed URL: \(host)") - return false - } - - guard query.contains("namespaces=true") else { - NSLog("Feed URL does not have namespaces enabled") - return false + if isShowRSSFeed, + let query = url.query, + !query.contains("namespaces=true") { + NSLog("Feed URL does not have namespaces enabled") + return false } return true diff --git a/Sources/App/MenuController.swift b/Sources/App/MenuController.swift index 07c4b3a..29cc615 100644 --- a/Sources/App/MenuController.swift +++ b/Sources/App/MenuController.swift @@ -7,7 +7,9 @@ class MenuController: NSObject { @IBOutlet private weak var menuVersion: NSMenuItem! @IBOutlet private weak var menuPauseResume: NSMenuItem! @IBOutlet private weak var menuLastUpdate: NSMenuItem! - + @IBOutlet private weak var menuLaunchShowRSS: NSMenuItem! + @IBOutlet private weak var menuTopSeparator: NSMenuItem! + private var menuBarItem: NSStatusItem! override func awakeFromNib() { @@ -41,6 +43,15 @@ class MenuController: NSObject { } ) + NotificationCenter.default.addObserver( + forName: Defaults.changedNotification, + object: Defaults.shared, + queue: nil, + using: { [weak self] _ in + self?.refreshMenuContents() + } + ) + // Update UI now refreshMenuContents() } @@ -79,6 +90,9 @@ class MenuController: NSObject { // Configure the "last update" item menuLastUpdate.title = FeedChecker.shared.lastCheckStatus.localizedDescription + + menuLaunchShowRSS.isHidden = !Defaults.shared.isShowRSSFeed + menuTopSeparator.isHidden = !Defaults.shared.isShowRSSFeed } deinit { diff --git a/Sources/Feed Helper/FeedParser.swift b/Sources/Feed Helper/FeedParser.swift index d10cf00..c6e5f0b 100644 --- a/Sources/Feed Helper/FeedParser.swift +++ b/Sources/Feed Helper/FeedParser.swift @@ -12,7 +12,7 @@ private extension Episode { /// Try to initialize an episode with the data found in an RSS "item" element init?(itemNode: XMLNode) { // Get the .torrent URL or magnet link - guard let urlString = itemNode["enclosure/@url"] else { + guard let urlString = itemNode["enclosure/@url"] ?? itemNode["link"] else { NSLog("Missing feed item URL") return nil }