android: status bar color fix in non-oneHandUI (#4603)

This commit is contained in:
Stanislav Dmitrenko
2024-08-07 00:12:30 +09:00
committed by GitHub
parent 5a42c0c1d2
commit f6ee6338c4
2 changed files with 21 additions and 8 deletions
@@ -276,7 +276,9 @@ fun AndroidScreen(settingsState: SettingsViewState) {
snapshotFlow { ModalManager.center.modalCount.value > 0 }
.filter { chatModel.chatId.value == null }
.collect { modalBackground ->
if (modalBackground && !chatModel.newChatSheetVisible.value) {
if (chatModel.newChatSheetVisible.value) {
platform.androidSetStatusAndNavBarColors(CurrentColors.value.colors.isLight, CurrentColors.value.colors.background, false, appPrefs.oneHandUI.get())
} else if (modalBackground) {
platform.androidSetStatusAndNavBarColors(CurrentColors.value.colors.isLight, CurrentColors.value.colors.background, false, false)
} else {
platform.androidSetStatusAndNavBarColors(CurrentColors.value.colors.isLight, CurrentColors.value.colors.background, !appPrefs.oneHandUI.get(), appPrefs.oneHandUI.get())
@@ -47,13 +47,24 @@ private fun showNewChatSheet(oneHandUI: State<Boolean>) {
ModalManager.start.closeModals()
ModalManager.end.closeModals()
chatModel.newChatSheetVisible.value = true
ModalManager.start.showModalCloseable(
closeOnTop = !oneHandUI.value,
) { close ->
NewChatSheet(rh = chatModel.currentRemoteHost.value, close)
DisposableEffect(Unit) {
onDispose {
chatModel.newChatSheetVisible.value = false
ModalManager.start.showCustomModal { close ->
val close = {
// It will set it faster than in onDispose. It's important to catch the actual state before
// closing modal for reacting with status bar changes in [App]
chatModel.newChatSheetVisible.value = false
close()
}
ModalView(close, closeOnTop = !oneHandUI.value) {
if (appPlatform.isAndroid) {
BackHandler {
close()
}
}
NewChatSheet(rh = chatModel.currentRemoteHost.value, close)
DisposableEffect(Unit) {
onDispose {
chatModel.newChatSheetVisible.value = false
}
}
}
}