From 66dfc80ce8d21e40da1ed18c5ec897fea4943b16 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 13 Mar 2023 21:53:26 -0700 Subject: [PATCH 1/3] Update copyright to 2023. --- Mac/Resources/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mac/Resources/Info.plist b/Mac/Resources/Info.plist index 90970f567..a5e21c04c 100644 --- a/Mac/Resources/Info.plist +++ b/Mac/Resources/Info.plist @@ -62,7 +62,7 @@ NSAppleScriptEnabled NSHumanReadableCopyright - Copyright © 2002-2022 Brent Simmons. All rights reserved. + Copyright © 2002-2023 Brent Simmons. All rights reserved. NSMainStoryboardFile Main NSPrincipalClass From 37b4fb5438a7c2b3d3d0dbb462b6fcd765e222e8 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 18 Mar 2023 22:23:48 -0700 Subject: [PATCH 2/3] =?UTF-8?q?Update=20the=20Twitter=20deprecation=20noti?= =?UTF-8?q?ce=20to=20remove=20references=20to=20dates,=20since=20it?= =?UTF-8?q?=E2=80=99s=20no=20longer=20February=20(when=20we=20expected=20f?= =?UTF-8?q?ree=20access=20to=20the=20API=20to=20get=20turned=20off).=20Bum?= =?UTF-8?q?p=20build=20to=206115.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/MasterFeed/MasterFeedViewController.swift | 2 +- xcconfig/common/NetNewsWire_ios_target_common.xcconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 422c3f71f..82a7637a6 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -694,7 +694,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma private func showTwitterDeprecationAlert() { let alert = UIAlertController(title: NSLocalizedString("Twitter Integration Removed", comment: "Twitter Integration Removed"), - message: NSLocalizedString("On February 1, 2023, Twitter announced the end of free access to the Twitter API, effective February 9.\n\nSince Twitter does not provide RSS feeds, we’ve had to use the Twitter API. Without free access to that API, we can’t read feeds from Twitter.\n\nWe’ve left your Twitter feeds intact. If you have any starred items from those feeds, they will remain as long as you don’t delete those feeds.\n\nYou can still read whatever you have already downloaded. However, those feeds will no longer update.", comment: "Twitter deprecation message"), + message: NSLocalizedString("Twitter has ended free access to the parts of the Twitter API that we need.\n\nSince Twitter does not provide RSS feeds, we’ve had to use the Twitter API. Without free access to that API, we can’t read feeds from Twitter.\n\nWe’ve left your Twitter feeds intact. If you have any starred items from those feeds, they will remain as long as you don’t delete those feeds.\n\nYou can still read whatever you have already downloaded. However, those feeds will no longer update.", comment: "Twitter deprecation message"), preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .cancel)) diff --git a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig index 6cc3d75cc..c290664ef 100644 --- a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig +++ b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig @@ -1,7 +1,7 @@ // High Level Settings common to both the iOS application and any extensions we bundle with it MARKETING_VERSION = 6.1.1 -CURRENT_PROJECT_VERSION = 6114 +CURRENT_PROJECT_VERSION = 6115 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon From e43e770f4a47d264f68142fc0a5bc27c64aee2e9 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sat, 1 Apr 2023 19:55:32 -0500 Subject: [PATCH 3/3] Fix automatic theme reloading --- .../ArticleStyles/ArticleThemesManager.swift | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/Shared/ArticleStyles/ArticleThemesManager.swift b/Shared/ArticleStyles/ArticleThemesManager.swift index 7a9685d47..d5c94875e 100644 --- a/Shared/ArticleStyles/ArticleThemesManager.swift +++ b/Shared/ArticleStyles/ArticleThemesManager.swift @@ -20,9 +20,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { public let folderPath: String lazy var presentedItemOperationQueue = OperationQueue.main - var presentedItemURL: URL? { - return URL(fileURLWithPath: folderPath) - } + var presentedItemURL: URL? var currentThemeName: String { get { @@ -33,6 +31,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { do { currentTheme = try articleThemeWithThemeName(newValue) AppDefaults.shared.currentThemeName = newValue + updateFilePresenter() } catch { logger.error("Unable to set new theme: \(error.localizedDescription, privacy: .public)") } @@ -71,18 +70,22 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { assertionFailure("Could not create folder for Themes.") abort() } - - NSFileCoordinator.addFilePresenter(self) + + #if os(macOS) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSApplication.didBecomeActiveNotification, object: nil) + #else + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: UIApplication.didBecomeActiveNotification, object: nil) + #endif + + updateFilePresenter() } func presentedSubitemDidChange(at url: URL) { - if url.lastPathComponent.localizedCaseInsensitiveContains("nnwtheme") { - themeNames = buildThemeNames() - do { - currentTheme = try articleThemeWithThemeName(currentThemeName) - } catch { - appDelegate.presentThemeImportError(error) - } + themeNames = buildThemeNames() + do { + currentTheme = try articleThemeWithThemeName(currentThemeName) + } catch { + appDelegate.presentThemeImportError(error) } } @@ -103,6 +106,8 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { } try FileManager.default.copyItem(atPath: filename, toPath: toFilename) + + themeNames = buildThemeNames() } func articleThemeWithThemeName(_ themeName: String) throws -> ArticleTheme { @@ -128,6 +133,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { func deleteTheme(themeName: String) { if let filename = pathForThemeName(themeName, folder: folderPath) { try? FileManager.default.removeItem(atPath: filename) + themeNames = buildThemeNames() } } @@ -136,6 +142,19 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { // MARK : Private private extension ArticleThemesManager { + + @objc func applicationDidBecomeActive(_ note: Notification) { + themeNames = buildThemeNames() + } + + func updateFilePresenter() { + guard let currentThemePath = currentTheme.path else { + return + } + NSFileCoordinator.removeFilePresenter(self) + presentedItemURL = URL(fileURLWithPath: currentThemePath) + NSFileCoordinator.addFilePresenter(self) + } func buildThemeNames() -> [String] { let appThemeFilenames = Bundle.main.paths(forResourcesOfType: ArticleTheme.nnwThemeSuffix, inDirectory: nil)