Skip to content

Commit

Permalink
inverted currentDisplayRefresh check for early exit
Browse files Browse the repository at this point in the history
  • Loading branch information
sirlag committed Jun 24, 2024
1 parent 6bd9353 commit 22b2cef
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,23 @@ fun DisplayRefreshHost(
var currentColor by remember { mutableStateOf<Color?>(null) }

LaunchedEffect(currentDisplayRefresh) {
if (currentDisplayRefresh) {
val refreshDurationHalf = refreshDuration.milliseconds / 2
currentColor = if (flashMode == ReaderPreferences.FlashColor.BLACK) {
Color.Black
} else {
Color.White
}
delay(refreshDurationHalf)
if (flashMode == ReaderPreferences.FlashColor.WHITE_BLACK) {
currentColor = Color.Black
}
delay(refreshDurationHalf)
if (!currentDisplayRefresh) {
currentColor = null
hostState.currentDisplayRefresh = false
return@LaunchedEffect
}

val refreshDurationHalf = refreshDuration.milliseconds / 2
currentColor = if (flashMode == ReaderPreferences.FlashColor.BLACK) {
Color.Black
} else {
Color.White
}
delay(refreshDurationHalf)
if (flashMode == ReaderPreferences.FlashColor.WHITE_BLACK) {
currentColor = Color.Black
}
delay(refreshDurationHalf)
hostState.currentDisplayRefresh = false
}

LaunchedEffect(flashInterval) {
Expand Down

0 comments on commit 22b2cef

Please sign in to comment.