1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 06:10:32 +05:30

Fix remove instance/account button on macOS

This commit is contained in:
Arkadiusz Fal 2022-08-17 00:34:59 +02:00
parent 5c559928b9
commit 89839baddf

View File

@ -9,9 +9,6 @@ struct InstancesSettings: View {
@State private var presentingInstanceForm = false
@State private var savedFormInstanceID: Instance.ID?
@State private var presentingAccountRemovalConfirmation = false
@State private var presentingInstanceRemovalConfirmation = false
@State private var frontendURL = ""
@State private var proxiesVideos = false
@ -53,7 +50,18 @@ struct InstancesSettings: View {
Spacer()
Button("Remove") {
presentingAccountRemovalConfirmation = true
settings.presentAlert(
Alert(
title: Text(
"Are you sure you want to remove \(selectedAccount?.description ?? "") account?"
),
message: Text("This cannot be reverted"),
primaryButton: .destructive(Text("Remove")) {
AccountsModel.remove(selectedAccount!)
},
secondaryButton: .cancel()
)
)
}
.foregroundColor(colorScheme == .dark ? .white : .red)
.opacity(account == selectedAccount ? 1 : 0)
@ -61,18 +69,6 @@ struct InstancesSettings: View {
.tag(account)
}
}
.alert(isPresented: $presentingAccountRemovalConfirmation) {
Alert(
title: Text(
"Are you sure you want to remove \(selectedAccount?.description ?? "") account?"
),
message: Text("This cannot be undone"),
primaryButton: .destructive(Text("Remove")) {
AccountsModel.remove(selectedAccount!)
},
secondaryButton: .cancel()
)
}
if #available(macOS 12.0, *) {
list
@ -127,12 +123,11 @@ struct InstancesSettings: View {
Spacer()
Button("Remove Location") {
presentingInstanceRemovalConfirmation = true
settings.presentAlert(Alert(
title: Text(
"Are you sure you want to remove \(selectedInstance!.longDescription) location?"
),
message: Text("This cannot be undone"),
message: Text("This cannot be reverted"),
primaryButton: .destructive(Text("Remove")) {
if accounts.current?.instance == selectedInstance {
accounts.setCurrent(nil)