Релиз 1.3.5: ForegroundService звонков и фиксы клавиатуры
All checks were successful
Android Kernel Build / build (push) Successful in 19m26s

This commit is contained in:
2026-03-28 17:24:08 +05:00
parent 46b1b3a6f1
commit fa1288479f
6 changed files with 397 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.view.WindowManager
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
@@ -600,6 +601,9 @@ fun MainScreen(
var pendingOutgoingCall by remember { mutableStateOf<SearchUser?>(null) }
var pendingIncomingAccept by remember { mutableStateOf(false) }
var callPermissionsRequestedOnce by remember { mutableStateOf(false) }
val isCallScreenVisible =
callUiState.isVisible &&
(isCallOverlayExpanded || callUiState.phase == CallPhase.INCOMING)
val mandatoryCallPermissions = remember {
listOf(Manifest.permission.RECORD_AUDIO)
@@ -774,19 +778,39 @@ fun MainScreen(
}
}
LaunchedEffect(callUiState.isVisible) {
if (callUiState.isVisible) {
focusManager.clearFocus(force = true)
val forceHideCallKeyboard: () -> Unit = {
focusManager.clearFocus(force = true)
rootView.findFocus()?.clearFocus()
rootView.clearFocus()
val activity = rootView.context as? android.app.Activity
activity?.window?.let { window ->
WindowCompat.getInsetsController(window, rootView)
.hide(WindowInsetsCompat.Type.ime())
}
}
// Fallback for cases where IME survives focus reset due to window transitions.
val activity = rootView.context as? android.app.Activity
activity?.window?.let { window ->
WindowCompat.getInsetsController(window, rootView)
?.hide(WindowInsetsCompat.Type.ime())
DisposableEffect(isCallScreenVisible) {
val activity = rootView.context as? android.app.Activity
val previousSoftInputMode = activity?.window?.attributes?.softInputMode
if (isCallScreenVisible) {
forceHideCallKeyboard()
activity?.window?.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
)
}
onDispose {
if (isCallScreenVisible && previousSoftInputMode != null) {
activity.window.setSoftInputMode(previousSoftInputMode)
}
}
}
if (isCallScreenVisible) {
SideEffect {
forceHideCallKeyboard()
}
}
// Telegram-style behavior: while call screen is open, Back should minimize call to top banner.
BackHandler(
enabled = callUiState.isVisible &&