Update version
This commit is contained in:
@@ -7,6 +7,7 @@ struct AccountsView: View {
|
||||
@State private var showingAddAccount = false
|
||||
@State private var selectedAccount: Account?
|
||||
@State private var showingPaywall = false
|
||||
@State private var accountToDelete: Account?
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -33,6 +34,13 @@ struct AccountsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.swipeActions(edge: .trailing) {
|
||||
Button(role: .destructive) {
|
||||
accountToDelete = account
|
||||
} label: {
|
||||
Label("Delete", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
Text("Accounts")
|
||||
@@ -43,6 +51,25 @@ struct AccountsView: View {
|
||||
.scrollContentBackground(.hidden)
|
||||
}
|
||||
.navigationTitle("Accounts")
|
||||
.confirmationDialog(
|
||||
"Delete Account",
|
||||
isPresented: Binding(
|
||||
get: { accountToDelete != nil },
|
||||
set: { if !$0 { accountToDelete = nil } }
|
||||
),
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
Button("Delete", role: .destructive) {
|
||||
guard let accountToDelete else { return }
|
||||
if accountStore.selectedAccount?.id == accountToDelete.id {
|
||||
accountStore.selectAllAccounts()
|
||||
}
|
||||
accountRepository.deleteAccount(accountToDelete)
|
||||
self.accountToDelete = nil
|
||||
}
|
||||
} message: {
|
||||
Text("This will remove the account and unlink its sources.")
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button {
|
||||
|
||||
Reference in New Issue
Block a user