From 345b580f8525456d957a6fbc63aeb02af01e2a9d Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Thu, 22 Dec 2022 18:28:15 +0800 Subject: [PATCH] Audited alerts and confirmation dialogs --- iOS/Inspector/AccountInspectorView.swift | 8 ++------ iOS/Inspector/ExtensionInspectorView.swift | 4 ++-- .../Accounts/AccountsManagementView.swift | 12 +----------- .../Extensions/ExtensionsManagementView.swift | 4 ++-- .../Appearance/ArticleThemeManagerView.swift | 2 +- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/iOS/Inspector/AccountInspectorView.swift b/iOS/Inspector/AccountInspectorView.swift index 261e8c5b6..feeb2a008 100644 --- a/iOS/Inspector/AccountInspectorView.swift +++ b/iOS/Inspector/AccountInspectorView.swift @@ -109,7 +109,7 @@ struct AccountInspectorView: View { Spacer() } } - .confirmationDialog(Text("Remove Account", comment: "Remove account alert title"), isPresented: $showRemoveAccountAlert, titleVisibility: .visible) { + .alert(Text("Are you sure you want to remove “\(account.nameForDisplay)”?", comment: "Alert title: confirm account removal"), isPresented: $showRemoveAccountAlert) { Button(role: .destructive) { AccountManager.shared.deleteAccount(account) dismiss() @@ -124,11 +124,7 @@ struct AccountInspectorView: View { } } message: { - if account.type == .feedly { - Text("Are you sure you want to remove this account? NetNewsWire will no longer be able to access articles and feeds unless the account is added again.", comment: "Confirmation of the impacts of deleting the Feedly account.") - } else { - Text("Are you sure you want to remove this account? This cannot be undone.", comment: "Confirmation of the impacts of deleting the account.") - } + Text("This action cannot be undone.", comment: "Alert message: remove account confirmation") } } } diff --git a/iOS/Inspector/ExtensionInspectorView.swift b/iOS/Inspector/ExtensionInspectorView.swift index fa300f71c..b489bf8ad 100644 --- a/iOS/Inspector/ExtensionInspectorView.swift +++ b/iOS/Inspector/ExtensionInspectorView.swift @@ -28,7 +28,7 @@ struct ExtensionInspectorView: View { } label: { Text("Deactivate Extension", comment: "Button title") } - .confirmationDialog(Text("Deactivate Extension", comment: "Deactivate Extension confirmation title") , isPresented: $showDeactivateConfirmation, titleVisibility: .visible) { + .alert(Text("Are you sure you want to deactivate “\(extensionPoint?.title ?? "")?", comment: "Alert title: confirm deactivate extension") , isPresented: $showDeactivateConfirmation) { Button(role: .destructive) { ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint!.extensionPointID) @@ -43,7 +43,7 @@ struct ExtensionInspectorView: View { Text("Cancel", comment: "Button title") } } message: { - Text("Are you sure you want to deactivate the “\(extensionPoint?.title ?? "")” extension?)", comment: "Confirmation text regarding deactivation on an extension.") + Text("This action cannot be undone.", comment: "Alert message: remove account confirmation") } Spacer() } diff --git a/iOS/Settings/Account and Extensions/Accounts/AccountsManagementView.swift b/iOS/Settings/Account and Extensions/Accounts/AccountsManagementView.swift index 18f376411..d1fa6f4c6 100644 --- a/iOS/Settings/Account and Extensions/Accounts/AccountsManagementView.swift +++ b/iOS/Settings/Account and Extensions/Accounts/AccountsManagementView.swift @@ -107,17 +107,7 @@ struct AccountsManagementView: View { Text("Cancel", comment: "Button title") } } message: { - switch viewModel.accountToDelete { - case .none: - Text("") - case .some(let account): - switch account.type { - case .feedly: - Text("Are you sure you want to remove this account? NetNewsWire will no longer be able to access articles and feeds unless the account is added again.", comment: "Alert message: remove Feedly account confirmation") - default: - Text("Are you sure you want to remove this account? This cannot be undone.", comment: "Alert message: remove account confirmation") - } - } + Text("This action cannot be undone.", comment: "Alert message: remove account confirmation") } } diff --git a/iOS/Settings/Account and Extensions/Extensions/ExtensionsManagementView.swift b/iOS/Settings/Account and Extensions/Extensions/ExtensionsManagementView.swift index 41ead8854..dee971c3d 100644 --- a/iOS/Settings/Account and Extensions/Extensions/ExtensionsManagementView.swift +++ b/iOS/Settings/Account and Extensions/Extensions/ExtensionsManagementView.swift @@ -33,7 +33,7 @@ struct ExtensionsManagementView: View { .sheet(isPresented: $showAddExtensionView) { AddExtensionListView() } - .alert(Text("Deactivate Extension", comment: "Alert title: confirm deactivate extension"), + .alert(Text("Are you sure you want to deactivate “\(extensionToDeactivate?.value.title ?? "")?", comment: "Alert title: confirm deactivate extension"), isPresented: $showDeactivateAlert) { Button(role: .destructive) { @@ -49,7 +49,7 @@ struct ExtensionsManagementView: View { } } message: { - Text("Are you sure you want to deactivate the “\(extensionToDeactivate?.value.title ?? "")” extension?", comment: "Alert message: confirm deactivation of extension.") + Text("This action cannot be undone.", comment: "Alert message: confirmation that deactivation of extension cannot be undone.") } .onReceive(NotificationCenter.default.publisher(for: .ActiveExtensionPointsDidChange)) { _ in availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title }) diff --git a/iOS/Settings/Appearance/ArticleThemeManagerView.swift b/iOS/Settings/Appearance/ArticleThemeManagerView.swift index 6532daf90..a8d75844c 100644 --- a/iOS/Settings/Appearance/ArticleThemeManagerView.swift +++ b/iOS/Settings/Appearance/ArticleThemeManagerView.swift @@ -83,7 +83,7 @@ struct ArticleThemeManagerView: View { Text("Cancel", comment: "Button title") } }, message: { - Text("Are you sure you want to delete this theme? This action cannot be undone.", comment: "Alert message: confirm theme deletion") + Text("This action cannot be undone.", comment: "Alert message: confirm theme deletion") }) .alert(Text("Import Theme", comment: "Alert title: confirm theme import"), isPresented: $showImportConfirmationAlert.1,