fix closing modal

This commit is contained in:
Avently
2025-01-11 00:37:53 +07:00
parent b7b4059225
commit 5d1d45d334
2 changed files with 3 additions and 1 deletions
@@ -152,7 +152,7 @@ fun ChatListView(chatModel: ChatModel, userPickerState: MutableStateFlow<Animate
if (appPlatform.isDesktop) {
KeyChangeEffect(chatModel.chatId.value) {
if (chatModel.chatId.value != null) {
if (chatModel.chatId.value != null && !ModalManager.end.isLastModalOpen(ModalViewId.GROUP_REPORTS)) {
ModalManager.end.closeModalsExceptFirst()
}
AudioPlayer.stop()
@@ -101,6 +101,8 @@ class ModalManager(private val placement: ModalPlacement? = null) {
fun hasModalOpen(id: ModalViewId): Boolean = modalViews.any { it.id == id }
fun isLastModalOpen(id: ModalViewId): Boolean = modalViews.lastOrNull()?.id == id
fun showModal(settings: Boolean = false, showClose: Boolean = true, id: ModalViewId? = null, endButtons: @Composable RowScope.() -> Unit = {}, content: @Composable ModalData.() -> Unit) {
showCustomModal(id = id) { close ->
ModalView(close, showClose = showClose, endButtons = endButtons, content = { content() })