From 24ab7c562d0dddd49939b88e981761667f103191 Mon Sep 17 00:00:00 2001 From: shabinder Date: Thu, 11 Feb 2021 02:18:53 +0530 Subject: [PATCH] Desktop Bug Fixes , Desktop Res Added --- common/compose-ui/build.gradle.kts | 4 ++-- .../kotlin/com/shabinder/common/list/SpotiFlyerListUi.kt | 9 ++++++--- .../kotlin/com/shabinder/common/main/SpotiFlyerMainUi.kt | 2 +- .../kotlin/com/shabinder/common/ui/DesktopImages.kt | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/common/compose-ui/build.gradle.kts b/common/compose-ui/build.gradle.kts index 4e543cbf..f4693654 100644 --- a/common/compose-ui/build.gradle.kts +++ b/common/compose-ui/build.gradle.kts @@ -23,10 +23,10 @@ kotlin { implementation(Decompose.extensionsCompose) //Coil-Image Loading - Versions.coilVersion.let{ + /*Versions.coilVersion.let{ implementation("dev.chrisbanes.accompanist:accompanist-coil:$it") implementation("dev.chrisbanes.accompanist:accompanist-insets:$it") - } + }*/ } } } diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerListUi.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerListUi.kt index 0eca9978..a3ac947a 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerListUi.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerListUi.kt @@ -22,6 +22,7 @@ import com.shabinder.common.ui.SpotiFlyerTypography import com.shabinder.common.ui.colorAccent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.channelFlow import kotlinx.coroutines.launch @Composable @@ -68,7 +69,7 @@ fun TrackCard( Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) { var pic by mutableStateOf(null) val scope = rememberCoroutineScope() - scope.launch(Dispatchers.Unconfined) { + LaunchedEffect((1..10).random()){ pic = loadImage(track.albumArtURL) } ImageLoad( @@ -128,8 +129,10 @@ fun CoverImage( horizontalAlignment = Alignment.CenterHorizontally ) { var pic by mutableStateOf(null) - scope.launch(Dispatchers.Unconfined) { - pic = loadImage(coverURL) + LaunchedEffect(true){ + scope.launch(dispatcherIO) { + pic = loadImage(coverURL) + } } ImageLoad( pic, diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMainUi.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMainUi.kt index 296532be..a4a8827e 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMainUi.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMainUi.kt @@ -328,7 +328,7 @@ fun DownloadRecordItem( Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(end = 8.dp)) { val scope = rememberCoroutineScope() var pic by mutableStateOf(null) - scope.launch(Dispatchers.Unconfined) { + scope.launch(dispatcherIO) { pic = loadImage(item.coverUrl) } ImageLoad( diff --git a/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/DesktopImages.kt b/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/DesktopImages.kt index e51cb119..4fac2d0b 100644 --- a/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/DesktopImages.kt +++ b/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/DesktopImages.kt @@ -43,7 +43,8 @@ actual fun PlaceHolderImage():ImageVector = vectorXmlResource("drawable/music @Composable -actual fun SpotiFlyerLogo():ImageVector = vectorXmlResource("drawable/ic_spotiflyer_logo.xml") +actual fun SpotiFlyerLogo():ImageVector = + vectorXmlResource("drawable/ic_spotiflyer_logo.xml") @Composable actual fun HeartIcon():ImageVector = vectorXmlResource("drawable/ic_heart.xml")