From 00a148cd71572c474a0ac987d9ca54426a826212 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Tue, 13 Dec 2022 09:43:34 +0800 Subject: [PATCH] Improves UI for swipe to remove accounts --- .../ExtensionPointManager.swift | 2 +- .../AccountsManagementView.swift | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Shared/ExtensionPoints/ExtensionPointManager.swift b/Shared/ExtensionPoints/ExtensionPointManager.swift index bd8a173cb..bf8cb0402 100644 --- a/Shared/ExtensionPoints/ExtensionPointManager.swift +++ b/Shared/ExtensionPoints/ExtensionPointManager.swift @@ -38,7 +38,7 @@ final class ExtensionPointManager: FeedProviderManagerDelegate { let activeExtensionPointTypes = activeExtensionPoints.keys.compactMap({ ObjectIdentifier($0.extensionPointType) }) var available = [ExtensionPoint.Type]() for possibleExtensionPointType in possibleExtensionPointTypes { - if (AppDefaults.shared.isDeveloperBuild && possibleExtensionPointType.isDeveloperBuildRestricted) { + if !(AppDefaults.shared.isDeveloperBuild && possibleExtensionPointType.isDeveloperBuildRestricted) { if possibleExtensionPointType.isSinglton { if !activeExtensionPointTypes.contains(ObjectIdentifier(possibleExtensionPointType)) { available.append(possibleExtensionPointType) diff --git a/iOS/Settings/Views/Account and Extensions/AccountsManagementView.swift b/iOS/Settings/Views/Account and Extensions/AccountsManagementView.swift index 934d10105..190e79f19 100644 --- a/iOS/Settings/Views/Account and Extensions/AccountsManagementView.swift +++ b/iOS/Settings/Views/Account and Extensions/AccountsManagementView.swift @@ -82,7 +82,8 @@ struct AccountsManagementView: View { .sheet(isPresented: $showAddAccountSheet) { AddAccountListView() } - .alert("Remove “\(accountToRemove?.nameForDisplay ?? "")”?", isPresented: $showRemoveAccountAlert) { + .alert("Remove “\(accountToRemove?.nameForDisplay ?? "")”?", + isPresented: $showRemoveAccountAlert) { Button(role: .destructive) { AccountManager.shared.deleteAccount(accountToRemove!) } label: { @@ -94,7 +95,20 @@ struct AccountsManagementView: View { } label: { Text("Cancel") } + } message: { + switch accountToRemove { + case .none: + Text("") + case .some(let wrapped): + switch wrapped.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.") + default: + Text("Are you sure you want to remove this account? This cannot be undone.") + } + } } + } func refreshAccounts() { @@ -112,7 +126,7 @@ struct AccountsManagementView: View { .frame(width: 25, height: 25) Text(account.nameForDisplay) }.swipeActions(edge: .trailing, allowsFullSwipe: false) { - if account.type != .onMyMac { + if account != AccountManager.shared.defaultAccount { Button(role: .destructive) { accountToRemove.wrappedValue = account showRemoveAccountAlert.wrappedValue = true