From a39dae0a44328be733a4ae443793d534c2ae9fac Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 8 Feb 2023 16:37:29 -0800 Subject: [PATCH] Merge mac-release --- Account/Sources/Account/AccountManager.swift | 20 +++++++++++++ Mac/AppDefaults.swift | 11 +++++++ Mac/AppDelegate.swift | 29 +++++++++++++++++++ .../xcschemes/NetNewsWire MAS.xcscheme | 11 +------ Technotes/ReleaseNotes-Mac.markdown | 5 ++++ .../NetNewsWire_mac_target_common.xcconfig | 4 +-- 6 files changed, 68 insertions(+), 12 deletions(-) diff --git a/Account/Sources/Account/AccountManager.swift b/Account/Sources/Account/AccountManager.swift index 29bf77288..0989691cc 100644 --- a/Account/Sources/Account/AccountManager.swift +++ b/Account/Sources/Account/AccountManager.swift @@ -326,6 +326,26 @@ public final class AccountManager: UnreadCountProvider { return false } + public func anyLocalOriCloudAccountHasAtLeastOneTwitterFeed() -> Bool { + // We removed our Twitter code, and the ability to read feeds from Twitter, + // when Twitter announced the end of the free tier for the Twitter API. + // We are cheering on Twitter’s increasing irrelevancy. + + for account in accounts { + if account.type == .cloudKit || account.type == .onMyMac { + for webfeed in account.flattenedWebFeeds() { + if let components = URLComponents(string: webfeed.url), let host = components.host { + if host == "twitter.com" { // Allow, for instance, blog.twitter.com, which might have an actual RSS feed + return true + } + } + } + } + } + + return false + } + // MARK: - Fetching Articles // These fetch articles from active accounts and return a merged Set
. diff --git a/Mac/AppDefaults.swift b/Mac/AppDefaults.swift index 685d6fd44..66d952b7d 100644 --- a/Mac/AppDefaults.swift +++ b/Mac/AppDefaults.swift @@ -43,6 +43,7 @@ final class AppDefaults { static let defaultBrowserID = "defaultBrowserID" static let currentThemeName = "currentThemeName" static let hasSeenNotAllArticlesHaveURLsAlert = "hasSeenNotAllArticlesHaveURLsAlert" + static let twitterDeprecationAlertShown = "twitterDeprecationAlertShown" // Hidden prefs static let showDebugMenu = "ShowDebugMenu" @@ -318,6 +319,16 @@ final class AppDefaults { UserDefaults.standard.set(newValue.rawValue, forKey: Key.refreshInterval) } } + + var twitterDeprecationAlertShown: Bool { + get { + return AppDefaults.bool(for: Key.twitterDeprecationAlertShown) + } + set { + AppDefaults.setBool(for: Key.twitterDeprecationAlertShown, newValue) + } + } + func registerDefaults() { #if DEBUG diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index d6e14da41..44dc42137 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -131,6 +131,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(didWakeNotification(_:)), name: NSWorkspace.didWakeNotification, object: nil) appDelegate = self + + presentTwitterDeprecationAlertIfRequired() } // MARK: - API @@ -954,6 +956,33 @@ internal extension AppDelegate { alert.beginSheetModal(for: window) } + private func presentTwitterDeprecationAlertIfRequired() { + if AppDefaults.shared.twitterDeprecationAlertShown { return } + + let expiryDate = Date(timeIntervalSince1970: 1691539200) // August 9th 2023, 00:00 UTC + let currentDate = Date() + if currentDate > expiryDate { + return // If after August 9th, don't show + } + + if AccountManager.shared.anyLocalOriCloudAccountHasAtLeastOneTwitterFeed() { + showTwitterDeprecationAlert() + } + AppDefaults.shared.twitterDeprecationAlertShown = true + } + + private func showTwitterDeprecationAlert() { + DispatchQueue.main.async { + let alert = NSAlert() + alert.alertStyle = .warning + alert.messageText = NSLocalizedString("Twitter Integration Removed", comment: "Twitter Integration Removed") + alert.informativeText = 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 informative text.") + alert.addButton(withTitle: NSLocalizedString("OK", comment: "OK")) + alert.buttons[0].keyEquivalent = "\r" + alert.runModal() + } + } + } /* diff --git a/NetNewsWire.xcodeproj/xcshareddata/xcschemes/NetNewsWire MAS.xcscheme b/NetNewsWire.xcodeproj/xcshareddata/xcschemes/NetNewsWire MAS.xcscheme index c67864647..e08473d24 100644 --- a/NetNewsWire.xcodeproj/xcshareddata/xcschemes/NetNewsWire MAS.xcscheme +++ b/NetNewsWire.xcodeproj/xcshareddata/xcschemes/NetNewsWire MAS.xcscheme @@ -1,7 +1,7 @@ + version = "1.8"> @@ -45,15 +45,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - diff --git a/Technotes/ReleaseNotes-Mac.markdown b/Technotes/ReleaseNotes-Mac.markdown index 52ecf0762..c4c935dca 100644 --- a/Technotes/ReleaseNotes-Mac.markdown +++ b/Technotes/ReleaseNotes-Mac.markdown @@ -1,5 +1,10 @@ # Mac Release Notes +### 6.1.1b2 build 6108 5 Feb 2023 + +Remove Twitter integration. On first launch, for people with Twitter feeds, display an alert explaining what happened +Fix a crashing bug that could happen in the sidebar + ### 6.1.1b1 build 6107 3 Nov 2022 Fixed a bug that could prevent users from accessing BazQux if an article was missing a field diff --git a/xcconfig/common/NetNewsWire_mac_target_common.xcconfig b/xcconfig/common/NetNewsWire_mac_target_common.xcconfig index fc8972368..eb4b5b3a7 100644 --- a/xcconfig/common/NetNewsWire_mac_target_common.xcconfig +++ b/xcconfig/common/NetNewsWire_mac_target_common.xcconfig @@ -1,6 +1,6 @@ // High Level Settings common to both the Mac application and any extensions we bundle with it -MARKETING_VERSION = 6.1.1 -CURRENT_PROJECT_VERSION = 6107 +MARKETING_VERSION = 6.1.1b2 +CURRENT_PROJECT_VERSION = 6108 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;