mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Removeds AddAccountViewController
This commit is contained in:
@@ -289,7 +289,6 @@
|
||||
51A052CF244FB9D7006C2024 /* 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 */; };
|
||||
51A1699C235E10D700EB091F /* AddAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16992235E10D600EB091F /* AddAccountViewController.swift */; };
|
||||
51A169A0235E10D700EB091F /* FeedbinAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */; };
|
||||
51A66685238075AE00CB272D /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; };
|
||||
51A737AE24DB19730015FA66 /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 51A737AD24DB19730015FA66 /* RSCore */; };
|
||||
@@ -1307,7 +1306,6 @@
|
||||
51A052CD244FB9D6006C2024 /* AddFeedWIndowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AddFeedWIndowController.swift; path = AddFeed/AddFeedWIndowController.swift; sourceTree = "<group>"; };
|
||||
51A1698F235E10D600EB091F /* LocalAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalAccountViewController.swift; sourceTree = "<group>"; };
|
||||
51A16990235E10D600EB091F /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = "<group>"; };
|
||||
51A16992235E10D600EB091F /* AddAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddAccountViewController.swift; sourceTree = "<group>"; };
|
||||
51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedbinAccountViewController.swift; sourceTree = "<group>"; };
|
||||
51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedDefaultContainer.swift; sourceTree = "<group>"; };
|
||||
51A9A5E32380C8870033AADF /* ShareFolderPickerAccountCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerAccountCell.xib; sourceTree = "<group>"; };
|
||||
@@ -2021,7 +2019,6 @@
|
||||
children = (
|
||||
DF32ABEA29494CF0008E3A12 /* Settings.strings */,
|
||||
DFD406F8291FB5D500C02962 /* Views */,
|
||||
51A16992235E10D600EB091F /* AddAccountViewController.swift */,
|
||||
519ED455244828C3007F8E94 /* AddExtensionPointViewController.swift */,
|
||||
5137C2E926F63AE6009EFEDB /* ArticleThemeImporter.swift */,
|
||||
510FFAB226EEA22C00F32265 /* ArticleThemesTableViewController.swift */,
|
||||
@@ -4214,7 +4211,6 @@
|
||||
DF3630ED2936183D00326FB8 /* OPMLDocument.swift in Sources */,
|
||||
176813D22564BA5900D98635 /* WidgetDataEncoder.swift in Sources */,
|
||||
51D5948722668EFA00DFC836 /* MarkStatusCommand.swift in Sources */,
|
||||
51A1699C235E10D700EB091F /* AddAccountViewController.swift in Sources */,
|
||||
51A16999235E10D700EB091F /* LocalAccountViewController.swift in Sources */,
|
||||
176813D12564BA5900D98635 /* WidgetDataDecoder.swift in Sources */,
|
||||
176813D02564BA5900D98635 /* WidgetData.swift in Sources */,
|
||||
|
||||
@@ -34,7 +34,7 @@ struct WebFeedInspectorView: View {
|
||||
|
||||
if webFeed.isFeedProvider == false {
|
||||
Toggle(isOn: Binding(
|
||||
get: { webFeed.isArticleExtractorAlwaysOn ?? false },
|
||||
get: { webFeed.isArticleExtractorAlwaysOn ?? false },
|
||||
set: { webFeed.isArticleExtractorAlwaysOn = $0 })) {
|
||||
Text("ALWAYS_SHOW_READER_VIEW", tableName: "Inspector")
|
||||
}
|
||||
|
||||
@@ -1,251 +0,0 @@
|
||||
//
|
||||
// AddAccountViewController.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 5/16/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Account
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import RSCore
|
||||
|
||||
protocol AddAccountDismissDelegate: UIViewController {
|
||||
func dismiss()
|
||||
}
|
||||
|
||||
@available(*, deprecated, message: "Use AddAccountView")
|
||||
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
|
||||
|
||||
private enum AddAccountSections: Int, CaseIterable {
|
||||
case local = 0
|
||||
case icloud
|
||||
case web
|
||||
case selfhosted
|
||||
|
||||
var sectionHeader: String {
|
||||
switch self {
|
||||
case .local:
|
||||
return NSLocalizedString("Local", comment: "Local Account")
|
||||
case .icloud:
|
||||
return NSLocalizedString("iCloud", comment: "iCloud Account")
|
||||
case .web:
|
||||
return NSLocalizedString("Web", comment: "Web Account")
|
||||
case .selfhosted:
|
||||
return NSLocalizedString("Self-hosted", comment: "Self hosted Account")
|
||||
}
|
||||
}
|
||||
|
||||
var sectionFooter: String {
|
||||
switch self {
|
||||
case .local:
|
||||
return NSLocalizedString("Local accounts do not sync your feeds across devices", comment: "Local Account")
|
||||
case .icloud:
|
||||
return NSLocalizedString("Your iCloud account syncs your feeds across your Mac and iOS devices", comment: "iCloud Account")
|
||||
case .web:
|
||||
return NSLocalizedString("Web accounts sync your feeds across all your devices", comment: "Web Account")
|
||||
case .selfhosted:
|
||||
return NSLocalizedString("Self-hosted accounts sync your feeds across all your devices", comment: "Self hosted Account")
|
||||
}
|
||||
}
|
||||
|
||||
var sectionContent: [AccountType] {
|
||||
switch self {
|
||||
case .local:
|
||||
return [.onMyMac]
|
||||
case .icloud:
|
||||
return [.cloudKit]
|
||||
case .web:
|
||||
#if DEBUG
|
||||
return [.bazQux, .feedbin, .feedly, .inoreader, .newsBlur, .theOldReader]
|
||||
#else
|
||||
return [.bazQux, .feedbin, .feedly, .inoreader, .newsBlur, .theOldReader]
|
||||
#endif
|
||||
case .selfhosted:
|
||||
return [.freshRSS]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
||||
return AddAccountSections.allCases.count
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
if section == AddAccountSections.local.rawValue {
|
||||
return AddAccountSections.local.sectionContent.count
|
||||
}
|
||||
|
||||
if section == AddAccountSections.icloud.rawValue {
|
||||
return AddAccountSections.icloud.sectionContent.count
|
||||
}
|
||||
|
||||
if section == AddAccountSections.web.rawValue {
|
||||
return AddAccountSections.web.sectionContent.count
|
||||
}
|
||||
|
||||
if section == AddAccountSections.selfhosted.rawValue {
|
||||
return AddAccountSections.selfhosted.sectionContent.count
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
switch section {
|
||||
case AddAccountSections.local.rawValue:
|
||||
return AddAccountSections.local.sectionHeader
|
||||
case AddAccountSections.icloud.rawValue:
|
||||
return AddAccountSections.icloud.sectionHeader
|
||||
case AddAccountSections.web.rawValue:
|
||||
return AddAccountSections.web.sectionHeader
|
||||
case AddAccountSections.selfhosted.rawValue:
|
||||
return AddAccountSections.selfhosted.sectionHeader
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
|
||||
switch section {
|
||||
case AddAccountSections.local.rawValue:
|
||||
return AddAccountSections.local.sectionFooter
|
||||
case AddAccountSections.icloud.rawValue:
|
||||
return AddAccountSections.icloud.sectionFooter
|
||||
case AddAccountSections.web.rawValue:
|
||||
return AddAccountSections.web.sectionFooter
|
||||
case AddAccountSections.selfhosted.rawValue:
|
||||
return AddAccountSections.selfhosted.sectionFooter
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "SettingsAccountTableViewCell", for: indexPath) as! SettingsComboTableViewCell
|
||||
|
||||
switch indexPath.section {
|
||||
case AddAccountSections.local.rawValue:
|
||||
cell.comboNameLabel?.text = AddAccountSections.local.sectionContent[indexPath.row].localizedAccountName()
|
||||
cell.comboImage?.image = AppAssets.image(for: .onMyMac)
|
||||
case AddAccountSections.icloud.rawValue:
|
||||
cell.comboNameLabel?.text = AddAccountSections.icloud.sectionContent[indexPath.row].localizedAccountName()
|
||||
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.icloud.sectionContent[indexPath.row])
|
||||
if AppDefaults.shared.isDeveloperBuild || AccountManager.shared.accounts.contains(where: { $0.type == .cloudKit }) {
|
||||
cell.isUserInteractionEnabled = false
|
||||
cell.comboNameLabel?.isEnabled = false
|
||||
}
|
||||
case AddAccountSections.web.rawValue:
|
||||
cell.comboNameLabel?.text = AddAccountSections.web.sectionContent[indexPath.row].localizedAccountName()
|
||||
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.web.sectionContent[indexPath.row])
|
||||
let type = AddAccountSections.web.sectionContent[indexPath.row]
|
||||
if (type == .feedly || type == .inoreader) && AppDefaults.shared.isDeveloperBuild {
|
||||
cell.isUserInteractionEnabled = false
|
||||
cell.comboNameLabel?.isEnabled = false
|
||||
}
|
||||
case AddAccountSections.selfhosted.rawValue:
|
||||
cell.comboNameLabel?.text = AddAccountSections.selfhosted.sectionContent[indexPath.row].localizedAccountName()
|
||||
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.selfhosted.sectionContent[indexPath.row])
|
||||
|
||||
default:
|
||||
return cell
|
||||
}
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
|
||||
switch indexPath.section {
|
||||
case AddAccountSections.local.rawValue:
|
||||
let type = AddAccountSections.local.sectionContent[indexPath.row]
|
||||
presentController(for: type)
|
||||
case AddAccountSections.icloud.rawValue:
|
||||
let type = AddAccountSections.icloud.sectionContent[indexPath.row]
|
||||
presentController(for: type)
|
||||
case AddAccountSections.web.rawValue:
|
||||
let type = AddAccountSections.web.sectionContent[indexPath.row]
|
||||
presentController(for: type)
|
||||
case AddAccountSections.selfhosted.rawValue:
|
||||
let type = AddAccountSections.selfhosted.sectionContent[indexPath.row]
|
||||
presentController(for: type)
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
private func presentController(for accountType: AccountType) {
|
||||
switch accountType {
|
||||
case .onMyMac:
|
||||
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "LocalAccountNavigationViewController") as! UINavigationController
|
||||
navController.modalPresentationStyle = .currentContext
|
||||
let addViewController = navController.topViewController as! LocalAccountViewController
|
||||
addViewController.delegate = self
|
||||
present(navController, animated: true)
|
||||
case .cloudKit:
|
||||
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "CloudKitAccountNavigationViewController") as! UINavigationController
|
||||
navController.modalPresentationStyle = .currentContext
|
||||
let addViewController = navController.topViewController as! CloudKitAccountViewController
|
||||
addViewController.delegate = self
|
||||
present(navController, animated: true)
|
||||
case .feedbin:
|
||||
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController
|
||||
navController.modalPresentationStyle = .currentContext
|
||||
let addViewController = navController.topViewController as! FeedbinAccountViewController
|
||||
addViewController.delegate = self
|
||||
present(navController, animated: true)
|
||||
case .feedly:
|
||||
let addAccount = OAuthAccountAuthorizationOperation(accountType: .feedly)
|
||||
addAccount.delegate = self
|
||||
addAccount.presentationAnchor = self.view.window!
|
||||
MainThreadOperationQueue.shared.add(addAccount)
|
||||
case .newsBlur:
|
||||
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "NewsBlurAccountNavigationViewController") as! UINavigationController
|
||||
navController.modalPresentationStyle = .currentContext
|
||||
let addViewController = navController.topViewController as! NewsBlurAccountViewController
|
||||
addViewController.delegate = self
|
||||
present(navController, animated: true)
|
||||
case .bazQux, .inoreader, .freshRSS, .theOldReader:
|
||||
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "ReaderAPIAccountNavigationViewController") as! UINavigationController
|
||||
navController.modalPresentationStyle = .currentContext
|
||||
let addViewController = navController.topViewController as! ReaderAPIAccountViewController
|
||||
addViewController.accountType = accountType
|
||||
addViewController.delegate = self
|
||||
present(navController, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
navigationController?.popViewController(animated: false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AddAccountViewController: OAuthAccountAuthorizationOperationDelegate {
|
||||
|
||||
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account) {
|
||||
let rootViewController = view.window?.rootViewController
|
||||
|
||||
account.refreshAll { result in
|
||||
switch result {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
guard let viewController = rootViewController else {
|
||||
return
|
||||
}
|
||||
viewController.presentError(error)
|
||||
}
|
||||
}
|
||||
|
||||
dismiss()
|
||||
}
|
||||
|
||||
func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didFailWith error: Error) {
|
||||
presentError(error)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user