Yassine Abou
07/01/2024, 5:27 PMsaveToGallery
. This function is called from within a coroutine scope in the downloadImageFromUrl
function.Here is my code:
class ThematicaApplication : Application() {
override fun onCreate() {
super.onCreate()
PurchasesFactory.setApplication(this)
startKoin {
//androidLogger(if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)
androidLogger()
androidContext(this@ThematicaApplication)
modules(ModuleProvider.getModule())
}
}
}
actual fun downloadImageFromUrl(url: String): Flow<Boolean?> = flow {
val bitmap = withContext(Dispatchers.IO) {
getBitmapFromURL(url)
}
if (bitmap == null) {
emit(false)
} else {
emit(saveToGallery(bitmap, "image.png", context = ?????).first())
}
}
I'm not sure how to pass the context to the saveToGallery
function. Can anyone help me with this?