diff --git a/Account/Tests/AccountTests/Feedly/FeedlyTestSecrets.swift b/Account/Tests/AccountTests/Feedly/FeedlyTestSecrets.swift index d5f36d5a5..f55e71043 100644 --- a/Account/Tests/AccountTests/Feedly/FeedlyTestSecrets.swift +++ b/Account/Tests/AccountTests/Feedly/FeedlyTestSecrets.swift @@ -14,7 +14,6 @@ struct FeedlyTestSecrets: SecretsProvider { var mercuryClientSecret = "" var feedlyClientId = "" var feedlyClientSecret = "" - var redditConsumerKey = "" var inoreaderAppId = "" var inoreaderAppKey = "" } diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 506de0f96..800f4d06e 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -120,11 +120,6 @@ 511D43EF231FBDE900FB1562 /* LaunchScreenPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 511D43ED231FBDE800FB1562 /* LaunchScreenPad.storyboard */; }; 511D4419231FC02D00FB1562 /* KeyboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 511D4410231FC02D00FB1562 /* KeyboardManager.swift */; }; 51236339236915B100951F16 /* RoundedProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512363372369155100951F16 /* RoundedProgressView.swift */; }; - 512392BE24E33A3C00F11704 /* RedditSelectAccountTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE603246AF37B00731738 /* RedditSelectAccountTableViewController.swift */; }; - 512392BF24E33A3C00F11704 /* RedditSelectSortTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE607246AFC9900731738 /* RedditSelectSortTableViewController.swift */; }; - 512392C024E33A3C00F11704 /* RedditAdd.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 516AE5FF246AF34100731738 /* RedditAdd.storyboard */; }; - 512392C124E33A3C00F11704 /* RedditSelectTypeTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE601246AF36100731738 /* RedditSelectTypeTableViewController.swift */; }; - 512392C224E33A3C00F11704 /* RedditEnterDetailTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE605246AF3A900731738 /* RedditEnterDetailTableViewController.swift */; }; 5126EE97226CB48A00C22AFC /* SceneCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5126EE96226CB48A00C22AFC /* SceneCoordinator.swift */; }; 5127B238222B4849006D641D /* DetailKeyboardDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5127B236222B4849006D641D /* DetailKeyboardDelegate.swift */; }; 5127B23A222B4849006D641D /* DetailKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5127B237222B4849006D641D /* DetailKeyboardShortcuts.plist */; }; @@ -247,9 +242,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 */; }; - 519ED47C24488C6F007F8E94 /* ExtensionInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519ED47B24488C6F007F8E94 /* ExtensionInspectorViewController.swift */; }; 51A052CE244FB9D7006C2024 /* AddFeedWIndowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */; }; 51A052CF244FB9D7006C2024 /* AddFeedWIndowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */; }; 51A16999235E10D700EB091F /* LocalAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */; }; @@ -1195,11 +1187,6 @@ 516A093A2360A4A000EAE89B /* SettingsTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SettingsTableViewCell.xib; sourceTree = ""; }; 516A093F2361240900EAE89B /* Account.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Account.storyboard; sourceTree = ""; }; 516A09412361248000EAE89B /* Inspector.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Inspector.storyboard; sourceTree = ""; }; - 516AE5FF246AF34100731738 /* RedditAdd.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RedditAdd.storyboard; sourceTree = ""; }; - 516AE601246AF36100731738 /* RedditSelectTypeTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedditSelectTypeTableViewController.swift; sourceTree = ""; }; - 516AE603246AF37B00731738 /* RedditSelectAccountTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedditSelectAccountTableViewController.swift; sourceTree = ""; }; - 516AE605246AF3A900731738 /* RedditEnterDetailTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedditEnterDetailTableViewController.swift; sourceTree = ""; }; - 516AE607246AFC9900731738 /* RedditSelectSortTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedditSelectSortTableViewController.swift; sourceTree = ""; }; 516AE9B22371C372007DEEAA /* MasterFeedTableViewSectionHeaderLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterFeedTableViewSectionHeaderLayout.swift; sourceTree = ""; }; 516AE9DE2372269A007DEEAA /* IconImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconImage.swift; sourceTree = ""; }; 51707438232AA97100A461A3 /* ShareFolderPickerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerController.swift; sourceTree = ""; }; @@ -1224,9 +1211,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 = ""; }; - 519ED47B24488C6F007F8E94 /* ExtensionInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionInspectorViewController.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 = ""; }; @@ -1781,7 +1765,6 @@ children = ( 516A09412361248000EAE89B /* Inspector.storyboard */, 51A16991235E10D600EB091F /* AccountInspectorViewController.swift */, - 519ED47B24488C6F007F8E94 /* ExtensionInspectorViewController.swift */, 5110C37C2373A8D100A9C04F /* InspectorIconHeaderView.swift */, 5141E7382373C18B0013FF27 /* WebFeedInspectorViewController.swift */, ); @@ -1864,18 +1847,6 @@ path = Account; sourceTree = ""; }; - 516AE5DD246AF2DD00731738 /* Reddit */ = { - isa = PBXGroup; - children = ( - 516AE5FF246AF34100731738 /* RedditAdd.storyboard */, - 516AE601246AF36100731738 /* RedditSelectTypeTableViewController.swift */, - 516AE603246AF37B00731738 /* RedditSelectAccountTableViewController.swift */, - 516AE605246AF3A900731738 /* RedditEnterDetailTableViewController.swift */, - 516AE607246AFC9900731738 /* RedditSelectSortTableViewController.swift */, - ); - path = Reddit; - sourceTree = ""; - }; 5183CCEA226F70350010922C /* Timer */ = { isa = PBXGroup; children = ( @@ -1891,11 +1862,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 */, @@ -2060,7 +2029,6 @@ 51C4528B2265095F00C03939 /* AddFolderViewController.swift */, 510289CC24519A1D00426DDF /* SelectComboTableViewCell.swift */, 51E36E8B239D6765006F47A5 /* AddFeedSelectFolderTableViewCell.xib */, - 516AE5DD246AF2DD00731738 /* Reddit */, ); path = Add; sourceTree = ""; @@ -3345,7 +3313,6 @@ 511D43CF231FA62200FB1562 /* DetailKeyboardShortcuts.plist in Resources */, 51A1699A235E10D700EB091F /* Settings.storyboard in Resources */, 49F40DF92335B71000552BF4 /* newsfoot.js in Resources */, - 512392C024E33A3C00F11704 /* RedditAdd.storyboard in Resources */, 51F85BEF2272520B00C787DC /* Thanks.rtf in Resources */, DFD6AACC27ADE80900463FAD /* NewsFax.nnwtheme in Resources */, 51CE1C0923621EDA005548FC /* RefreshProgressView.xib in Resources */, @@ -3914,7 +3881,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 */, @@ -3952,7 +3918,6 @@ 51C45294226509C800C03939 /* SearchFeedDelegate.swift in Sources */, 5F323809231DF9F000706F6B /* VibrantTableViewCell.swift in Sources */, 51FE10042345529D0056195D /* UserNotificationManager.swift in Sources */, - 519ED47C24488C6F007F8E94 /* ExtensionInspectorViewController.swift in Sources */, 51C4CFF224D37D1F00AF9874 /* Secrets.swift in Sources */, 51C452A022650A1900C03939 /* WebFeedIconDownloader.swift in Sources */, 51C4529E22650A1900C03939 /* ImageDownloader.swift in Sources */, @@ -3992,13 +3957,11 @@ C5A6ED6D23C9B0C800AB6BE2 /* UIActivityViewController-Extensions.swift in Sources */, 5108F6D42375EEEF001ABC45 /* TimelinePreviewTableViewController.swift in Sources */, 84CAFCA522BC8C08007694F0 /* FetchRequestQueue.swift in Sources */, - 512392BE24E33A3C00F11704 /* RedditSelectAccountTableViewController.swift in Sources */, 51C4529C22650A1000C03939 /* SingleFaviconDownloader.swift in Sources */, 17D643B226F8A436008D4C05 /* ArticleThemeDownloader.swift in Sources */, 51E595A6228CC36500FCC42B /* ArticleStatusSyncTimer.swift in Sources */, 51F9F3F723DF6DB200A314FD /* ArticleIconSchemeHandler.swift in Sources */, 512AF9C2236ED52C0066F8BE /* ImageHeaderView.swift in Sources */, - 512392C124E33A3C00F11704 /* RedditSelectTypeTableViewController.swift in Sources */, 51A1699F235E10D700EB091F /* AboutViewController.swift in Sources */, 51C45290226509C100C03939 /* PseudoFeed.swift in Sources */, 51C452A922650DC600C03939 /* ArticleRenderer.swift in Sources */, @@ -4010,7 +3973,6 @@ 51EF0F7E2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift in Sources */, 51A1699B235E10D700EB091F /* AccountInspectorViewController.swift in Sources */, 512D554423C804DE0023FFFA /* OpenInSafariActivity.swift in Sources */, - 512392C224E33A3C00F11704 /* RedditEnterDetailTableViewController.swift in Sources */, 51C452762265091600C03939 /* MasterTimelineViewController.swift in Sources */, 5195C1DC2720BD3000888867 /* MasterFeedRowIdentifier.swift in Sources */, 5108F6D823763094001ABC45 /* TickMarkSlider.swift in Sources */, @@ -4034,9 +3996,7 @@ 51C4529B22650A1000C03939 /* FaviconDownloader.swift in Sources */, 84DEE56622C32CA4005FC42C /* SmartFeedDelegate.swift in Sources */, 512E09012268907400BDCFDD /* MasterFeedTableViewSectionHeader.swift in Sources */, - 512392BF24E33A3C00F11704 /* RedditSelectSortTableViewController.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/Add/AddFeedViewController.swift b/iOS/Add/AddFeedViewController.swift index 98f473468..ffab05604 100644 --- a/iOS/Add/AddFeedViewController.swift +++ b/iOS/Add/AddFeedViewController.swift @@ -14,7 +14,6 @@ import RSParser enum AddFeedType { case web - case reddit } class AddFeedViewController: UITableViewController { @@ -39,14 +38,6 @@ class AddFeedViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - switch addFeedType { - case .reddit: - navigationItem.title = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed") - navigationItem.leftBarButtonItem = nil - default: - break - } - activityIndicator.isHidden = true activityIndicator.color = .label diff --git a/iOS/Add/Reddit/RedditAdd.storyboard b/iOS/Add/Reddit/RedditAdd.storyboard deleted file mode 100644 index 738c51e87..000000000 --- a/iOS/Add/Reddit/RedditAdd.storyboard +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iOS/Add/Reddit/RedditEnterDetailTableViewController.swift b/iOS/Add/Reddit/RedditEnterDetailTableViewController.swift deleted file mode 100644 index be1e75073..000000000 --- a/iOS/Add/Reddit/RedditEnterDetailTableViewController.swift +++ /dev/null @@ -1,64 +0,0 @@ -// -// RedditEnterDetailTableViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 5/12/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import Foundation - -import UIKit -import Account - -class RedditEnterDetailTableViewController: UITableViewController { - - @IBOutlet weak var detailTextField: UITextField! - - var nextBarButtonItem = UIBarButtonItem() - var redditFeedType: RedditFeedType? - - override func viewDidLoad() { - super.viewDidLoad() - - nextBarButtonItem.title = NSLocalizedString("Next", comment: "Next") - nextBarButtonItem.style = .plain - nextBarButtonItem.target = self - nextBarButtonItem.action = #selector(nextScene) - navigationItem.rightBarButtonItem = nextBarButtonItem - - detailTextField.delegate = self - NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: detailTextField) - - updateUI() - } - - @objc func nextScene() { - let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self) - selectSort.redditFeedType = redditFeedType - selectSort.subreddit = detailTextField.text?.collapsingWhitespace - navigationController?.pushViewController(selectSort, animated: true) - } - - @objc func textDidChange(_ note: Notification) { - updateUI() - } - -} - -extension RedditEnterDetailTableViewController: UITextFieldDelegate { - - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - textField.resignFirstResponder() - return true - } - -} - -private extension RedditEnterDetailTableViewController { - - func updateUI() { - nextBarButtonItem.isEnabled = !(detailTextField.text?.isEmpty ?? false) - } - -} diff --git a/iOS/Add/Reddit/RedditSelectAccountTableViewController.swift b/iOS/Add/Reddit/RedditSelectAccountTableViewController.swift deleted file mode 100644 index 98ba818d2..000000000 --- a/iOS/Add/Reddit/RedditSelectAccountTableViewController.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// RedditSelectAccountTableViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 5/12/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import Foundation - -import UIKit -import Account - -class RedditSelectAccountTableViewController: UITableViewController { - - private var redditFeedProviders = [RedditFeedProvider]() - - var redditFeedType: RedditFeedType? - - override func viewDidLoad() { - super.viewDidLoad() - redditFeedProviders = ExtensionPointManager.shared.activeExtensionPoints.values.compactMap { $0 as? RedditFeedProvider } - } - - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return redditFeedProviders.count - } - - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) - cell.textLabel?.text = redditFeedProviders[indexPath.row].title - return cell - } - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self) - selectSort.redditFeedType = redditFeedType - selectSort.username = redditFeedProviders[indexPath.row].username - navigationController?.pushViewController(selectSort, animated: true) - } - -} diff --git a/iOS/Add/Reddit/RedditSelectSortTableViewController.swift b/iOS/Add/Reddit/RedditSelectSortTableViewController.swift deleted file mode 100644 index 6ea6321b4..000000000 --- a/iOS/Add/Reddit/RedditSelectSortTableViewController.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// RedditSelectSortTableViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 5/12/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import UIKit -import Account - -class RedditSelectSortTableViewController: UITableViewController { - - var redditFeedType: RedditFeedType? - var username: String? - var subreddit: String? - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - let sort: RedditSort - switch indexPath.row { - case 0: - sort = .best - case 1: - sort = .hot - case 2: - sort = .new - case 3: - sort = .top - case 4: - sort = .rising - default: - fatalError() - } - - guard let redditFeedType = redditFeedType else { return } - let url = RedditFeedProvider.buildURL(redditFeedType, username: username, subreddit: subreddit, sort: sort)?.absoluteString - - let addViewController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddWebFeedViewController") as! AddFeedViewController - addViewController.addFeedType = .reddit - addViewController.initialFeed = url - navigationController?.pushViewController(addViewController, animated: true) - - } - -} diff --git a/iOS/Add/Reddit/RedditSelectTypeTableViewController.swift b/iOS/Add/Reddit/RedditSelectTypeTableViewController.swift deleted file mode 100644 index 1f8e2a0a7..000000000 --- a/iOS/Add/Reddit/RedditSelectTypeTableViewController.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// RedditSelectTypeTableViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 5/12/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import UIKit -import Account - -class RedditSelectTypeTableViewController: UITableViewController { - - @IBAction func cancel(_ sender: Any) { - dismiss(animated: true) - } - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - switch indexPath.row { - case 0: - let redditFeedProviders = ExtensionPointManager.shared.activeExtensionPoints.values.compactMap { $0 as? RedditFeedProvider } - if redditFeedProviders.count == 1 { - let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self) - selectSort.redditFeedType = .home - selectSort.username = redditFeedProviders.first!.username - navigationController?.pushViewController(selectSort, animated: true) - } else { - let selectAccount = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectAccountTableViewController.self) - selectAccount.redditFeedType = .home - navigationController?.pushViewController(selectAccount, animated: true) - } - case 1: - let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self) - selectSort.redditFeedType = .popular - navigationController?.pushViewController(selectSort, animated: true) - case 2: - let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self) - selectSort.redditFeedType = .all - navigationController?.pushViewController(selectSort, animated: true) - case 3: - let enterDetail = UIStoryboard.redditAdd.instantiateController(ofType: RedditEnterDetailTableViewController.self) - enterDetail.redditFeedType = .subreddit - navigationController?.pushViewController(enterDetail, animated: true) - default: - fatalError() - } - } - -} diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 54532faed..b74aaa043 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -101,10 +101,6 @@ struct AppAssets { return UIImage(named: "disclosure")! }() - static var contextMenuReddit: UIImage = { - return UIImage(named: "contextMenuReddit")! - }() - static var copyImage: UIImage = { return UIImage(systemName: "doc.on.doc")! }() @@ -117,10 +113,6 @@ struct AppAssets { UIImage(systemName: "square.and.pencil")! }() - static var extensionPointReddit: RSImage = { - return RSImage(named: "extensionPointReddit")! - }() - static var faviconTemplateImage: RSImage = { return RSImage(named: "faviconTemplateImage")! }() @@ -193,10 +185,6 @@ struct AppAssets { return UIColor(named: "primaryAccentColor")! } - static var redditOriginal: UIImage = { - return UIImage(named: "redditWhite")!.withRenderingMode(.alwaysOriginal).withTintColor(.secondaryLabel) - }() - static var safariImage: UIImage = { return UIImage(systemName: "safari")! }() diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index 04c3ed9df..3e229182e 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -41,7 +41,6 @@ final class AppDefaults { struct Key { static let userInterfaceColorPalette = "userInterfaceColorPalette" - static let activeExtensionPointIDs = "activeExtensionPointIDs" static let lastImageCacheFlushDate = "lastImageCacheFlushDate" static let firstRunDate = "firstRunDate" static let timelineGroupByFeed = "timelineGroupByFeed" @@ -116,15 +115,6 @@ final class AppDefaults { } } - var activeExtensionPointIDs: [[AnyHashable : AnyHashable]]? { - get { - return UserDefaults.standard.object(forKey: Key.activeExtensionPointIDs) as? [[AnyHashable : AnyHashable]] - } - set { - UserDefaults.standard.set(newValue, forKey: Key.activeExtensionPointIDs) - } - } - var useSystemBrowser: Bool { get { return UserDefaults.standard.bool(forKey: Key.useSystemBrowser) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 6fec34ce6..abdb2aad1 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -73,8 +73,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let documentThemesFolderPath = String(documentThemesFolder.suffix(from: documentAccountsFolder.index(documentThemesFolder.startIndex, offsetBy: 7))) ArticleThemesManager.shared = ArticleThemesManager(folderPath: documentThemesFolderPath) - FeedProviderManager.shared.delegate = ExtensionPointManager.shared - NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountRefreshDidFinish(_:)), name: .AccountRefreshDidFinish, object: nil) } diff --git a/iOS/Inspector/ExtensionInspectorViewController.swift b/iOS/Inspector/ExtensionInspectorViewController.swift deleted file mode 100644 index 79c2cc43c..000000000 --- a/iOS/Inspector/ExtensionInspectorViewController.swift +++ /dev/null @@ -1,81 +0,0 @@ -// -// ExtensionPointInspectorViewController.swift -// NetNewsWire-iOS -// -// Created by Maurice Parker on 4/16/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import UIKit - -class ExtensionPointInspectorViewController: UITableViewController { - - @IBOutlet weak var extensionDescription: UILabel! - var extensionPoint: ExtensionPoint? - - override func viewDidLoad() { - super.viewDidLoad() - guard let extensionPoint = extensionPoint else { return } - navigationItem.title = extensionPoint.title - extensionDescription.attributedText = extensionPoint.description - tableView.register(ImageHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader") - } - - @IBAction func disable(_ sender: Any) { - guard let extensionPoint = extensionPoint else { return } - - let title = NSLocalizedString("Deactivate Extension", comment: "Deactivate Extension") - let extensionPointTypeTitle = extensionPoint.extensionPointID.extensionPointType.title - let message = NSLocalizedString("Are you sure you want to deactivate the \(extensionPointTypeTitle) extension “\(extensionPoint.title)”?", comment: "Deactivate text") - - let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) - let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel") - let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) - alertController.addAction(cancelAction) - - let markTitle = NSLocalizedString("Deactivate", comment: "Deactivate") - let markAction = UIAlertAction(title: markTitle, style: .default) { [weak self] (action) in - ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint.extensionPointID) - self?.navigationController?.popViewController(animated: true) - } - alertController.addAction(markAction) - alertController.preferredAction = markAction - - present(alertController, animated: true) - - } -} - -// MARK: Table View - -extension ExtensionPointInspectorViewController { - - 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? { - guard let extensionPoint = extensionPoint else { return nil } - - if section == 0 { - let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! ImageHeaderView - headerView.imageView.image = extensionPoint.image - return headerView - } else { - return super.tableView(tableView, viewForHeaderInSection: section) - } - } - - override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool { - if indexPath.section > 0 { - return true - } - return false - } - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - tableView.selectRow(at: nil, animated: true, scrollPosition: .none) - } - -} - diff --git a/iOS/Inspector/Inspector.storyboard b/iOS/Inspector/Inspector.storyboard index 7dd8ddd8f..e05bb02b6 100644 --- a/iOS/Inspector/Inspector.storyboard +++ b/iOS/Inspector/Inspector.storyboard @@ -1,9 +1,9 @@ - + - + @@ -401,95 +401,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -498,7 +409,7 @@ - + diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 7aa6592d0..041ca2ffa 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -71,9 +71,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .WebFeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(configureContextMenu(_:)), name: .ActiveExtensionPointsDidChange, object: nil) - + NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) refreshControl = UIRefreshControl() refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged) @@ -461,11 +459,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { self.coordinator.showAddWebFeed() } - let addRedditFeedActionTitle = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed") - let addRedditFeedAction = UIAlertAction(title: addRedditFeedActionTitle, style: .default) { _ in - self.coordinator.showAddRedditFeed() - } - let addWebFolderdActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder") let addWebFolderAction = UIAlertAction(title: addWebFolderdActionTitle, style: .default) { _ in self.coordinator.showAddFolder() @@ -473,12 +466,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { alertController.addAction(addWebFeedAction) - if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) { - if ExtensionPointManager.shared.isRedditEnabled { - alertController.addAction(addRedditFeedAction) - } - } - alertController.addAction(addWebFolderAction) alertController.addAction(cancelAction) @@ -671,29 +658,18 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { /* Context Menu Order: - 1. Add Web Feed - 2. Add Reddit Feed + 1. Add Feed 3. Add Folder */ var menuItems: [UIAction] = [] - let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed") + let addWebFeedActionTitle = NSLocalizedString("Add Feed", comment: "Add Feed") let addWebFeedAction = UIAction(title: addWebFeedActionTitle, image: AppAssets.plus) { _ in self.coordinator.showAddWebFeed() } menuItems.append(addWebFeedAction) - if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) { - if ExtensionPointManager.shared.isRedditEnabled { - let addRedditFeedActionTitle = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed") - let addRedditFeedAction = UIAction(title: addRedditFeedActionTitle, image: AppAssets.contextMenuReddit.tinted(color: .label)) { _ in - self.coordinator.showAddRedditFeed() - } - menuItems.append(addRedditFeedAction) - } - } - let addWebFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder") let addWebFolderAction = UIAction(title: addWebFolderActionTitle, image: AppAssets.folderOutlinePlus) { _ in self.coordinator.showAddFolder() @@ -752,7 +728,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { return false } - return ExtensionPointManager.shared.isRedditEnabled + return AccountManager.shared.anyLocalOriCloudAccountHasAtLeastOneRedditAPIFeed() } private func showRedditDeprecationAlert() { @@ -760,7 +736,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { AppDefaults.shared.redditDeprecationAlertShown = true let alert = UIAlertController(title: NSLocalizedString("Reddit API Integration Removed", comment: "Reddit API Integration Removed"), - message: NSLocalizedString("Reddit has announced the end of free access to their API, effective July 1.\n\nThough Reddit does provide RSS feeds, we use the Reddit API to get more and better data. But, without free access to that API, we will stop using it on June 30, 2023.\n\nWe’ve left your Reddit 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.\n\nAlso, importantly — after you remove Reddit from your extensions in NetNewsWire, you can add Reddit RSS feeds and those feeds will continue to update.", comment: "Reddit deprecation message"), + message: NSLocalizedString("Reddit has ended free access to their API.\n\nThough Reddit does provide RSS feeds, we used the Reddit API to get more and better data. But, without free access to that API, we have had to stop using it.\n\nWe’ve left your Reddit 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.\n\nAlso, importantly, you can add Reddit RSS feeds and those feeds will continue to update.", comment: "Reddit deprecation message"), preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .cancel)) diff --git a/iOS/Resources/Assets.xcassets/contextMenuReddit.imageset/Contents.json b/iOS/Resources/Assets.xcassets/contextMenuReddit.imageset/Contents.json deleted file mode 100644 index 21dcfdf56..000000000 --- a/iOS/Resources/Assets.xcassets/contextMenuReddit.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "redditContextMenu.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/iOS/Resources/Assets.xcassets/contextMenuReddit.imageset/redditContextMenu.pdf b/iOS/Resources/Assets.xcassets/contextMenuReddit.imageset/redditContextMenu.pdf deleted file mode 100644 index aac84d620..000000000 Binary files a/iOS/Resources/Assets.xcassets/contextMenuReddit.imageset/redditContextMenu.pdf and /dev/null differ diff --git a/iOS/Resources/Assets.xcassets/extensionPointReddit.imageset/Contents.json b/iOS/Resources/Assets.xcassets/extensionPointReddit.imageset/Contents.json deleted file mode 100644 index 237cc2c56..000000000 --- a/iOS/Resources/Assets.xcassets/extensionPointReddit.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "reddit_logo.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "template-rendering-intent" : "original" - } -} diff --git a/iOS/Resources/Assets.xcassets/extensionPointReddit.imageset/reddit_logo.pdf b/iOS/Resources/Assets.xcassets/extensionPointReddit.imageset/reddit_logo.pdf deleted file mode 100644 index 2d16b9786..000000000 Binary files a/iOS/Resources/Assets.xcassets/extensionPointReddit.imageset/reddit_logo.pdf and /dev/null differ diff --git a/iOS/Resources/Assets.xcassets/redditWhite.imageset/Contents.json b/iOS/Resources/Assets.xcassets/redditWhite.imageset/Contents.json deleted file mode 100644 index fc545ce7c..000000000 --- a/iOS/Resources/Assets.xcassets/redditWhite.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "redditWhite.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/iOS/Resources/Assets.xcassets/redditWhite.imageset/redditWhite.pdf b/iOS/Resources/Assets.xcassets/redditWhite.imageset/redditWhite.pdf deleted file mode 100644 index 4d66907a9..000000000 Binary files a/iOS/Resources/Assets.xcassets/redditWhite.imageset/redditWhite.pdf and /dev/null differ diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 4130e7c99..830c2fa9b 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1230,13 +1230,6 @@ class SceneCoordinator: NSObject, UndoableCommandRunner { masterFeedViewController.present(addNavViewController, animated: true) } - func showAddRedditFeed() { - let addNavViewController = UIStoryboard.redditAdd.instantiateInitialViewController() as! UINavigationController - addNavViewController.modalPresentationStyle = .formSheet - addNavViewController.preferredContentSize = AddFeedViewController.preferredContentSizeForFormSheetDisplay - masterFeedViewController.present(addNavViewController, animated: true) - } - func showAddFolder() { let addNavViewController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddFolderViewControllerNav") as! UINavigationController addNavViewController.modalPresentationStyle = .formSheet 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/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..4f5954455 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -1,9 +1,9 @@ - + - + @@ -21,7 +21,7 @@ - + @@ -42,14 +42,14 @@ - + - +