From f1ff27218c0fd765d9e445e27c39418feba12502 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:43:18 +0400 Subject: [PATCH] ui: align call buttons with calls preference (#3740) --- apps/ios/Shared/Views/Chat/ChatView.swift | 5 +++-- .../kotlin/chat/simplex/common/views/chat/ChatView.kt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index af53e7e47..0915d6287 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -159,12 +159,13 @@ struct ChatView: View { switch cInfo { case let .direct(contact): HStack { - if contact.allowsFeature(.calls) { + let callsPrefEnabled = contact.mergedPreferences.calls.enabled.forUser + if callsPrefEnabled { callButton(contact, .audio, imageName: "phone") .disabled(!contact.ready || !contact.active) } Menu { - if contact.allowsFeature(.calls) { + if callsPrefEnabled { Button { CallController.shared.startCall(contact, .video) } label: { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt index 2e99d791b..c01344164 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt @@ -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) { barButtons.add { if (appPlatform.isAndroid) {