ios: role-based preferences, SimpleX links preference (#4021)

* ios: role-based preferences, SimpleX links preference

* disable some options
This commit is contained in:
Evgeny Poberezkin 2024-04-12 11:29:58 +01:00 committed by GitHub
parent e10c63dc64
commit 182225a5b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 235 additions and 57 deletions

View file

@ -779,6 +779,24 @@ final class Chat: ObservableObject, Identifiable {
var viewId: String { get { "\(chatInfo.id) \(created.timeIntervalSince1970)" } }
func groupFeatureEnabled(_ feature: GroupFeature) -> Bool {
if case let .group(groupInfo) = self.chatInfo {
let p = groupInfo.fullGroupPreferences
return switch feature {
case .timedMessages: p.timedMessages.on
case .directMessages: p.directMessages.on(for: groupInfo.membership)
case .fullDelete: p.fullDelete.on
case .reactions: p.reactions.on
case .voice: p.voice.on(for: groupInfo.membership)
case .files: p.files.on(for: groupInfo.membership)
case .simplexLinks: p.simplexLinks.on(for: groupInfo.membership)
case .history: p.history.on
}
} else {
return true
}
}
public static var sampleData: Chat = Chat(chatInfo: ChatInfo.sampleData.direct, chatItems: [])
}