Improves UI for swipe to remove accounts

This commit is contained in:
Stuart Breckenridge
2022-12-13 09:43:34 +08:00
parent ad66d7072c
commit 00a148cd71
2 changed files with 17 additions and 3 deletions

View File

@@ -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)

View File

@@ -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