From 57323e62759772bb36d14cf2a4a9bcbb7a40e98b Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Sun, 10 Dec 2023 00:25:10 +0100 Subject: [PATCH] Improve coil initialization --- .../src/commonMain/kotlin/TonbrettApp.kt | 22 ++++++------------- build.gradle.kts | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/shared/src/commonMain/kotlin/TonbrettApp.kt b/app/shared/src/commonMain/kotlin/TonbrettApp.kt index 07fd332..ac9aa93 100644 --- a/app/shared/src/commonMain/kotlin/TonbrettApp.kt +++ b/app/shared/src/commonMain/kotlin/TonbrettApp.kt @@ -1,12 +1,7 @@ package dev.schlaubi.tonbrett.app import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.material.Icon import androidx.compose.material.SnackbarHost import androidx.compose.material.icons.Icons @@ -16,13 +11,7 @@ import androidx.compose.material3.Button import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Scaffold import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue +import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.intl.Locale @@ -36,7 +25,7 @@ import dev.schlaubi.tonbrett.app.components.ErrorText import dev.schlaubi.tonbrett.app.components.SoundList import dev.schlaubi.tonbrett.client.ReauthorizationRequiredException import dev.schlaubi.tonbrett.common.User -import io.ktor.client.plugins.ClientRequestException +import io.ktor.client.plugins.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import mu.KotlinLogging @@ -83,7 +72,10 @@ fun TonbrettApp(sessionExpiredState: MutableState = remember { mutableS } } - SingletonImageLoader.set(newImageLoader(LocalContext.current)) + SideEffect { + SingletonImageLoader.set { newImageLoader(context) } + } + ProvideStrings(lyricist) { val user = initialUser if (!crashed && !sessionExpired && user != null) { diff --git a/build.gradle.kts b/build.gradle.kts index fce6458..930af38 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { allprojects { group = "dev.schlaubi.tonbrett" - version = "1.18.0" + version = "1.18.1" repositories { mavenCentral()