Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
Fix launch crash: the lossless switch is read before the host's lazy prefs exist
kota-zo2e0df6ee47e7
diff --git a/base/host-android/src/main/kotlin/app/myspoti/host/android/WebPlayerHost.kt b/base/host-android/src/main/kotlin/app/myspoti/host/android/WebPlayerHost.ktindex 9c18193b..09aed183 100644--- a/base/host-android/src/main/kotlin/app/myspoti/host/android/WebPlayerHost.kt+++ b/base/host-android/src/main/kotlin/app/myspoti/host/android/WebPlayerHost.kt@@ -277,7 +277,9 @@ class WebPlayerHost(private val context: Context) : BridgeHost {it.install()}// Spotify lossless, when chosen: declared before the page's first script (see setLossless).- losslessScript = if (roots.getBoolean(LOSSLESS_KEY, false)) declareLossless(this) else null+ // Read here, not through [roots]: the first view is made while the host is being built,+ // before that lazy property below is set (dev 3138 crashed at launch on it).+ losslessScript = if (context.getSharedPreferences("web_player", Context.MODE_PRIVATE).getBoolean(LOSSLESS_KEY, false)) declareLossless(this) else nullval webView = thiscookies().apply {setAcceptCookie(true)