Skip to content

Commit

Permalink
Revert "Drop Block Contact button from MUC details view"
Browse files Browse the repository at this point in the history
This reverts commit f89b8c2.
  • Loading branch information
FriedrichAltheide committed Oct 16, 2023
1 parent cf93c7d commit dc54e57
Showing 1 changed file with 29 additions and 31 deletions.
60 changes: 29 additions & 31 deletions Monal/Classes/ContactDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit dc54e57

Please sign in to comment.