From 7ff6ef09fefef6c815788bb2b72fb0c393b02564 Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Fri, 11 Oct 2024 22:54:15 +0700 Subject: [PATCH] android: hide mic icon when mic is disabled (#5025) --- .../chat/simplex/common/views/call/CallView.android.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt index b35f47e36e..3fc5620222 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt @@ -194,7 +194,11 @@ actual fun ActiveCallView() { updateActiveCall(call) { val sources = it.localMediaSources when (cmd.source) { - CallMediaSource.Mic -> it.copy(localMediaSources = sources.copy(mic = cmd.enable)) + CallMediaSource.Mic -> { + val am = androidAppContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager + am.isMicrophoneMute = !cmd.enable + it.copy(localMediaSources = sources.copy(mic = cmd.enable)) + } CallMediaSource.Camera -> it.copy(localMediaSources = sources.copy(camera = cmd.enable)) CallMediaSource.ScreenAudio -> it.copy(localMediaSources = sources.copy(screenAudio = cmd.enable)) CallMediaSource.ScreenVideo -> it.copy(localMediaSources = sources.copy(screenVideo = cmd.enable))