diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt index 57d5afb..4318d3e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt @@ -64,8 +64,14 @@ class MainActivity : ComponentActivity() { setContent { AppThemeSurface { val showMoreApps = onEventValue { !resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations) } - val sosPermissionLauncher = getCameraPermissionLauncher(onResult = getPermissionResultHandler(true)) - val stroboscopePermissionLauncher = getCameraPermissionLauncher(onResult = getPermissionResultHandler(false)) + val sosPermissionLauncher = rememberLauncherForActivityResult( + contract = ActivityResultContracts.RequestPermission(), + onResult = getPermissionResultHandler(true) + ) + val stroboscopePermissionLauncher = rememberLauncherForActivityResult( + contract = ActivityResultContracts.RequestPermission(), + onResult = getPermissionResultHandler(false) + ) val sleepTimerCustomDialogState = getSleepTimerCustomDialogState() val sleepTimerDialogState = getSleepTimerDialogState(showCustomSleepTimerDialog = sleepTimerCustomDialogState::show) @@ -235,14 +241,6 @@ class MainActivity : ComponentActivity() { } } - @Composable - private fun getCameraPermissionLauncher( - onResult: (Boolean) -> Unit - ) = rememberLauncherForActivityResult( - contract = ActivityResultContracts.RequestPermission(), - onResult = onResult - ) - @Composable private fun getSleepTimerCustomDialogState() = rememberAlertDialogState().apply { DialogMember {