diff --git a/android/src/main/java/com/shabinder/android/App.kt b/android/src/main/java/com/shabinder/android/App.kt index 7e2722eb..9066b3fa 100644 --- a/android/src/main/java/com/shabinder/android/App.kt +++ b/android/src/main/java/com/shabinder/android/App.kt @@ -19,7 +19,7 @@ package com.shabinder.android import android.app.Application import com.shabinder.android.di.appModule import com.shabinder.common.database.appContext -import com.shabinder.common.initKoin +import com.shabinder.common.di.initKoin import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidLogger import org.koin.core.KoinComponent diff --git a/android/src/main/java/com/shabinder/android/MainActivity.kt b/android/src/main/java/com/shabinder/android/MainActivity.kt index e272b204..9228905f 100644 --- a/android/src/main/java/com/shabinder/android/MainActivity.kt +++ b/android/src/main/java/com/shabinder/android/MainActivity.kt @@ -7,8 +7,8 @@ import androidx.compose.ui.platform.setContent import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory -import com.shabinder.common.Dir -import com.shabinder.common.FetchPlatformQueryResult +import com.shabinder.common.di.Dir +import com.shabinder.common.di.FetchPlatformQueryResult import com.shabinder.common.root.SpotiFlyerRoot import com.shabinder.common.root.SpotiFlyerRootContent import com.shabinder.common.ui.SpotiFlyerTheme diff --git a/common/compose-ui/src/androidMain/kotlin/com/shabinder/common/ui/Actual.kt b/common/compose-ui/src/androidMain/kotlin/com/shabinder/common/ui/Actual.kt index 01f0f941..7cf4161a 100644 --- a/common/compose-ui/src/androidMain/kotlin/com/shabinder/common/ui/Actual.kt +++ b/common/compose-ui/src/androidMain/kotlin/com/shabinder/common/ui/Actual.kt @@ -1,23 +1,15 @@ package com.shabinder.common.ui import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.preferredHeight -import androidx.compose.foundation.layout.preferredWidth -import androidx.compose.material.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.unit.Dp -import androidx.core.net.toUri -import com.shabinder.common.Picture +import com.shabinder.common.di.Picture import com.shabinder.common.database.appContext -import dev.chrisbanes.accompanist.coil.CoilImage @Composable actual fun ImageLoad( diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerList.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerList.kt index bdb2023f..188dbf92 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerList.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerList.kt @@ -1,13 +1,15 @@ package com.shabinder.common.list -import androidx.compose.runtime.Composable import com.arkivanov.decompose.ComponentContext import com.arkivanov.mvikotlin.core.store.StoreFactory -import com.shabinder.common.* +import com.shabinder.common.di.Dir +import com.shabinder.common.di.FetchPlatformQueryResult +import com.shabinder.common.di.Picture import com.shabinder.common.list.integration.SpotiFlyerListImpl -import com.shabinder.common.spotify.Source +import com.shabinder.common.models.spotify.Source import com.shabinder.common.utils.Consumer -import com.shabinder.database.Database +import com.shabinder.common.models.PlatformQueryResult +import com.shabinder.common.models.TrackDetails import kotlinx.coroutines.flow.Flow interface SpotiFlyerList { @@ -21,7 +23,7 @@ interface SpotiFlyerList { /* * Download All Tracks(after filtering already Downloaded) * */ - fun onDownloadClicked(wholeTrackList:List,trackIndex:Int) + fun onDownloadClicked(wholeTrackList:List, trackIndex:Int) /* * To Pop and return back to Main Screen @@ -31,7 +33,7 @@ interface SpotiFlyerList { /* * Load Image from cache/Internet and cache it * */ - fun loadImage(url:String):Picture? + fun loadImage(url:String): Picture? interface Dependencies { val storeFactory: StoreFactory @@ -44,7 +46,7 @@ interface SpotiFlyerList { object Finished : Output() } data class State( - val queryResult:PlatformQueryResult? = PlatformQueryResult( + val queryResult: PlatformQueryResult? = PlatformQueryResult( "","", "Loading","", emptyList(), Source.Spotify), 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 ff5dc4d5..6d642a33 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 @@ -17,9 +17,9 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.shabinder.common.DownloadStatus -import com.shabinder.common.Picture -import com.shabinder.common.TrackDetails +import com.shabinder.common.models.DownloadStatus +import com.shabinder.common.di.Picture +import com.shabinder.common.models.TrackDetails import com.shabinder.common.ui.* import com.shabinder.common.ui.SpotiFlyerTypography import com.shabinder.common.ui.colorAccent @@ -64,10 +64,10 @@ fun SpotiFlyerListContent( fun TrackCard( track: TrackDetails, downloadTrack:()->Unit, - loadImage:(String)->Picture? + loadImage:(String)-> Picture? ) { Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) { - val pic:Picture? = loadImage(track.albumArtURL) + val pic: Picture? = loadImage(track.albumArtURL) ImageLoad( pic = pic, modifier = Modifier diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/integration/SpotiFlyerListImpl.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/integration/SpotiFlyerListImpl.kt index 4f01d885..07679870 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/integration/SpotiFlyerListImpl.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/integration/SpotiFlyerListImpl.kt @@ -2,8 +2,8 @@ package com.shabinder.common.list.integration import com.arkivanov.decompose.ComponentContext import com.arkivanov.mvikotlin.extensions.coroutines.states -import com.shabinder.common.Picture -import com.shabinder.common.TrackDetails +import com.shabinder.common.di.Picture +import com.shabinder.common.models.TrackDetails import com.shabinder.common.list.SpotiFlyerList import com.shabinder.common.list.SpotiFlyerList.Dependencies import com.shabinder.common.list.SpotiFlyerList.State diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStore.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStore.kt index a19c508d..703fbb4a 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStore.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStore.kt @@ -1,9 +1,7 @@ package com.shabinder.common.list.store import com.arkivanov.mvikotlin.core.store.Store -import com.shabinder.common.PlatformQueryResult -import com.shabinder.common.TrackDetails -import com.shabinder.common.list.SpotiFlyerList +import com.shabinder.common.models.TrackDetails import com.shabinder.common.list.SpotiFlyerList.State import com.shabinder.common.list.store.SpotiFlyerListStore.* diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStoreProvider.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStoreProvider.kt index 278a7af1..e79165d3 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStoreProvider.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStoreProvider.kt @@ -2,9 +2,13 @@ package com.shabinder.common.list.store import com.arkivanov.mvikotlin.core.store.* import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor -import com.shabinder.common.* +import com.shabinder.common.di.FetchPlatformQueryResult +import com.shabinder.common.di.downloadTracks import com.shabinder.common.list.SpotiFlyerList.State import com.shabinder.common.list.store.SpotiFlyerListStore.Intent +import com.shabinder.common.models.DownloadStatus +import com.shabinder.common.models.PlatformQueryResult +import com.shabinder.common.models.TrackDetails internal class SpotiFlyerListStoreProvider( private val storeFactory: StoreFactory, diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMain.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMain.kt index e8d3dfa4..2f71c396 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMain.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMain.kt @@ -2,9 +2,9 @@ package com.shabinder.common.main import com.arkivanov.decompose.ComponentContext import com.arkivanov.mvikotlin.core.store.StoreFactory -import com.shabinder.common.Dir -import com.shabinder.common.DownloadRecord -import com.shabinder.common.Picture +import com.shabinder.common.di.Dir +import com.shabinder.common.models.DownloadRecord +import com.shabinder.common.di.Picture import com.shabinder.common.main.integration.SpotiFlyerMainImpl import com.shabinder.common.utils.Consumer import com.shabinder.database.Database @@ -33,7 +33,7 @@ interface SpotiFlyerMain { /* * Load Image from cache/Internet and cache it * */ - fun loadImage(url:String):Picture? + fun loadImage(url:String): Picture? interface Dependencies { fun mainOutput(searched: Output): Consumer 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 e36dc719..12e2efab 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 @@ -25,10 +25,10 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.shabinder.common.DownloadRecord -import com.shabinder.common.Picture +import com.shabinder.common.models.DownloadRecord +import com.shabinder.common.di.Picture import com.shabinder.common.main.SpotiFlyerMain.HomeCategory -import com.shabinder.common.openPlatform +import com.shabinder.common.di.openPlatform import com.shabinder.common.ui.* import com.shabinder.common.ui.SpotiFlyerTypography @@ -120,7 +120,7 @@ fun SearchPanel( value = link, onValueChange = updateLink , leadingIcon = { - Icon(Icons.Rounded.AddLink,"Link Text Box",tint = Color(0xFFCCCCCC))//LightGray + Icon(Icons.Rounded.Edit,"Link Text Box",tint = Color(0xFFCCCCCC))//LightGray }, label = { Text(text = "Paste Link Here...",color = Color(0xFFCCCCCC)) }, singleLine = true, @@ -300,7 +300,7 @@ fun AboutColumn(modifier: Modifier = Modifier) { @Composable fun HistoryColumn( list: List, - loadImage:(String)->Picture?, + loadImage:(String)-> Picture?, onItemClicked: (String) -> Unit ) { LazyColumn( @@ -321,7 +321,7 @@ fun HistoryColumn( @Composable fun DownloadRecordItem( item: DownloadRecord, - loadImage:(String)->Picture?, + loadImage:(String)-> Picture?, onItemClicked:(String)->Unit ) { Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(end = 8.dp)) { diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/integration/SpotiFlyerMainImpl.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/integration/SpotiFlyerMainImpl.kt index 936c17a4..2e64634b 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/integration/SpotiFlyerMainImpl.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/integration/SpotiFlyerMainImpl.kt @@ -2,7 +2,7 @@ package com.shabinder.common.main.integration import com.arkivanov.decompose.ComponentContext import com.arkivanov.mvikotlin.extensions.coroutines.states -import com.shabinder.common.Picture +import com.shabinder.common.di.Picture import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.main.SpotiFlyerMain.* import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStore.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStore.kt index 71c257fb..9286b40e 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStore.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStore.kt @@ -1,7 +1,6 @@ package com.shabinder.common.main.store import com.arkivanov.mvikotlin.core.store.Store -import com.shabinder.common.DownloadRecord import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.main.store.SpotiFlyerMainStore.* diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStoreProvider.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStoreProvider.kt index f0895bb5..449a870e 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStoreProvider.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStoreProvider.kt @@ -5,13 +5,13 @@ import com.arkivanov.mvikotlin.core.store.SimpleBootstrapper import com.arkivanov.mvikotlin.core.store.Store import com.arkivanov.mvikotlin.core.store.StoreFactory import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor -import com.shabinder.common.DownloadRecord -import com.shabinder.common.giveDonation +import com.shabinder.common.models.DownloadRecord +import com.shabinder.common.di.giveDonation import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.main.SpotiFlyerMain.State import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent -import com.shabinder.common.openPlatform -import com.shabinder.common.shareApp +import com.shabinder.common.di.openPlatform +import com.shabinder.common.di.shareApp import com.shabinder.database.Database import com.squareup.sqldelight.runtime.coroutines.asFlow import com.squareup.sqldelight.runtime.coroutines.mapToList diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt index 162983ea..eb7ff17e 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt @@ -4,8 +4,8 @@ import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.RouterState import com.arkivanov.decompose.value.Value import com.arkivanov.mvikotlin.core.store.StoreFactory -import com.shabinder.common.Dir -import com.shabinder.common.FetchPlatformQueryResult +import com.shabinder.common.di.Dir +import com.shabinder.common.di.FetchPlatformQueryResult import com.shabinder.common.list.SpotiFlyerList import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.root.SpotiFlyerRoot.Dependencies diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt index ac61ddd8..83f4a321 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt @@ -8,7 +8,7 @@ import com.arkivanov.decompose.router import com.arkivanov.decompose.statekeeper.Parcelable import com.arkivanov.decompose.statekeeper.Parcelize import com.arkivanov.decompose.value.Value -import com.shabinder.common.Dir +import com.shabinder.common.di.Dir import com.shabinder.common.list.SpotiFlyerList import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.root.SpotiFlyerRoot diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Color.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Color.kt index 9c36213d..2b5033b6 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Color.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Color.kt @@ -16,15 +16,8 @@ package com.shabinder.common.ui -import androidx.compose.material.Colors import androidx.compose.material.darkColors -import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.colorspace.ColorSpaces -import androidx.compose.ui.graphics.colorspace.Illuminant -import androidx.compose.ui.graphics.colorspace.Rgb -import androidx.compose.ui.graphics.colorspace.TransferParameters -import androidx.compose.ui.graphics.compositeOver val colorPrimary = Color(0xFFFC5C7D) val colorPrimaryDark = Color(0xFFCE1CFF) diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Expect.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Expect.kt index d65086fd..499caa90 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Expect.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/Expect.kt @@ -2,7 +2,7 @@ package com.shabinder.common.ui import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.shabinder.common.Picture +import com.shabinder.common.di.Picture @Composable expect fun ImageLoad( diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/splash/Splash.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/splash/Splash.kt index eeae5a6a..4179a877 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/splash/Splash.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/splash/Splash.kt @@ -26,7 +26,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberUpdatedState import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.shabinder.common.ui.* diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/Colors.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/Colors.kt index c24382b0..d963f672 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/Colors.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/Colors.kt @@ -16,11 +16,6 @@ package com.shabinder.common.ui.utils -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.compositeOver -import androidx.compose.ui.graphics.luminance -import kotlin.math.max -import kotlin.math.min /* fun Color.contrastAgainst(background: Color): Float { diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/GradientScrim.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/GradientScrim.kt index 36c1c2d1..6fc1b444 100644 --- a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/GradientScrim.kt +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/utils/GradientScrim.kt @@ -16,17 +16,6 @@ package com.shabinder.common.ui.utils -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.composed -import androidx.compose.ui.draw.drawBehind -import androidx.compose.ui.graphics.Brush -import androidx.compose.ui.graphics.Color -import kotlin.math.pow - /** * Draws a vertical gradient scrim in the foreground. * diff --git a/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/Actual.kt b/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/Actual.kt index 9996c477..f85eef04 100644 --- a/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/Actual.kt +++ b/common/compose-ui/src/desktopMain/kotlin/com/shabinder/common/ui/Actual.kt @@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.res.vectorXmlResource -import com.shabinder.common.Picture +import com.shabinder.common.di.Picture import java.awt.image.BufferedImage import java.io.ByteArrayOutputStream import javax.imageio.ImageIO @@ -18,6 +18,7 @@ actual fun ImageLoad( if(pic == null) { Image( vectorXmlResource("common/compose-ui/src/main/res/drawable/music.xml"), + "", modifier ) } @@ -26,6 +27,7 @@ actual fun ImageLoad( org.jetbrains.skija.Image.makeFromEncoded( toByteArray(pic.image) ).asImageBitmap(), + "Image", modifier = modifier ) } diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadObject.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadObject.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadObject.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadObject.kt index a92e4bda..065a8681 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadObject.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadObject.kt @@ -14,9 +14,9 @@ * along with this program. If not, see . */ -package com.shabinder.common +package com.shabinder.common.models -import com.shabinder.common.spotify.Source +import com.shabinder.common.models.spotify.Source import kotlinx.serialization.Serializable @Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadRecord.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadRecord.kt similarity index 82% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadRecord.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadRecord.kt index e8fe50ff..6384d0ec 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadRecord.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadRecord.kt @@ -1,4 +1,4 @@ -package com.shabinder.common +package com.shabinder.common.models data class DownloadRecord( var id:Long = 0, diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadResult.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadResult.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadResult.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadResult.kt index 6a8f72d9..47218c17 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadResult.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadResult.kt @@ -1,4 +1,4 @@ -package com.shabinder.common +package com.shabinder.common.models sealed class DownloadResult { diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/Optional.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Optional.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/Optional.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Optional.kt index c56b1758..a8e960de 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/Optional.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Optional.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common +package com.shabinder.common.models import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/PlatformQueryResult.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/PlatformQueryResult.kt similarity index 91% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/PlatformQueryResult.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/PlatformQueryResult.kt index 5c6868b3..04c39366 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/PlatformQueryResult.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/PlatformQueryResult.kt @@ -14,9 +14,9 @@ * along with this program. If not, see . */ -package com.shabinder.common +package com.shabinder.common.models -import com.shabinder.common.spotify.Source +import com.shabinder.common.models.spotify.Source import kotlinx.serialization.Serializable @Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/YoutubeTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/YoutubeTrack.kt similarity index 96% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/YoutubeTrack.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/YoutubeTrack.kt index ca7dc59f..87ba0762 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/YoutubeTrack.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/YoutubeTrack.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common +package com.shabinder.common.models import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Artist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Artist.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Artist.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Artist.kt index e76857e6..964c1743 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Artist.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Artist.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/CustomArtworks.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/CustomArtworks.kt similarity index 96% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/CustomArtworks.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/CustomArtworks.kt index 9df6fdc2..f0abab16 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/CustomArtworks.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/CustomArtworks.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana import kotlinx.serialization.SerialName diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaAlbum.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaAlbum.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaAlbum.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaAlbum.kt index f7c76310..e14ed36e 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaAlbum.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaAlbum.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana data class GaanaAlbum ( val tracks : List, diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistDetails.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistDetails.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistDetails.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistDetails.kt index cf580679..a153675b 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistDetails.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistDetails.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana data class GaanaArtistDetails( val artist : List, diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistTracks.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistTracks.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistTracks.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistTracks.kt index 3dbe52b1..50e713bc 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistTracks.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistTracks.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana data class GaanaArtistTracks( val count : Int, diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaPlaylist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaPlaylist.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaPlaylist.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaPlaylist.kt index 735630aa..dc3bd2f5 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaPlaylist.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaPlaylist.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana data class GaanaPlaylist ( val modified_on : String, diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaSong.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaSong.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaSong.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaSong.kt index 449fb5c2..0801980a 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaSong.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaSong.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana data class GaanaSong( val tracks : List diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaTrack.kt similarity index 93% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaTrack.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaTrack.kt index acbdebf6..5ba91749 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaTrack.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaTrack.kt @@ -14,9 +14,9 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana -import com.shabinder.common.DownloadStatus +import com.shabinder.common.models.DownloadStatus import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Genre.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Genre.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Genre.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Genre.kt index 46d0c616..bc17dc04 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Genre.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Genre.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Tags.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Tags.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Tags.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Tags.kt index ab428255..bc550cbe 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Tags.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Tags.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.gaana +package com.shabinder.common.models.gaana import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Album.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Album.kt similarity index 97% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Album.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Album.kt index 63f3bde6..d8474cb5 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Album.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Album.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Artist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Artist.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Artist.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Artist.kt index 99401f29..70153fa5 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Artist.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Artist.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Copyright.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Copyright.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Copyright.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Copyright.kt index 7d9a1d3c..5e592beb 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Copyright.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Copyright.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Episodes.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Episodes.kt similarity index 96% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Episodes.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Episodes.kt index fa7cf2a0..7adb0384 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Episodes.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Episodes.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Followers.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Followers.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Followers.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Followers.kt index c9bf926d..312b9c33 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Followers.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Followers.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Image.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Image.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Image.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Image.kt index aedc3f36..5e5e5138 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Image.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Image.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/LinkedTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/LinkedTrack.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/LinkedTrack.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/LinkedTrack.kt index 9b581ab8..d73d5061 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/LinkedTrack.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/LinkedTrack.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectPlaylistTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectPlaylistTrack.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectPlaylistTrack.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectPlaylistTrack.kt index 29c7f11e..8715d028 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectPlaylistTrack.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectPlaylistTrack.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectTrack.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectTrack.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectTrack.kt index 84b50a4f..81cb29eb 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectTrack.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectTrack.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Playlist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Playlist.kt similarity index 96% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Playlist.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Playlist.kt index 69867bd1..95769656 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Playlist.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Playlist.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PlaylistTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PlaylistTrack.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PlaylistTrack.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PlaylistTrack.kt index bf14a6b5..d09cc7de 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PlaylistTrack.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PlaylistTrack.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Source.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Source.kt similarity index 94% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Source.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Source.kt index 73b8425e..2fed43c3 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Source.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Source.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify enum class Source { Spotify, diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/TokenData.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/TokenData.kt similarity index 95% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/TokenData.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/TokenData.kt index 19a0b25b..5ffee873 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/TokenData.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/TokenData.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Track.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Track.kt similarity index 93% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Track.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Track.kt index b9609f3e..72799110 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Track.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Track.kt @@ -14,9 +14,9 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify -import com.shabinder.common.DownloadStatus +import com.shabinder.common.models.DownloadStatus import kotlinx.serialization.Serializable @Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPrivate.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPrivate.kt similarity index 96% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPrivate.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPrivate.kt index b4b76a89..b2300fe1 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPrivate.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPrivate.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPublic.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPublic.kt similarity index 96% rename from common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPublic.kt rename to common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPublic.kt index e05cd92e..0321c41b 100644 --- a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPublic.kt +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPublic.kt @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.shabinder.common.spotify +package com.shabinder.common.models.spotify import kotlinx.serialization.Serializable diff --git a/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TokenDB.sq b/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TokenDB.sq index f7f00145..7af88657 100644 --- a/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TokenDB.sq +++ b/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TokenDB.sq @@ -1,5 +1,5 @@ CREATE TABLE Token ( - index INTEGER NOT NULL DEFAULT 0 PRIMARY KEY ON CONFLICT REPLACE, + tokenIndex INTEGER NOT NULL DEFAULT 0 PRIMARY KEY ON CONFLICT REPLACE, accessToken TEXT NOT NULL, expiry INTEGER NOT NULL ); @@ -11,7 +11,7 @@ VALUES (?,?); select: SELECT * FROM Token -WHERE index = 0; +WHERE tokenIndex = 0; clear: DELETE FROM Token; \ No newline at end of file diff --git a/common/dependency-injection/build.gradle.kts b/common/dependency-injection/build.gradle.kts index e9e55d14..87a54ffd 100644 --- a/common/dependency-injection/build.gradle.kts +++ b/common/dependency-injection/build.gradle.kts @@ -11,6 +11,7 @@ kotlin { implementation(project(":common:data-models")) implementation(project(":common:database")) implementation(project(":fuzzywuzzy:app")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1") implementation(Ktor.clientCore) diff --git a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Actual.kt b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Actual.kt deleted file mode 100644 index d51d85e8..00000000 --- a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Actual.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.shabinder.common - -import android.content.Context -import android.graphics.Bitmap -import android.os.Environment -import co.touchlab.kermit.Kermit -import com.shabinder.common.database.appContext -import java.io.* -import java.nio.charset.StandardCharsets - -actual fun openPlatform(platformID:String ,platformLink:String){ - //TODO -} - -actual fun shareApp(){ - //TODO -} - -actual fun giveDonation(){ - //TODO -} - -actual fun downloadTracks(list: List){ - //TODO -} \ No newline at end of file diff --git a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Actual.kt b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Actual.kt similarity index 60% rename from common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Actual.kt rename to common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Actual.kt index 3843d090..9bcaff1b 100644 --- a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Actual.kt +++ b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Actual.kt @@ -1,9 +1,6 @@ -package com.shabinder.common +package com.shabinder.common.di -import co.touchlab.kermit.Kermit -import java.io.* -import java.nio.charset.StandardCharsets -import javax.imageio.ImageIO +import com.shabinder.common.models.TrackDetails actual fun openPlatform(platformID:String ,platformLink:String){ //TODO diff --git a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Dir.kt b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Dir.kt similarity index 94% rename from common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Dir.kt rename to common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Dir.kt index 65bd506b..975ea03d 100644 --- a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Dir.kt +++ b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Dir.kt @@ -1,4 +1,4 @@ -package com.shabinder.common +package com.shabinder.common.di import android.content.Context import android.graphics.Bitmap @@ -6,6 +6,7 @@ import android.graphics.BitmapFactory import android.os.Environment import co.touchlab.kermit.Kermit import com.mpatric.mp3agic.Mp3File +import com.shabinder.common.models.TrackDetails import com.shabinder.common.database.appContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -95,7 +96,7 @@ actual class Dir actual constructor( .setId3v2TagsAndSaveFile(trackDetails,path) } - actual fun loadImage(url: String):Picture? { + actual fun loadImage(url: String): Picture? { val cachePath = imageCacheDir() + getNameURL(url) var picture: Picture? = loadCachedImage(cachePath) if (picture == null) picture = freshImage(url) @@ -120,7 +121,7 @@ actual class Dir actual constructor( val result: Bitmap? = BitmapFactory.decodeFile(cachePath) if (result != null) { - Picture( + com.shabinder.common.di.Picture( source, getNameURL(source), result, @@ -133,7 +134,7 @@ actual class Dir actual constructor( null } } - private fun freshImage(url:String):Picture?{ + private fun freshImage(url:String): Picture?{ return try { val source = URL(url) val connection: HttpURLConnection = source.openConnection() as HttpURLConnection @@ -144,7 +145,7 @@ actual class Dir actual constructor( val result: Bitmap? = BitmapFactory.decodeStream(input) if (result != null) { - val picture = Picture( + val picture = com.shabinder.common.di.Picture( url, getNameURL(url), result, diff --git a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/ID3Tagging.kt b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/ID3Tagging.kt similarity index 94% rename from common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/ID3Tagging.kt rename to common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/ID3Tagging.kt index bd5f7643..37950c03 100644 --- a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/ID3Tagging.kt +++ b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/ID3Tagging.kt @@ -1,11 +1,11 @@ -package com.shabinder.common +package com.shabinder.common.di import com.mpatric.mp3agic.ID3v1Tag import com.mpatric.mp3agic.ID3v24Tag import com.mpatric.mp3agic.Mp3File -import kotlinx.coroutines.GlobalScope +import com.shabinder.common.models.DownloadResult +import com.shabinder.common.models.TrackDetails import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.launch import java.io.File import java.io.FileInputStream @@ -32,7 +32,7 @@ fun Mp3File.setId3v1Tags(track: TrackDetails): Mp3File { } @Suppress("BlockingMethodInNonBlockingContext") -suspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails,filePath:String){ +suspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails, filePath:String){ val id3v2Tag = ID3v24Tag().apply { artist = track.artists.joinToString(",") title = track.title diff --git a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Picture.kt b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Picture.kt similarity index 86% rename from common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Picture.kt rename to common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Picture.kt index 7bfe7bc7..93ad4d38 100644 --- a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/Picture.kt +++ b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/Picture.kt @@ -1,4 +1,4 @@ -package com.shabinder.common +package com.shabinder.common.di import android.graphics.Bitmap diff --git a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/YoutubeProvider.kt b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt similarity index 96% rename from common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/YoutubeProvider.kt rename to common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt index 7ce7bba7..bb7e5293 100644 --- a/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/YoutubeProvider.kt +++ b/common/dependency-injection/src/androidMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt @@ -14,13 +14,15 @@ * along with this program. If not, see . */ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit import com.github.kiulian.downloader.YoutubeDownloader +import com.shabinder.common.models.DownloadStatus +import com.shabinder.common.models.PlatformQueryResult +import com.shabinder.common.models.TrackDetails import com.shabinder.common.database.DownloadRecordDatabaseQueries -import com.shabinder.common.spotify.Source -import com.shabinder.common.utils.removeIllegalChars +import com.shabinder.common.models.spotify.Source import com.shabinder.database.Database import io.ktor.client.* import kotlinx.coroutines.Dispatchers @@ -80,7 +82,7 @@ actual class YoutubeProvider actual constructor( private suspend fun getYTPlaylist( searchId: String - ):PlatformQueryResult?{ + ): PlatformQueryResult?{ val result = PlatformQueryResult( folderType = "", subFolder = "", @@ -155,7 +157,7 @@ actual class YoutubeProvider actual constructor( @Suppress("DefaultLocale") private suspend fun getYTTrack( searchId:String, - ):PlatformQueryResult? { + ): PlatformQueryResult? { val result = PlatformQueryResult( folderType = "", subFolder = "", diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DI.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/DI.kt similarity index 80% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DI.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/DI.kt index 9676ea8f..5b166847 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DI.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/DI.kt @@ -1,17 +1,18 @@ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit import com.shabinder.common.database.createDatabase import com.shabinder.common.database.getLogger -import com.shabinder.common.providers.GaanaProvider -import com.shabinder.common.providers.SpotifyProvider -import com.shabinder.common.providers.YoutubeMusic +import com.shabinder.common.di.providers.GaanaProvider +import com.shabinder.common.di.providers.SpotifyProvider +import com.shabinder.common.di.providers.YoutubeMusic import io.ktor.client.* import io.ktor.client.features.json.* import io.ktor.client.features.json.serializer.* import io.ktor.client.features.logging.* import io.ktor.client.request.* -import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch import kotlinx.serialization.json.Json import org.koin.core.context.startKoin import org.koin.dsl.KoinAppDeclaration @@ -40,17 +41,22 @@ val kotlinxSerializer = KotlinxSerializer( Json { isLenient = true ignoreUnknownKeys = true }) - +/* +* Refactor This +* */ fun isInternetAvailable(): Boolean { - return runBlocking { + var result = false + val job = GlobalScope.launch { try { ktorHttpClient.head("http://google.com") - true + result = true } catch (e: Exception) { println(e.message) - false + result = false } } + while (job.isActive){} + return result } fun createHttpClient(enableNetworkLogs: Boolean = false,serializer: KotlinxSerializer = kotlinxSerializer) = HttpClient { install(JsonFeature) { diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/Dir.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Dir.kt similarity index 87% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/Dir.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Dir.kt index c09f07f4..b9d1205c 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/Dir.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Dir.kt @@ -1,7 +1,8 @@ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit -import com.shabinder.common.utils.removeIllegalChars +import com.shabinder.common.models.DownloadResult +import com.shabinder.common.models.TrackDetails import io.ktor.client.request.* import io.ktor.client.statement.* import io.ktor.http.* @@ -18,7 +19,7 @@ expect class Dir( fun imageCacheDir(): String fun createDirectory(dirPath:String) suspend fun cacheImage(picture: Picture) - fun loadImage(url:String):Picture? + fun loadImage(url:String): Picture? suspend fun clearCache() suspend fun saveFileWithMetadata(mp3ByteArray: ByteArray, path: String, trackDetails: TrackDetails) } @@ -59,7 +60,7 @@ fun Dir.createDirectories() { createDirectory(defaultDir() + "Playlists/") createDirectory(defaultDir() + "YT_Downloads/") } -fun Dir.finalOutputDir(itemName:String ,type:String, subFolder:String,defaultDir:String,extension:String = ".mp3" ): String = +fun Dir.finalOutputDir(itemName:String, type:String, subFolder:String, defaultDir:String, extension:String = ".mp3" ): String = defaultDir + removeIllegalChars(type) + this.fileSeparator() + if(subFolder.isEmpty())"" else { removeIllegalChars(subFolder) + this.fileSeparator()} + removeIllegalChars(itemName) + extension diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/Expect.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Expect.kt similarity index 62% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/Expect.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Expect.kt index a2a5a616..32e955e9 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/Expect.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Expect.kt @@ -1,7 +1,6 @@ -package com.shabinder.common +package com.shabinder.common.di -import co.touchlab.kermit.Kermit -import com.shabinder.common.utils.removeIllegalChars +import com.shabinder.common.models.TrackDetails expect class Picture diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/FetchPlatformQueryResult.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/FetchPlatformQueryResult.kt similarity index 86% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/FetchPlatformQueryResult.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/FetchPlatformQueryResult.kt index 4ad22ec4..f7d07484 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/FetchPlatformQueryResult.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/FetchPlatformQueryResult.kt @@ -1,8 +1,9 @@ -package com.shabinder.common +package com.shabinder.common.di +import com.shabinder.common.models.PlatformQueryResult import com.shabinder.common.database.DownloadRecordDatabaseQueries -import com.shabinder.common.providers.GaanaProvider -import com.shabinder.common.providers.SpotifyProvider +import com.shabinder.common.di.providers.GaanaProvider +import com.shabinder.common.di.providers.SpotifyProvider import com.shabinder.database.Database import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/TokenStore.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/TokenStore.kt similarity index 78% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/TokenStore.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/TokenStore.kt index 570f0297..a02cee89 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/TokenStore.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/TokenStore.kt @@ -1,9 +1,9 @@ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit import com.shabinder.common.database.TokenDBQueries -import com.shabinder.common.spotify.TokenData -import com.shabinder.common.spotify.authenticateSpotify +import com.shabinder.common.models.spotify.TokenData +import com.shabinder.common.di.spotify.authenticateSpotify import com.shabinder.database.Database import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch @@ -21,8 +21,8 @@ class TokenStore( db.add(token.access_token!!, token.expiry!! + Clock.System.now().epochSeconds) } - suspend fun getToken(): TokenData{ - var token:TokenData? = db.select().executeAsOneOrNull()?.let { + suspend fun getToken(): TokenData { + var token: TokenData? = db.select().executeAsOneOrNull()?.let { TokenData(it.accessToken,null,it.expiry) } if(Clock.System.now().epochSeconds > token?.expiry ?:0 || token == null){ diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/utils/Utils.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Utils.kt similarity index 96% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/utils/Utils.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Utils.kt index 9379e6f5..a2773167 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/utils/Utils.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/Utils.kt @@ -1,4 +1,4 @@ -package com.shabinder.common.utils +package com.shabinder.common.di /** * Removing Illegal Chars from File Name diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/YoutubeProvider.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt similarity index 76% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/YoutubeProvider.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt index d31e4975..211355cf 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/YoutubeProvider.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt @@ -1,6 +1,7 @@ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit +import com.shabinder.common.models.PlatformQueryResult import com.shabinder.database.Database import io.ktor.client.* diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaRequests.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/gaana/GaanaRequests.kt similarity index 94% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaRequests.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/gaana/GaanaRequests.kt index e76791db..04263e04 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaRequests.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/gaana/GaanaRequests.kt @@ -1,5 +1,6 @@ -package com.shabinder.common.gaana +package com.shabinder.common.di.gaana +import com.shabinder.common.models.gaana.* import io.ktor.client.* import io.ktor.client.request.* @@ -21,7 +22,7 @@ interface GaanaRequests { seokey: String, format: String = "JSON", limit: Int = 2000 - ): GaanaPlaylist{ + ): GaanaPlaylist { return httpClient.get( "$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit" ) @@ -38,7 +39,7 @@ interface GaanaRequests { seokey: String, format: String = "JSON", limit: Int = 2000 - ): GaanaAlbum{ + ): GaanaAlbum { return httpClient.get( "$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit" ) @@ -54,7 +55,7 @@ interface GaanaRequests { subtype: String = "song_detail", seokey: String, format: String = "JSON", - ): GaanaSong{ + ): GaanaSong { return httpClient.get( "$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format" ) @@ -70,7 +71,7 @@ interface GaanaRequests { subtype: String = "artist_details_info", seokey: String, format: String = "JSON", - ): GaanaArtistDetails{ + ): GaanaArtistDetails { return httpClient.get( "$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format" ) @@ -86,7 +87,7 @@ interface GaanaRequests { seokey: String, format: String = "JSON", limit: Int = 50 - ): GaanaArtistTracks{ + ): GaanaArtistTracks { return httpClient.get( "$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit" ) diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/GaanaProvider.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/GaanaProvider.kt similarity index 91% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/GaanaProvider.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/GaanaProvider.kt index 27045ad5..6ec29d3a 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/GaanaProvider.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/GaanaProvider.kt @@ -14,14 +14,18 @@ * along with this program. If not, see . */ -package com.shabinder.common.providers +package com.shabinder.common.di.providers import co.touchlab.kermit.Kermit -import com.shabinder.common.* import com.shabinder.common.database.DownloadRecordDatabaseQueries -import com.shabinder.common.gaana.GaanaRequests -import com.shabinder.common.gaana.GaanaTrack -import com.shabinder.common.spotify.Source +import com.shabinder.common.di.Dir +import com.shabinder.common.di.finalOutputDir +import com.shabinder.common.di.gaana.GaanaRequests +import com.shabinder.common.models.gaana.GaanaTrack +import com.shabinder.common.models.DownloadStatus +import com.shabinder.common.models.PlatformQueryResult +import com.shabinder.common.models.TrackDetails +import com.shabinder.common.models.spotify.Source import com.shabinder.database.Database import io.ktor.client.* import kotlinx.coroutines.Dispatchers @@ -81,7 +85,7 @@ class GaanaProvider( dir.defaultDir() ) )) {//Download Already Present!! - it.downloaded = DownloadStatus.Downloaded + it.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } trackList = listOf(it).toTrackDetailsList(folderType, subFolder) title = it.track_title @@ -111,7 +115,7 @@ class GaanaProvider( ) ) ) {//Download Already Present!! - track.downloaded = DownloadStatus.Downloaded + track.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } } trackList = it.tracks.toTrackDetailsList(folderType, subFolder) @@ -142,7 +146,7 @@ class GaanaProvider( ) ) ) {//Download Already Present!! - track.downloaded = DownloadStatus.Downloaded + track.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } } trackList = it.tracks.toTrackDetailsList(folderType, subFolder) @@ -181,7 +185,7 @@ class GaanaProvider( ) ) ) {//Download Already Present!! - track.downloaded = DownloadStatus.Downloaded + track.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } } trackList = it.tracks.toTrackDetailsList(folderType, subFolder) diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/SpotifyProvider.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/SpotifyProvider.kt similarity index 92% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/SpotifyProvider.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/SpotifyProvider.kt index fe147dc3..d327b634 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/SpotifyProvider.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/SpotifyProvider.kt @@ -14,12 +14,19 @@ * along with this program. If not, see . */ -package com.shabinder.common.providers +package com.shabinder.common.di.providers import co.touchlab.kermit.Kermit -import com.shabinder.common.* import com.shabinder.common.database.DownloadRecordDatabaseQueries -import com.shabinder.common.spotify.* +import com.shabinder.common.di.Dir +import com.shabinder.common.di.finalOutputDir +import com.shabinder.common.di.spotify.SpotifyRequests +import com.shabinder.common.models.PlatformQueryResult +import com.shabinder.common.models.TrackDetails +import com.shabinder.common.models.spotify.Album +import com.shabinder.common.models.spotify.Image +import com.shabinder.common.models.spotify.Source +import com.shabinder.common.models.spotify.Track import com.shabinder.database.Database import io.ktor.client.* import kotlinx.coroutines.Dispatchers @@ -30,7 +37,7 @@ class SpotifyProvider( private val database: Database, private val logger: Kermit, private val dir: Dir, -) :SpotifyRequests { +) : SpotifyRequests { private val db:DownloadRecordDatabaseQueries get() = database.downloadRecordDatabaseQueries @@ -90,7 +97,7 @@ class SpotifyProvider( ) ) ) {//Download Already Present!! - it.downloaded = DownloadStatus.Downloaded + it.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } trackList = listOf(it).toTrackDetailsList(folderType, subFolder) title = it.name.toString() @@ -122,7 +129,7 @@ class SpotifyProvider( ) ) ) {//Download Already Present!! - it.downloaded = DownloadStatus.Downloaded + it.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } it.album = Album( images = listOf( @@ -171,7 +178,7 @@ class SpotifyProvider( ) ) ) {//Download Already Present!! - it1.downloaded = DownloadStatus.Downloaded + it1.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded } tempTrackList.add(it1) } diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/YoutubeMusic.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/YoutubeMusic.kt similarity index 99% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/YoutubeMusic.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/YoutubeMusic.kt index d319d18c..8f4961b0 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/providers/YoutubeMusic.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/YoutubeMusic.kt @@ -1,7 +1,7 @@ -package com.shabinder.common.providers +package com.shabinder.common.di.providers import co.touchlab.kermit.Logger -import com.shabinder.common.YoutubeTrack +import com.shabinder.common.models.YoutubeTrack import com.willowtreeapps.fuzzywuzzy.diffutils.FuzzySearch import io.ktor.client.* import io.ktor.client.request.* diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/spotify/SpotifyAuth.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/spotify/SpotifyAuth.kt similarity index 86% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/spotify/SpotifyAuth.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/spotify/SpotifyAuth.kt index d15c0769..273569a8 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/spotify/SpotifyAuth.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/spotify/SpotifyAuth.kt @@ -1,11 +1,11 @@ -package com.shabinder.common.spotify +package com.shabinder.common.di.spotify -import com.shabinder.common.kotlinxSerializer +import com.shabinder.common.di.kotlinxSerializer +import com.shabinder.common.models.spotify.TokenData import io.ktor.client.* import io.ktor.client.features.auth.* import io.ktor.client.features.auth.providers.* import io.ktor.client.features.json.* -import io.ktor.client.features.json.serializer.* import io.ktor.client.request.* import io.ktor.client.request.forms.* import io.ktor.http.* diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/spotify/SpotifyRequests.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/spotify/SpotifyRequests.kt similarity index 59% rename from common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/spotify/SpotifyRequests.kt rename to common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/spotify/SpotifyRequests.kt index a4f89c08..7c078364 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/spotify/SpotifyRequests.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/spotify/SpotifyRequests.kt @@ -1,5 +1,9 @@ -package com.shabinder.common.spotify +package com.shabinder.common.di.spotify +import com.shabinder.common.models.spotify.Album +import com.shabinder.common.models.spotify.PagingObjectPlaylistTrack +import com.shabinder.common.models.spotify.Playlist +import com.shabinder.common.models.spotify.Track import io.ktor.client.* import io.ktor.client.request.* @@ -9,7 +13,7 @@ interface SpotifyRequests { val httpClient:HttpClient - suspend fun getPlaylist(playlistID: String):Playlist{ + suspend fun getPlaylist(playlistID: String): Playlist { return httpClient.get("$BASE_URL/playlists/$playlistID") } @@ -17,23 +21,23 @@ interface SpotifyRequests { playlistID: String?, offset: Int = 0, limit: Int = 100 - ):PagingObjectPlaylistTrack{ + ): PagingObjectPlaylistTrack { return httpClient.get("$BASE_URL/playlists/$playlistID/tracks?offset=$offset&limit=$limit") } - suspend fun getTrack(id: String?):Track{ + suspend fun getTrack(id: String?): Track { return httpClient.get("$BASE_URL/tracks/$id") } - suspend fun getEpisode(id: String?) :Track{ + suspend fun getEpisode(id: String?) : Track { return httpClient.get("$BASE_URL/episodes/$id") } - suspend fun getShow(id: String?): Track{ + suspend fun getShow(id: String?): Track { return httpClient.get("$BASE_URL/shows/$id") } - suspend fun getAlbum(id: String):Album{ + suspend fun getAlbum(id: String): Album { return httpClient.get("$BASE_URL/albums/$id") } diff --git a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Actual.kt b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Actual.kt new file mode 100644 index 00000000..9bcaff1b --- /dev/null +++ b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Actual.kt @@ -0,0 +1,19 @@ +package com.shabinder.common.di + +import com.shabinder.common.models.TrackDetails + +actual fun openPlatform(platformID:String ,platformLink:String){ + //TODO +} + +actual fun shareApp(){ + //TODO +} + +actual fun giveDonation(){ + //TODO +} + +actual fun downloadTracks(list: List){ + //TODO +} \ No newline at end of file diff --git a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Dir.kt b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Dir.kt similarity index 93% rename from common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Dir.kt rename to common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Dir.kt index 5bc65f61..de073c8c 100644 --- a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Dir.kt +++ b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Dir.kt @@ -1,13 +1,13 @@ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit import com.mpatric.mp3agic.Mp3File +import com.shabinder.common.models.TrackDetails import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import java.awt.image.BufferedImage import java.io.* -import java.lang.Exception import java.net.HttpURLConnection import java.net.URL import java.nio.charset.StandardCharsets @@ -85,7 +85,7 @@ actual class Dir actual constructor(private val logger: Kermit) { .setId3v2TagsAndSaveFile(trackDetails,path) } - actual fun loadImage(url: String):Picture? { + actual fun loadImage(url: String): Picture? { val cachePath = imageCacheDir() + getNameURL(url) var picture: Picture? = loadCachedImage(cachePath) if (picture == null) picture = freshImage(url,cachePath) @@ -110,7 +110,7 @@ actual class Dir actual constructor(private val logger: Kermit) { val result: BufferedImage? = ImageIO.read(File(cachePath)) if (result != null) { - Picture( + com.shabinder.common.di.Picture( source, getNameURL(source), result, @@ -123,7 +123,7 @@ actual class Dir actual constructor(private val logger: Kermit) { null } } - private fun freshImage(url:String,cachePath: String):Picture?{ + private fun freshImage(url:String,cachePath: String): Picture?{ return try { val source = URL(url) val connection: HttpURLConnection = source.openConnection() as HttpURLConnection @@ -134,7 +134,7 @@ actual class Dir actual constructor(private val logger: Kermit) { val result: BufferedImage? = ImageIO.read(input) if (result != null) { - val picture = Picture( + val picture = com.shabinder.common.di.Picture( url, getNameURL(url), result, diff --git a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/ID3Tagging.kt b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/ID3Tagging.kt similarity index 94% rename from common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/ID3Tagging.kt rename to common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/ID3Tagging.kt index 3699587d..46f484eb 100644 --- a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/ID3Tagging.kt +++ b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/ID3Tagging.kt @@ -1,11 +1,11 @@ -package com.shabinder.common +package com.shabinder.common.di import com.mpatric.mp3agic.ID3v1Tag import com.mpatric.mp3agic.ID3v24Tag import com.mpatric.mp3agic.Mp3File -import kotlinx.coroutines.GlobalScope +import com.shabinder.common.models.DownloadResult +import com.shabinder.common.models.TrackDetails import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.launch import java.io.File import java.io.FileInputStream @@ -33,7 +33,7 @@ fun Mp3File.setId3v1Tags(track: TrackDetails): Mp3File { } @Suppress("BlockingMethodInNonBlockingContext") -suspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails,filePath:String){ +suspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails, filePath:String){ val id3v2Tag = ID3v24Tag().apply { artist = track.artists.joinToString(",") title = track.title diff --git a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Picture.kt b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Picture.kt similarity index 87% rename from common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Picture.kt rename to common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Picture.kt index d34aa1cf..f9a3ccda 100644 --- a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/Picture.kt +++ b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/Picture.kt @@ -1,4 +1,4 @@ -package com.shabinder.common +package com.shabinder.common.di import java.awt.image.BufferedImage diff --git a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/YoutubeProvider.kt b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt similarity index 96% rename from common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/YoutubeProvider.kt rename to common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt index 9ca528c7..0614bf88 100644 --- a/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/YoutubeProvider.kt +++ b/common/dependency-injection/src/desktopMain/kotlin/com/shabinder/common/di/YoutubeProvider.kt @@ -14,13 +14,15 @@ * along with this program. If not, see . */ -package com.shabinder.common +package com.shabinder.common.di import co.touchlab.kermit.Kermit import com.github.kiulian.downloader.YoutubeDownloader +import com.shabinder.common.models.DownloadStatus +import com.shabinder.common.models.PlatformQueryResult +import com.shabinder.common.models.TrackDetails import com.shabinder.common.database.DownloadRecordDatabaseQueries -import com.shabinder.common.spotify.Source -import com.shabinder.common.utils.removeIllegalChars +import com.shabinder.common.models.spotify.Source import com.shabinder.database.Database import io.ktor.client.* import kotlinx.coroutines.Dispatchers @@ -81,7 +83,7 @@ actual class YoutubeProvider actual constructor( private suspend fun getYTPlaylist( searchId: String - ):PlatformQueryResult?{ + ): PlatformQueryResult?{ val result = PlatformQueryResult( folderType = "", subFolder = "", @@ -156,7 +158,7 @@ actual class YoutubeProvider actual constructor( @Suppress("DefaultLocale") private suspend fun getYTTrack( searchId:String, - ):PlatformQueryResult? { + ): PlatformQueryResult? { val result = PlatformQueryResult( folderType = "", subFolder = "", diff --git a/desktop/src/jvmMain/kotlin/main.kt b/desktop/src/jvmMain/kotlin/main.kt index 92a12cb3..50ecf53c 100644 --- a/desktop/src/jvmMain/kotlin/main.kt +++ b/desktop/src/jvmMain/kotlin/main.kt @@ -1,7 +1,7 @@ import androidx.compose.desktop.Window import androidx.compose.foundation.layout.Column import androidx.compose.material.Text -import com.shabinder.common.initKoin +import com.shabinder.common.di.initKoin private val koin = initKoin(enableNetworkLogs = true).koin