From 5345006995b1951915a46f53c8e14cfe86c9bb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=80=90=EF=BB=BF=EF=BC=AB=EF=BD=89=EF=BD=8B=EF=BD=8F?= =?UTF-8?q?=E3=80=91?= <53761278+BadKiko@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:01:47 +0300 Subject: [PATCH] [f]: fixed PermissionSheet non expandable after hide --- .../main/java/com/kiko/kige/ui/components/KigePicker.kt | 5 ++++- .../java/com/kiko/kige/ui/components/PermissionSheet.kt | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/kige/src/main/java/com/kiko/kige/ui/components/KigePicker.kt b/kige/src/main/java/com/kiko/kige/ui/components/KigePicker.kt index f39e519..bfb818f 100644 --- a/kige/src/main/java/com/kiko/kige/ui/components/KigePicker.kt +++ b/kige/src/main/java/com/kiko/kige/ui/components/KigePicker.kt @@ -40,7 +40,10 @@ fun KigePicker( onSelect ) } else { - PermissionSheet(rememberKigeState.rememberPermissionState) { + PermissionSheet( + { rememberKigeState.hide(coroutineScope) }, + rememberKigeState.rememberPermissionState + ) { CreateGallerySheet( coroutineScope, rememberKigeState.rememberGalleryState, diff --git a/kige/src/main/java/com/kiko/kige/ui/components/PermissionSheet.kt b/kige/src/main/java/com/kiko/kige/ui/components/PermissionSheet.kt index b8bdee7..276ec97 100644 --- a/kige/src/main/java/com/kiko/kige/ui/components/PermissionSheet.kt +++ b/kige/src/main/java/com/kiko/kige/ui/components/PermissionSheet.kt @@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp import com.google.accompanist.permissions.ExperimentalPermissionsApi import com.google.accompanist.permissions.isGranted import com.google.accompanist.permissions.rememberPermissionState +import com.kiko.kige.data.state.KigeState import com.kiko.kige.data.state.PermissionState import com.kiko.kige.data.utils.GalleryUtils import kotlinx.coroutines.launch @@ -28,6 +29,7 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class, ExperimentalPermissionsApi::class) @Composable internal fun PermissionSheet( + onHide: () -> Unit, rememberKigePermissionState: PermissionState, onGivenPermission: @Composable () -> Unit ) { @@ -47,7 +49,10 @@ internal fun PermissionSheet( if (rememberKigePermissionState.visibleState.value) { ModalBottomSheet( sheetState = rememberKigePermissionState.sheetState, - onDismissRequest = { rememberKigePermissionState.hide(coroutineScope) }) { + onDismissRequest = { + onHide() + rememberKigePermissionState.hide(coroutineScope) + }) { Column( modifier = Modifier.padding(16.dp), horizontalAlignment = Alignment.CenterHorizontally,