From dc54e57935364fea13f8f6f2f755e5f6e142441c Mon Sep 17 00:00:00 2001 From: Friedrich Altheide <11352905+FriedrichAltheide@users.noreply.github.com> Date: Mon, 16 Oct 2023 17:58:27 +0200 Subject: [PATCH] Revert "Drop `Block Contact` button from MUC details view" This reverts commit f89b8c2bdce353fa5b1b5f51b38ed8c2528d7aff. --- Monal/Classes/ContactDetails.swift | 60 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/Monal/Classes/ContactDetails.swift b/Monal/Classes/ContactDetails.swift index cb59cef99d..32c5177399 100644 --- a/Monal/Classes/ContactDetails.swift +++ b/Monal/Classes/ContactDetails.swift @@ -161,40 +161,38 @@ struct ContactDetails: View { Section { // the destructive section... if !contact.isSelfChat { - if !contact.isGroup { - Button(action: { - if(!contact.isBlocked) { - showingBlockContactConfirmation = true - } else { - showingCannotBlockAlert = !contact.obj.toggleBlocked(!contact.isBlocked) - } - }) { - if(!contact.isBlocked) { - Text("Block Contact") - .foregroundColor(.red) - } else { - Text("Unblock Contact") - } - } - .alert(isPresented: $showingCannotBlockAlert) { - Alert(title: Text("Blocking/Unblocking Not Supported"), message: Text("The server does not support blocking (XEP-0191)."), dismissButton: .default(Text("Close"))) + Button(action: { + if(!contact.isBlocked) { + showingBlockContactConfirmation = true + } else { + showingCannotBlockAlert = !contact.obj.toggleBlocked(!contact.isBlocked) } - .actionSheet(isPresented: $showingBlockContactConfirmation) { - ActionSheet( - title: Text("Block Contact"), - message: Text("Do you really want to block this contact? You won't receive any messages from this contact."), - buttons: [ - .cancel(), - .destructive( - Text("Yes"), - action: { - showingCannotBlockAlert = !contact.obj.toggleBlocked(!contact.isBlocked) - } - ) - ] - ) + }) { + if(!contact.isBlocked) { + Text("Block Contact") + .foregroundColor(.red) + } else { + Text("Unblock Contact") } } + .alert(isPresented: $showingCannotBlockAlert) { + Alert(title: Text("Blocking/Unblocking Not Supported"), message: Text("The server does not support blocking (XEP-0191)."), dismissButton: .default(Text("Close"))) + } + .actionSheet(isPresented: $showingBlockContactConfirmation) { + ActionSheet( + title: Text("Block Contact"), + message: Text("Do you really want to block this contact? You won't receive any messages from this contact."), + buttons: [ + .cancel(), + .destructive( + Text("Yes"), + action: { + showingCannotBlockAlert = !contact.obj.toggleBlocked(!contact.isBlocked) + } + ) + ] + ) + } Group { if(contact.isInRoster) {