Reader and CloudKit Account Views

This commit is contained in:
Stuart Breckenridge
2022-12-16 16:38:06 +08:00
parent b3208bf269
commit 4ff0bc8f98
20 changed files with 554 additions and 149 deletions

View File

@@ -92,4 +92,3 @@
"EXPORT_OPML_SUCCESS_TITLE" = "Exported Successfully";
"EXPORT_OPML_SUCCESS_MESSAGE" = "Your OPML file has been successfully exported.";
"ERROR_TITLE" = "Error";
"REMOVE" = "Remove";

View File

@@ -31,7 +31,6 @@ struct AccountsManagementView: View {
accountRow(account, showRemoveAccountAlert: $showRemoveAccountAlert, accountToRemove: $accountToRemove)
}
}
}
.navigationTitle(Text("MANAGE_ACCOUNTS", tableName: "Settings"))
.tint(Color(uiColor: AppAssets.primaryAccentColor))
@@ -60,14 +59,14 @@ struct AccountsManagementView: View {
refreshAccounts()
}
.sheet(isPresented: $showAddAccountSheet) {
AddAccountView()
AddAccountListView()
}
.alert(Text("ACCOUNT_REMOVE \(accountToRemove?.nameForDisplay ?? "")", tableName: "Settings"),
isPresented: $showRemoveAccountAlert) {
Button(role: .destructive) {
AccountManager.shared.deleteAccount(accountToRemove!)
} label: {
Text("REMOVE", tableName: "Settings")
Text("REMOVE_BUTTON_TITLE", tableName: "Buttons")
}
Button(role: .cancel) {
@@ -113,7 +112,7 @@ struct AccountsManagementView: View {
showRemoveAccountAlert.wrappedValue = true
} label: {
Label {
Text("REMOVE_ACCOUNT_TITLE", tableName: "Settings")
Text("REMOVE_ACCOUNT_BUTTON_TITLE", tableName: "Buttons")
} icon: {
Image(systemName: "trash")
}

View File

@@ -1,5 +1,5 @@
//
// AddAccountView.swift
// AddAccountListView.swift
// NetNewsWire-iOS
//
// Created by Stuart Breckenridge on 15/12/2022.
@@ -10,7 +10,7 @@ import SwiftUI
import Account
import RSCore
public final class AddAcccountViewModel: ObservableObject, OAuthAccountAuthorizationOperationDelegate {
public final class AddAccountListViewModel: ObservableObject, OAuthAccountAuthorizationOperationDelegate {
@Published public var showAddAccountSheet: (Bool, accountType: AccountType) = (false, .onMyMac)
public var webAccountTypes: [AccountType] {
@@ -58,10 +58,10 @@ public final class AddAcccountViewModel: ObservableObject, OAuthAccountAuthoriza
}
}
struct AddAccountView: View {
struct AddAccountListView: View {
@Environment(\.dismiss) var dismiss
@StateObject private var viewModel = AddAcccountViewModel()
@StateObject private var viewModel = AddAccountListViewModel()
var body: some View {
@@ -89,9 +89,9 @@ struct AddAccountView: View {
case .onMyMac:
Text("ON MY MAC")
case .cloudKit:
Text("CLOUDKIT")
case .freshRSS:
Text("SELF_HOSTED")
iCloudAccountView()
case .freshRSS, .inoreader, .bazQux, .theOldReader:
ReaderAPIAccountView(accountType: viewModel.showAddAccountSheet.accountType, account: nil)
default:
Text(viewModel.showAddAccountSheet.accountType.localizedAccountName())
}

View File

@@ -86,7 +86,7 @@ struct SettingsView: View {
.navigationTitle(Text("SETTINGS_TITLE", tableName: "Settings"))
.navigationBarTitleDisplayMode(.inline)
.sheet(isPresented: $viewModel.showAddAccountView) {
AddAccountView()
AddAccountListView()
}
.sheet(isPresented: $viewModel.showHelpSheet) {
SafariView(url: viewModel.helpSheet.url)