diff --git a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt index d474922..181713f 100644 --- a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt +++ b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt @@ -49,16 +49,15 @@ internal actual val platformModule: Module = SMBJHandler } single { DriverFactory(context = get()).createDriver() } + single { + SMBJHandler + } + single { DriverFactory(context = get()).createDriver() } + single { + val context: Context = get() + SharedFileCache(context.cacheDir.path) + } } - single { - SMBJHandler - } - single { DriverFactory(context = get()).createDriver() } - single { - val context:Context = get() - SharedFileCache(context.cacheDir.path) - } -} @OptIn(KoinInternalApi::class) fun KoinApplication.androidContext(androidContext: Context): KoinApplication { diff --git a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageAndroid.kt b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageAndroid.kt index 7ac17a6..c3fa9a6 100644 --- a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageAndroid.kt +++ b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageAndroid.kt @@ -11,15 +11,17 @@ import coil3.fetch.FetchResult import coil3.fetch.ImageFetchResult actual open class SharedImage actual constructor(actual val byteArray: ByteArray) { - actual fun getFetchResult(size: Int): FetchResult? { val image: Image? = getAndroidBitmap(byteArray, size)?.asImage() - return if (image != null) ImageFetchResult( - image = image, - isSampled = true, - dataSource = DataSource.NETWORK, - ) - else null + return if (image != null) { + ImageFetchResult( + image = image, + isSampled = true, + dataSource = DataSource.NETWORK, + ) + } else { + null + } } private fun getCoilImage(size: Int): Image? = getAndroidBitmap(byteArray, size)?.asImage() diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/data/datasources/image/CachedImageDataSource.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/data/datasources/image/CachedImageDataSource.kt index 739a112..ddb6791 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/data/datasources/image/CachedImageDataSource.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/data/datasources/image/CachedImageDataSource.kt @@ -11,7 +11,6 @@ class CachedImageDataSource( private val cache: CacheInterface, private val logger: Logger, driver: SqlDriver, - private val logger: Logger, ) { private val database = PlaylistDatabase(driver) @@ -28,7 +27,7 @@ class CachedImageDataSource( } } - fun saveImage( + suspend fun saveImage( directory: NetworkDirectoryDetails, image: SharedImage, ) {