ios: group preference to prohibit files and media (#2611)

* ios: group preference to prohibit files and media

* style
This commit is contained in:
Evgeny Poberezkin
2023-06-27 07:55:33 +01:00
committed by GitHub
parent 77b3870654
commit 3e370a7c16
3 changed files with 43 additions and 7 deletions

View File

@@ -264,7 +264,7 @@ struct ComposeView: View {
default: previewView()
}
HStack (alignment: .bottom) {
Button {
let b = Button {
showChooseSource = true
} label: {
Image(systemName: "paperclip")
@@ -274,6 +274,17 @@ struct ComposeView: View {
.frame(width: 25, height: 25)
.padding(.bottom, 12)
.padding(.leading, 12)
if case let .group(g) = chat.chatInfo,
!g.fullGroupPreferences.files.on {
b.disabled(true).onTapGesture {
AlertManager.shared.showAlertMsg(
title: "Files and media prohibited!",
message: "Only group owners can enable files and media."
)
}
} else {
b
}
ZStack(alignment: .leading) {
SendMessageView(
composeState: $composeState,

View File

@@ -27,6 +27,8 @@ struct GroupPreferencesView: View {
featureSection(.directMessages, $preferences.directMessages.enable)
featureSection(.reactions, $preferences.reactions.enable)
featureSection(.voice, $preferences.voice.enable)
// TODO uncomment in 5.3
// featureSection(.files, $preferences.files.enable)
if groupInfo.canEdit {
Section {