Don't use runBlocking if async init completed

Change-Id: I641187ce277f434c6fca49a11b3cfccd50ecf5da
pull/1190/head
Tomáš Mlynarič 5 months ago
parent 7c33946ce1
commit e853748cf7

@ -55,5 +55,8 @@ class ImageLoaderAsyncFactory @Inject constructor(
* Most likely this will be already initialized by the time we want to show an image on the screen.
*/
override fun newImageLoader() =
trace("NiaImageLoader.runBlocking") { runBlocking { asyncNewImageLoader.await() } }
trace("NiaImageLoader.runBlocking") {
if (asyncNewImageLoader.isCompleted) asyncNewImageLoader.getCompleted()
else runBlocking { asyncNewImageLoader.await() }
}
}

Loading…
Cancel
Save