mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Merge branch 'theme_reloading_fix' into super-cut
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
<key>NSAppleScriptEnabled</key>
|
<key>NSAppleScriptEnabled</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2002-2022 Brent Simmons. All rights reserved.</string>
|
<string>Copyright © 2002-2023 Brent Simmons. All rights reserved.</string>
|
||||||
<key>NSMainStoryboardFile</key>
|
<key>NSMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging {
|
|||||||
public let folderPath: String
|
public let folderPath: String
|
||||||
|
|
||||||
lazy var presentedItemOperationQueue = OperationQueue.main
|
lazy var presentedItemOperationQueue = OperationQueue.main
|
||||||
var presentedItemURL: URL? {
|
var presentedItemURL: URL?
|
||||||
return URL(fileURLWithPath: folderPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentThemeName: String {
|
var currentThemeName: String {
|
||||||
get {
|
get {
|
||||||
@@ -33,6 +31,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging {
|
|||||||
do {
|
do {
|
||||||
currentTheme = try articleThemeWithThemeName(newValue)
|
currentTheme = try articleThemeWithThemeName(newValue)
|
||||||
AppDefaults.shared.currentThemeName = newValue
|
AppDefaults.shared.currentThemeName = newValue
|
||||||
|
updateFilePresenter()
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Unable to set new theme: \(error.localizedDescription, privacy: .public)")
|
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.")
|
assertionFailure("Could not create folder for Themes.")
|
||||||
abort()
|
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) {
|
func presentedSubitemDidChange(at url: URL) {
|
||||||
if url.lastPathComponent.localizedCaseInsensitiveContains("nnwtheme") {
|
themeNames = buildThemeNames()
|
||||||
themeNames = buildThemeNames()
|
do {
|
||||||
do {
|
currentTheme = try articleThemeWithThemeName(currentThemeName)
|
||||||
currentTheme = try articleThemeWithThemeName(currentThemeName)
|
} catch {
|
||||||
} catch {
|
appDelegate.presentThemeImportError(error)
|
||||||
appDelegate.presentThemeImportError(error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +106,8 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try FileManager.default.copyItem(atPath: filename, toPath: toFilename)
|
try FileManager.default.copyItem(atPath: filename, toPath: toFilename)
|
||||||
|
|
||||||
|
themeNames = buildThemeNames()
|
||||||
}
|
}
|
||||||
|
|
||||||
func articleThemeWithThemeName(_ themeName: String) throws -> ArticleTheme {
|
func articleThemeWithThemeName(_ themeName: String) throws -> ArticleTheme {
|
||||||
@@ -128,6 +133,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging {
|
|||||||
func deleteTheme(themeName: String) {
|
func deleteTheme(themeName: String) {
|
||||||
if let filename = pathForThemeName(themeName, folder: folderPath) {
|
if let filename = pathForThemeName(themeName, folder: folderPath) {
|
||||||
try? FileManager.default.removeItem(atPath: filename)
|
try? FileManager.default.removeItem(atPath: filename)
|
||||||
|
themeNames = buildThemeNames()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +142,19 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging {
|
|||||||
// MARK : Private
|
// MARK : Private
|
||||||
|
|
||||||
private extension ArticleThemesManager {
|
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] {
|
func buildThemeNames() -> [String] {
|
||||||
let appThemeFilenames = Bundle.main.paths(forResourcesOfType: ArticleTheme.nnwThemeSuffix, inDirectory: nil)
|
let appThemeFilenames = Bundle.main.paths(forResourcesOfType: ArticleTheme.nnwThemeSuffix, inDirectory: nil)
|
||||||
|
|||||||
@@ -695,7 +695,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
|
|||||||
|
|
||||||
private func showTwitterDeprecationAlert() {
|
private func showTwitterDeprecationAlert() {
|
||||||
let alert = UIAlertController(title: NSLocalizedString("Twitter Integration Removed", comment: "Twitter Integration Removed"),
|
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)
|
preferredStyle: .alert)
|
||||||
|
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: .cancel))
|
alert.addAction(UIAlertAction(title: "OK", style: .cancel))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// High Level Settings common to both the iOS application and any extensions we bundle with it
|
// High Level Settings common to both the iOS application and any extensions we bundle with it
|
||||||
MARKETING_VERSION = 6.1.1
|
MARKETING_VERSION = 6.1.1
|
||||||
CURRENT_PROJECT_VERSION = 6114
|
CURRENT_PROJECT_VERSION = 6115
|
||||||
|
|
||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
||||||
|
|||||||
Reference in New Issue
Block a user