Merge branch 'main' into localize_strings

# Conflicts:
#	Mac/MainWindow/AddFeed/AddTwitterFeedWindowController.swift
#	Mac/MainWindow/MainWindowController.swift
#	NetNewsWire.xcodeproj/project.pbxproj
#	Shared/ArticleStyles/ArticleTheme.swift
#	iOS/Add/AddFeedViewController.swift
#	iOS/Add/Twitter/TwitterEnterDetailTableViewController.swift
#	iOS/Article/ArticleViewController.swift
#	iOS/MasterFeed/MasterFeedViewController.swift
This commit is contained in:
Stuart Breckenridge
2023-02-10 09:26:05 +08:00
95 changed files with 348 additions and 2416 deletions

View File

@@ -94,6 +94,16 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
super.viewWillAppear(animated)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if (isBeingPresented || isMovingToParent) {
// Only show the Twitter alert the first time
// the view is presented.
presentTwitterDeprecationAlertIfRequired()
}
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.preferredContentSizeCategory != previousTraitCollection?.preferredContentSizeCategory {
@@ -617,8 +627,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
Context Menu Order:
1. Add Web Feed
2. Add Reddit Feed
3. Add Twitter Feed
4. Add Folder
3. Add Folder
*/
var menuItems: [UIAction] = []
@@ -637,13 +646,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
}
menuItems.append(addRedditFeedAction)
}
if ExtensionPointManager.shared.isTwitterEnabled {
let addTwitterFeedActionTitle = NSLocalizedString("button.title.addtwitterfeed", comment: "Add Twitter Feed")
let addTwitterFeedAction = UIAction(title: addTwitterFeedActionTitle, image: AppAssets.contextMenuTwitter.tinted(color: .label)) { _ in
self.coordinator.showAddTwitterFeed()
}
menuItems.append(addTwitterFeedAction)
}
}
let addWebFolderActionTitle = NSLocalizedString("button.title.add-folder", comment: "Add Folder")
@@ -657,7 +659,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
self.addNewItemButton.menu = contextMenu
}
func focus() {
becomeFirstResponder()
}
@@ -670,6 +672,29 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
}
}
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() {
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, weve had to use the Twitter API. Without free access to that API, we cant read feeds from Twitter.\n\nWeve left your Twitter feeds intact. If you have any starred items from those feeds, they will remain as long as you dont 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))
present(alert, animated: true)
}
}
// MARK: UIContextMenuInteractionDelegate