ui: align call buttons with calls preference (#3740)

This commit is contained in:
spaced4ndy 2024-01-24 13:43:18 +04:00 committed by GitHub
parent 8738cf332f
commit f1ff27218c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -159,12 +159,13 @@ struct ChatView: View {
switch cInfo { switch cInfo {
case let .direct(contact): case let .direct(contact):
HStack { HStack {
if contact.allowsFeature(.calls) { let callsPrefEnabled = contact.mergedPreferences.calls.enabled.forUser
if callsPrefEnabled {
callButton(contact, .audio, imageName: "phone") callButton(contact, .audio, imageName: "phone")
.disabled(!contact.ready || !contact.active) .disabled(!contact.ready || !contact.active)
} }
Menu { Menu {
if contact.allowsFeature(.calls) { if callsPrefEnabled {
Button { Button {
CallController.shared.startCall(contact, .video) CallController.shared.startCall(contact, .video)
} label: { } label: {

View File

@ -647,7 +647,7 @@ fun ChatInfoToolbar(
} }
} }
if (chat.chatInfo is ChatInfo.Direct && chat.chatInfo.contact.allowsFeature(ChatFeature.Calls)) { if (chat.chatInfo is ChatInfo.Direct && chat.chatInfo.contact.mergedPreferences.calls.enabled.forUser) {
if (activeCall == null) { if (activeCall == null) {
barButtons.add { barButtons.add {
if (appPlatform.isAndroid) { if (appPlatform.isAndroid) {