Skip to content

Commit

Permalink
removed unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-masson committed Mar 27, 2024
1 parent b672329 commit 9a0cd85
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions app/src/main/java/com/bnyro/clock/util/ScreenControlHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,15 @@ import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.platform.LocalView

object ScreenControlHelper {

private var currentState = false

// https://stackoverflow.com/a/71293123/9652621
@Composable
fun KeepScreenOn() {
if (!currentState) {
val currentView = LocalView.current
DisposableEffect(Unit) {
currentView.keepScreenOn = true
currentState = true
onDispose {
currentView.keepScreenOn = false
currentState = false
}
val currentView = LocalView.current
DisposableEffect(Unit) {
currentView.keepScreenOn = true

onDispose {
currentView.keepScreenOn = false
}
}
}
Expand Down

0 comments on commit 9a0cd85

Please sign in to comment.