From 0494cce77dd499d36a0cb133156571a51f89eff9 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Wed, 21 Sep 2022 11:52:28 +0100 Subject: [PATCH] ios: remove destructive role from swipe actions to avoid pre-emptive row deletion before confirmations (#1083) --- apps/ios/Shared/Views/ChatList/ChatListNavLink.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift b/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift index 668d3717f6..4e19412bda 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift @@ -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 {