diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index ef8b4d94d..4e6284261 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -214,8 +214,6 @@ 519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519B8D322143397200FA689C /* SharingServiceDelegate.swift */; }; 519CA8E525841DB700EB079A /* CrashReporter in Frameworks */ = {isa = PBXBuildFile; productRef = 519CA8E425841DB700EB079A /* CrashReporter */; }; 519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519E743422C663F900A78E47 /* SceneDelegate.swift */; }; - 519ED456244828C3007F8E94 /* AddExtensionPointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519ED455244828C3007F8E94 /* AddExtensionPointViewController.swift */; }; - 519ED47A24482AEB007F8E94 /* EnableExtensionPointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519ED47924482AEB007F8E94 /* EnableExtensionPointViewController.swift */; }; 51A052CE244FB9D7006C2024 /* AddFeedWIndowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */; }; 51A16999235E10D700EB091F /* LocalAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */; }; 51A1699A235E10D700EB091F /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51A16990235E10D600EB091F /* Settings.storyboard */; }; @@ -908,8 +906,6 @@ 5195C1DB2720BD3000888867 /* MasterFeedRowIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterFeedRowIdentifier.swift; sourceTree = ""; }; 519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = ""; }; 519E743422C663F900A78E47 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - 519ED455244828C3007F8E94 /* AddExtensionPointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddExtensionPointViewController.swift; sourceTree = ""; }; - 519ED47924482AEB007F8E94 /* EnableExtensionPointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnableExtensionPointViewController.swift; sourceTree = ""; }; 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AddFeedWIndowController.swift; path = AddFeed/AddFeedWIndowController.swift; sourceTree = ""; }; 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalAccountViewController.swift; sourceTree = ""; }; 51A16990235E10D600EB091F /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; @@ -1519,11 +1515,9 @@ children = ( 51A16995235E10D600EB091F /* AboutViewController.swift */, 51A16992235E10D600EB091F /* AddAccountViewController.swift */, - 519ED455244828C3007F8E94 /* AddExtensionPointViewController.swift */, 5137C2E926F63AE6009EFEDB /* ArticleThemeImporter.swift */, 510FFAB226EEA22C00F32265 /* ArticleThemesTableViewController.swift */, 516244E2241E19F000B61C47 /* ColorPaletteTableViewController.swift */, - 519ED47924482AEB007F8E94 /* EnableExtensionPointViewController.swift */, 51A16990235E10D600EB091F /* Settings.storyboard */, 516A09382360A2AE00EAE89B /* SettingsComboTableViewCell.swift */, 516A091D23609A3600EAE89B /* SettingsComboTableViewCell.xib */, @@ -3159,7 +3153,6 @@ 51F85BFD2275DCA800C787DC /* SingleLineUILabelSizer.swift in Sources */, 517630232336657E00E15FFF /* WebViewProvider.swift in Sources */, 51E43962238037C400015C31 /* AddFeedFolderViewController.swift in Sources */, - 519ED47A24482AEB007F8E94 /* EnableExtensionPointViewController.swift in Sources */, 51C4528F226509BD00C03939 /* UnreadFeed.swift in Sources */, 51FD413B2342BD0500880194 /* MasterTimelineUnreadCountView.swift in Sources */, 513146B2235A81A400387FDC /* AddWebFeedIntentHandler.swift in Sources */, @@ -3275,7 +3268,6 @@ 84DEE56622C32CA4005FC42C /* SmartFeedDelegate.swift in Sources */, 512E09012268907400BDCFDD /* MasterFeedTableViewSectionHeader.swift in Sources */, 516AE9E02372269A007DEEAA /* IconImage.swift in Sources */, - 519ED456244828C3007F8E94 /* AddExtensionPointViewController.swift in Sources */, 51C45268226508F600C03939 /* MasterFeedUnreadCountView.swift in Sources */, D3A39865246505DF00F9A366 /* FindInArticleActivity.swift in Sources */, 5183CCD0226E1E880010922C /* NonIntrinsicLabel.swift in Sources */, diff --git a/iOS/Account/Account.storyboard b/iOS/Account/Account.storyboard index 0b702fad4..cf6e9761e 100644 --- a/iOS/Account/Account.storyboard +++ b/iOS/Account/Account.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -40,6 +41,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -706,10 +888,21 @@ Don’t have a Reader account? + + + diff --git a/iOS/Inspector/Inspector.storyboard b/iOS/Inspector/Inspector.storyboard index 45fcc87f2..e05bb02b6 100644 --- a/iOS/Inspector/Inspector.storyboard +++ b/iOS/Inspector/Inspector.storyboard @@ -1,9 +1,9 @@ - + - + @@ -16,21 +16,41 @@ + + + + + + + + + + + + - + - + - + - + @@ -45,14 +65,14 @@ - + - + - - - - - - - - - - - - - - - - + + - + @@ -485,6 +417,9 @@ + + + diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 8dcfa6683..02ea5210c 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -65,13 +65,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } func sceneDidEnterBackground(_ scene: UIScene) { - if #available(iOS 14, *) { - try? WidgetDataEncoder.shared.encodeWidgetData() - } ArticleStringFormatter.emptyCaches() appDelegate.prepareAccountsForBackground() } - + func sceneWillEnterForeground(_ scene: UIScene) { appDelegate.resumeDatabaseProcessingIfNecessary() appDelegate.prepareAccountsForForeground() diff --git a/iOS/Settings/AddExtensionPointViewController.swift b/iOS/Settings/AddExtensionPointViewController.swift deleted file mode 100644 index 249498dba..000000000 --- a/iOS/Settings/AddExtensionPointViewController.swift +++ /dev/null @@ -1,63 +0,0 @@ -// -// AddExtensionPointViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 4/16/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import UIKit - -protocol AddExtensionPointDismissDelegate: UIViewController { - func dismiss() -} - -class AddExtensionPointViewController: UITableViewController, AddExtensionPointDismissDelegate { - - private var availableExtensionPointTypes = [ExtensionPoint.Type]() - - override func viewDidLoad() { - super.viewDidLoad() - availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title }) - } - - override func numberOfSections(in tableView: UITableView) -> Int { - 1 - } - - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return availableExtensionPointTypes.count - } - - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "SettingsExtensionTableViewCell", for: indexPath) as! SettingsComboTableViewCell - - let extensionPointType = availableExtensionPointTypes[indexPath.row] - cell.comboNameLabel?.text = extensionPointType.title - cell.comboImage?.image = extensionPointType.image - - return cell - } - - override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - return NSLocalizedString("Feed Provider", comment: "Feed Provider Header") - } - - override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return NSLocalizedString("Feed Providers allow you to subscribe to some pages as if they were RSS feeds.", comment: "Feed Provider Footer") - } - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "EnableExtensionPointNavigationViewController") as! UINavigationController - navController.modalPresentationStyle = .currentContext - let enableViewController = navController.topViewController as! EnableExtensionPointViewController - enableViewController.delegate = self - enableViewController.extensionPointType = availableExtensionPointTypes[indexPath.row] - present(navController, animated: true) - } - - func dismiss() { - navigationController?.popViewController(animated: false) - } - -} diff --git a/iOS/Settings/ArticleThemeImporter.swift b/iOS/Settings/ArticleThemeImporter.swift index 4a6996831..fc2494da1 100644 --- a/iOS/Settings/ArticleThemeImporter.swift +++ b/iOS/Settings/ArticleThemeImporter.swift @@ -16,7 +16,7 @@ struct ArticleThemeImporter { let localizedTitleText = NSLocalizedString("Install theme “%@” by %@?", comment: "Theme message text") let title = NSString.localizedStringWithFormat(localizedTitleText as NSString, theme.name, theme.creatorName) as String - let localizedMessageText = NSLocalizedString("Author's Website:\n%@", comment: "Authors website") + let localizedMessageText = NSLocalizedString("Author’s website:\n%@", comment: "Authors website") let message = NSString.localizedStringWithFormat(localizedMessageText as NSString, theme.creatorHomePage) as String let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) diff --git a/iOS/Settings/EnableExtensionPointViewController.swift b/iOS/Settings/EnableExtensionPointViewController.swift deleted file mode 100644 index 64ecc1a72..000000000 --- a/iOS/Settings/EnableExtensionPointViewController.swift +++ /dev/null @@ -1,173 +0,0 @@ -// -// EnableExtensionPointViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 4/16/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import UIKit -import AuthenticationServices -import Account -import OAuthSwift -import Secrets - -class EnableExtensionPointViewController: UITableViewController { - - @IBOutlet weak var extensionDescription: UILabel! - - private var callbackURL: URL? = nil - private var oauth: OAuthSwift? - - weak var delegate: AddExtensionPointDismissDelegate? - var extensionPointType: ExtensionPoint.Type? - - override func viewDidLoad() { - super.viewDidLoad() - navigationItem.title = extensionPointType?.title - extensionDescription.attributedText = extensionPointType?.description - tableView.register(ImageHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader") - } - - @IBAction func cancel(_ sender: Any) { - dismiss(animated: true, completion: nil) - delegate?.dismiss() - } - - @IBAction func enable(_ sender: Any) { - guard let extensionPointType = extensionPointType else { return } - - if let oauth1 = extensionPointType as? OAuth1SwiftProvider.Type { - enableOauth1(oauth1) - } else if let oauth2 = extensionPointType as? OAuth2SwiftProvider.Type { - enableOauth2(oauth2) - } else { - ExtensionPointManager.shared.activateExtensionPoint(extensionPointType) { result in - if case .failure(let error) = result { - self.presentError(error) - } - self.dismiss(animated: true, completion: nil) - self.delegate?.dismiss() - } - } - } - - override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return section == 0 ? ImageHeaderView.rowHeight : super.tableView(tableView, heightForHeaderInSection: section) - } - - override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - if section == 0 { - let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView - headerView.imageView.image = extensionPointType?.image - return headerView - } else { - return super.tableView(tableView, viewForHeaderInSection: section) - } - } - -} - -extension EnableExtensionPointViewController: OAuthSwiftURLHandlerType { - - public func handle(_ url: URL) { - let session = ASWebAuthenticationSession(url: url, callbackURLScheme: callbackURL!.scheme, completionHandler: { (url, error) in - if let callbackedURL = url { - OAuth1Swift.handle(url: callbackedURL) - } - - guard let error = error else { return } - - self.oauth?.cancel() - self.oauth = nil - - DispatchQueue.main.async { - self.dismiss(animated: true, completion: nil) - self.delegate?.dismiss() - } - - if case ASWebAuthenticationSessionError.canceledLogin = error { - print("Login cancelled.") - } else { - self.presentError(error) - } - }) - - session.presentationContextProvider = self - if !session.start() { - print("Session failed to start!!!") - } - - } -} - -extension EnableExtensionPointViewController: ASWebAuthenticationPresentationContextProviding { - - public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { - return view.window! - } - -} - -private extension EnableExtensionPointViewController { - - func enableOauth1(_ provider: OAuth1SwiftProvider.Type) { - callbackURL = provider.callbackURL - - let oauth1 = provider.oauth1Swift - self.oauth = oauth1 - oauth1.authorizeURLHandler = self - - oauth1.authorize(withCallbackURL: callbackURL!) { [weak self] result in - guard let self = self, let extensionPointType = self.extensionPointType else { return } - - switch result { - case .success(let tokenSuccess): - ExtensionPointManager.shared.activateExtensionPoint(extensionPointType, tokenSuccess: tokenSuccess) { result in - if case .failure(let error) = result { - self.presentError(error) - } - self.dismiss(animated: true, completion: nil) - self.delegate?.dismiss() - } - case .failure(let oauthSwiftError): - self.presentError(oauthSwiftError) - } - - self.oauth?.cancel() - self.oauth = nil - } - } - - func enableOauth2(_ provider: OAuth2SwiftProvider.Type) { - callbackURL = provider.callbackURL - - let oauth2 = provider.oauth2Swift - self.oauth = oauth2 - oauth2.authorizeURLHandler = self - - let oauth2Vars = provider.oauth2Vars - - oauth2.authorize(withCallbackURL: callbackURL!, scope: oauth2Vars.scope, state: oauth2Vars.state, parameters: oauth2Vars.params) { [weak self] result in - guard let self = self, let extensionPointType = self.extensionPointType else { return } - - switch result { - case .success(let tokenSuccess): - ExtensionPointManager.shared.activateExtensionPoint(extensionPointType, tokenSuccess: tokenSuccess) { result in - if case .failure(let error) = result { - self.presentError(error) - } - self.dismiss(animated: true, completion: nil) - self.delegate?.dismiss() - } - case .failure(let oauthSwiftError): - self.presentError(oauthSwiftError) - } - - self.oauth?.cancel() - self.oauth = nil - } - } - - -} diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index e36af8d35..20ec99942 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -1,9 +1,9 @@ - + - + @@ -21,7 +21,7 @@ - + @@ -42,35 +42,14 @@ - + - + - - - - - - - - - - - - - - -