mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-24 10:32:46 +02:00
Feature/2897 restricted user
This commit is contained in:
committed by
Arnfried Griesert
parent
472dbded4e
commit
4b1ca0ff7f
@@ -51,6 +51,16 @@ struct DeveloperSettingsView: View {
|
||||
.alert(isPresented: $showAlert) {
|
||||
Alert(title: Text(NSLocalizedString("bwi_settings_developer", tableName: "Vector", comment: "")), message: Text(NSLocalizedString("bwi_settings_developer_show_matomo_privacy_notes_resetted", tableName: "Vector", comment: "")), dismissButton: .default(Text("Ok")))
|
||||
}
|
||||
Button(action: { _ = restrictUser(mxSession: session) }) {
|
||||
Text(NSLocalizedString("bwi_settings_developer_restrict_user", tableName: "Bwi", comment: ""))
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
Button(action: { _ = unrestrictUser(mxSession: session) }) {
|
||||
Text(NSLocalizedString("bwi_settings_developer_unrestrict_user", tableName: "Bwi", comment: ""))
|
||||
.foregroundColor(Color(ThemeService.shared().theme.tintColor))
|
||||
.font(.system(size: 17))
|
||||
}
|
||||
}
|
||||
.navigationTitle(NSLocalizedString("bwi_settings_developer", tableName: "Vector", comment: ""))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
@@ -82,3 +92,20 @@ fileprivate func resetMatomoInfoScreen() -> Bool {
|
||||
UserDefaults.standard.set(false, forKey: "bwi_matomo_info_screen_shown")
|
||||
return true
|
||||
}
|
||||
|
||||
fileprivate func restrictUser(mxSession: MXSession?) -> Bool {
|
||||
guard let mxSession = mxSession else {
|
||||
return false
|
||||
}
|
||||
AccountRestrictionService(mxSession: mxSession).updateRestriction(roomAccess: true, addressListAccess: true)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
fileprivate func unrestrictUser(mxSession: MXSession?) -> Bool {
|
||||
guard let mxSession = mxSession else {
|
||||
return false
|
||||
}
|
||||
AccountRestrictionService(mxSession: mxSession).updateRestriction(roomAccess: false, addressListAccess: false)
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user