diff --git a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt index 1cf314d..a394d91 100644 --- a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt +++ b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt @@ -9,7 +9,6 @@ import androidx.fragment.app.FragmentActivity import net.codinux.banking.persistence.AndroidContext import net.codinux.banking.ui.service.AuthenticationService import net.codinux.banking.ui.service.BiometricAuthenticationService -import net.codinux.banking.ui.service.ImageService class MainActivity : FragmentActivity() { @@ -22,7 +21,6 @@ class MainActivity : FragmentActivity() { AndroidContext.applicationContext = this.applicationContext - ImageService.context = this.applicationContext AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this) setContent { diff --git a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/service/ImageService.android.kt b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/service/ImageService.android.kt index f64030d..c8c6dfb 100644 --- a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/service/ImageService.android.kt +++ b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/service/ImageService.android.kt @@ -1,22 +1,16 @@ package net.codinux.banking.ui.service -import android.content.Context import android.graphics.BitmapFactory import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.asImageBitmap +import net.codinux.banking.persistence.AndroidContext import net.codinux.log.Log import java.io.File import java.net.URL import java.security.MessageDigest -object ImageService { - - lateinit var context: Context - -} - -private val cacheDir by lazy { File(ImageService.context.cacheDir, "imageCache").also { it.mkdirs() } } +private val cacheDir by lazy { File(AndroidContext.applicationContext.cacheDir, "imageCache").also { it.mkdirs() } } private val messageDigest = MessageDigest.getInstance("SHA-256")