mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-04 11:16:59 +00:00
Offer update-credentials for all username/password accounts (not Feedbin only).
This commit is contained in:
1 parent
a44cfe13ce
commit
263ec26831
3 files changed
+11
-13
No files matched your search
@@ -27,6 +27,9 @@ struct CredentialsAccountView: View {
|
||||
@State private var errorMessage: String?
|
||||
@State private var isShowingSignUp = false
|
||||
|
||||
/// Account types that sign in with this sheet.
|
||||
static let accountTypes: Set<AccountType> = [.feedbin, .newsBlur, .inoreader, .bazQux, .theOldReader, .freshRSS]
|
||||
|
||||
private static let passwordPlaceholder = NSLocalizedString("Password", comment: "Password field placeholder")
|
||||
|
||||
init(accountType: AccountType, account: Account?, didAddAccount: (() -> Void)?) {
|
||||
|
||||
@@ -67,15 +67,12 @@ final class AccountInspectorViewController: UITableViewController {
|
||||
}
|
||||
|
||||
@IBAction func credentials(_ sender: Any) {
|
||||
guard let account = account else { return }
|
||||
switch account.type {
|
||||
case .feedbin, .newsBlur, .inoreader, .bazQux, .theOldReader, .freshRSS:
|
||||
let hostingController = UIHostingController(rootView: CredentialsAccountView(accountType: account.type, account: account, didAddAccount: nil))
|
||||
hostingController.modalPresentationStyle = .currentContext
|
||||
present(hostingController, animated: true)
|
||||
default:
|
||||
break
|
||||
guard let account, CredentialsAccountView.accountTypes.contains(account.type) else {
|
||||
return
|
||||
}
|
||||
let hostingController = UIHostingController(rootView: CredentialsAccountView(accountType: account.type, account: account, didAddAccount: nil))
|
||||
hostingController.modalPresentationStyle = .currentContext
|
||||
present(hostingController, animated: true)
|
||||
}
|
||||
|
||||
@IBAction func deleteAccount(_ sender: Any) {
|
||||
|
||||
@@ -35,21 +35,19 @@ private extension UIViewController {
|
||||
let title = NSLocalizedString("Account Error", comment: "Account Error")
|
||||
let alertController = UIAlertController(title: title, message: error.localizedDescription, preferredStyle: .alert)
|
||||
|
||||
let account = AccountError.account(from: error)
|
||||
if account?.type == .feedbin {
|
||||
|
||||
if let account = AccountError.account(from: error), CredentialsAccountView.accountTypes.contains(account.type) {
|
||||
let credentialsTitle = NSLocalizedString("Update Credentials", comment: "Update Credentials")
|
||||
let credentialsAction = UIAlertAction(title: credentialsTitle, style: .default) { [weak self] _ in
|
||||
dismiss?()
|
||||
|
||||
let hostingController = UIHostingController(rootView: CredentialsAccountView(accountType: .feedbin, account: account, didAddAccount: nil))
|
||||
let hostingController = UIHostingController(rootView: CredentialsAccountView(accountType: account.type, account: account, didAddAccount: nil))
|
||||
hostingController.modalPresentationStyle = .formSheet
|
||||
hostingController.preferredContentSize = UIViewController.formSheetSize
|
||||
self?.present(hostingController, animated: true)
|
||||
}
|
||||
|
||||
alertController.addAction(credentialsAction)
|
||||
alertController.preferredAction = credentialsAction
|
||||
|
||||
}
|
||||
|
||||
let dismissTitle = NSLocalizedString("OK", comment: "OK button")
|
||||
|
||||
Reference in new issue
Block a user