diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-27 11:47:35 +0100 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-27 11:47:35 +0100 |
| commit | 101e8fbf1b277da74a3510435e28fd4bcaa6edae (patch) | |
| tree | 460c1a062d53badf8301d9429507db5470dc28f5 /packages/meshbay-android/app/src/main/kotlin | |
| parent | 89358ec1e8323d2ce11b4e10e84d0389e806b8dc (diff) | |
| download | meshbay-101e8fbf1b277da74a3510435e28fd4bcaa6edae.tar.gz | |
fix(android): keep the screen on while a video plays
The WebView has no Screen Wake Lock API, so the player's request did
nothing. The bridge now supplies navigator.wakeLock over a native
screen:keep-on channel (the WebView's keepScreenOn).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-android/app/src/main/kotlin')
| -rw-r--r-- | packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt | 1 | ||||
| -rw-r--r-- | packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/bridge/Channels.kt | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt index 75ac0156..e60535b9 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt @@ -134,6 +134,7 @@ class MainActivity : Activity() { channels = Channels(hub, onHubChanged = { runOnUiThread { reloadForHub() } }, hasCatalogue = { code -> hasAsset("ui/locales/$code.js") }, keys = keys, saves = saves, cast = cast, onPlayback = { on -> runOnUiThread { playing = on; keepAlive() } }, + onKeepScreenOn = { on -> runOnUiThread { web.keepScreenOn = on } }, push = PushChannels(this, PushState(getSharedPreferences(PushState.PREFS, Context.MODE_PRIVATE)), channelNames = { mapOf( Notifier.CHANNEL_CHAT to text.get("push.channel_chat", channels.locale), diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/bridge/Channels.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/bridge/Channels.kt index 19b0f3c2..1563810b 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/bridge/Channels.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/bridge/Channels.kt @@ -32,6 +32,7 @@ class Channels( private val saves: SaveSinks? = null, private val cast: CastChannels? = null, private val onPlayback: (Boolean) -> Unit = {}, + private val onKeepScreenOn: (Boolean) -> Unit = {}, private val push: PushChannels? = null, private val photos: PhotoChannels? = null, private val destinations: DestinationChannels? = null, @@ -48,6 +49,7 @@ class Channels( "ice:resolve-stun" -> resolveStun(args.optJSONArray(0) ?: JSONArray()) "ui:locale" -> setLocale(args.optString(0, "")) "playback:keep-alive" -> { onPlayback(args.optBoolean(0, false)); true } + "screen:keep-on" -> { onKeepScreenOn(args.optBoolean(0, false)); true } // Where downloads go, chosen once; a display name, never a URI. "folder:choose" -> saves().chooseFolder() |