ios: remove destructive role from swipe actions to avoid pre-emptive row deletion before confirmations (#1083)

This commit is contained in:
Evgeny Poberezkin
2022-09-21 11:52:28 +01:00
committed by GitHub
parent 909a8aaf9c
commit 0494cce77d

View File

@@ -42,7 +42,7 @@ struct ChatListNavLink: View {
}
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
clearChatButton()
Button(role: .destructive) {
Button {
AlertManager.shared.showAlert(
contact.ready
? deleteContactAlert(chat.chatInfo)
@@ -51,6 +51,7 @@ struct ChatListNavLink: View {
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
}
.frame(height: 80)
@@ -147,11 +148,12 @@ struct ChatListNavLink: View {
}
@ViewBuilder private func deleteGroupChatButton(_ groupInfo: GroupInfo) -> some View {
Button(role: .destructive) {
Button {
AlertManager.shared.showAlert(deleteGroupAlert(groupInfo))
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
}
private func contactRequestNavLink(_ contactRequest: UserContactRequest) -> some View {
@@ -161,11 +163,12 @@ struct ChatListNavLink: View {
Task { await acceptContactRequest(contactRequest) }
} label: { Label("Accept", systemImage: chatModel.incognito ? "theatermasks" : "checkmark") }
.tint(chatModel.incognito ? .indigo : .accentColor)
Button(role: .destructive) {
Button {
AlertManager.shared.showAlert(rejectContactRequestAlert(contactRequest))
} label: {
Label("Reject", systemImage: "multiply")
}
.tint(.red)
}
.frame(height: 80)
.onTapGesture { showContactRequestDialog = true }
@@ -178,11 +181,12 @@ struct ChatListNavLink: View {
private func contactConnectionNavLink(_ contactConnection: PendingContactConnection) -> some View {
ContactConnectionView(contactConnection: contactConnection)
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
Button(role: .destructive) {
Button {
AlertManager.shared.showAlert(deleteContactConnectionAlert(contactConnection))
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
}
.frame(height: 80)
.onTapGesture {