mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 21:52:28 +00:00
android: keep screen on while playing/recording media
This commit is contained in:
1 parent
4816150b99
commit
d291f006e9
8 files changed
+38
-7
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package chat.simplex.app
|
||||
|
||||
import android.app.Application
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import chat.simplex.common.platform.Log
|
||||
import androidx.lifecycle.*
|
||||
import androidx.work.*
|
||||
@@ -216,6 +218,17 @@ class SimplexApp: Application(), LifecycleEventObserver {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun AndroidKeepScreenOn() {
|
||||
val view = LocalView.current
|
||||
DisposableEffect(Unit) {
|
||||
view.keepScreenOn = true
|
||||
onDispose {
|
||||
view.keepScreenOn = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user