diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/SendMsgView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/SendMsgView.kt index 942593cfa3..c6e40f9a41 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/SendMsgView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/SendMsgView.kt @@ -71,16 +71,19 @@ fun SendMsgView( when { showProgress -> ProgressIndicator() showVoiceButton -> when { - needToAllowVoiceToContact || !allowedVoiceByPrefs || !permissionsState.allPermissionsGranted -> { + needToAllowVoiceToContact || !allowedVoiceByPrefs -> { DisallowedVoiceButton { - when { - needToAllowVoiceToContact -> showNeedToAllowVoiceAlert(allowVoiceToContact) - !allowedVoiceByPrefs -> showDisabledVoiceAlert(isDirectChat) - else -> permissionsState.launchMultiplePermissionRequest() + if (needToAllowVoiceToContact) { + showNeedToAllowVoiceAlert(allowVoiceToContact) + } else { + showDisabledVoiceAlert(isDirectChat) } } } - else -> RecordVoiceView(recState) + !permissionsState.allPermissionsGranted -> + VoiceButtonWithoutPermission { permissionsState.launchMultiplePermissionRequest() } + else -> + RecordVoiceView(recState) } else -> { val icon = if (cs.editing) Icons.Filled.Check else Icons.Outlined.ArrowUpward @@ -248,6 +251,20 @@ private fun DisallowedVoiceButton(onClick: () -> Unit) { } } +@Composable +private fun VoiceButtonWithoutPermission(onClick: () -> Unit) { + IconButton(onClick, Modifier.size(36.dp)) { + Icon( + Icons.Filled.KeyboardVoice, + stringResource(R.string.icon_descr_record_voice_message), + tint = MaterialTheme.colors.primary, + modifier = Modifier + .size(36.dp) + .padding(4.dp) + ) + } +} + @Composable private fun LockToCurrentOrientationUntilDispose() { val context = LocalContext.current