diff --git a/UIViews/src/main/java/com/programmersbox/uiviews/utils/ComposableUtils.kt b/UIViews/src/main/java/com/programmersbox/uiviews/utils/ComposableUtils.kt index ea42a1a62..57644eeb4 100644 --- a/UIViews/src/main/java/com/programmersbox/uiviews/utils/ComposableUtils.kt +++ b/UIViews/src/main/java/com/programmersbox/uiviews/utils/ComposableUtils.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.Build +import android.view.WindowManager import androidx.activity.compose.ManagedActivityResultLauncher import androidx.activity.result.ActivityResult import androidx.appcompat.app.AppCompatDelegate @@ -594,6 +595,18 @@ fun hapticInteractionSource( return interactionSource } +@Composable +fun KeepScreenOn() { + val context = LocalContext.current + DisposableEffect(Unit) { + val window = context.findActivity().window + window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + onDispose { + window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + } + } +} + /* // Need `implementation("com.mutualmobile:composesensors:1.1.2")` to make this work @Composable diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 567e7e925..5eb94b633 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ jetpackCompiler = "1.5.11" jetbrainsCompiler = "1.5.1" accompanist = "0.36.0" okhttpVersion = "4.12.0" -ktorVersion = "3.0.0-rc-1" +ktorVersion = "3.0.0" workVersion = "2.10.0-beta01" ziplineVersion = "1.1.0" landscapist = "2.4.0"