mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 17:14:32 +01:00
App Builds!
This commit is contained in:
parent
77d6996f5d
commit
85a8dfec68
@ -19,7 +19,7 @@ package com.shabinder.android
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import com.shabinder.android.di.appModule
|
import com.shabinder.android.di.appModule
|
||||||
import com.shabinder.common.database.appContext
|
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.androidContext
|
||||||
import org.koin.android.ext.koin.androidLogger
|
import org.koin.android.ext.koin.androidLogger
|
||||||
import org.koin.core.KoinComponent
|
import org.koin.core.KoinComponent
|
||||||
|
@ -7,8 +7,8 @@ import androidx.compose.ui.platform.setContent
|
|||||||
import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent
|
import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent
|
||||||
import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory
|
import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory
|
||||||
import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
|
import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
|
||||||
import com.shabinder.common.Dir
|
import com.shabinder.common.di.Dir
|
||||||
import com.shabinder.common.FetchPlatformQueryResult
|
import com.shabinder.common.di.FetchPlatformQueryResult
|
||||||
import com.shabinder.common.root.SpotiFlyerRoot
|
import com.shabinder.common.root.SpotiFlyerRoot
|
||||||
import com.shabinder.common.root.SpotiFlyerRootContent
|
import com.shabinder.common.root.SpotiFlyerRootContent
|
||||||
import com.shabinder.common.ui.SpotiFlyerTheme
|
import com.shabinder.common.ui.SpotiFlyerTheme
|
||||||
|
@ -1,23 +1,15 @@
|
|||||||
package com.shabinder.common.ui
|
package com.shabinder.common.ui
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
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.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.graphics.ImageBitmap
|
import androidx.compose.ui.graphics.ImageBitmap
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.layout.ContentScale
|
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
import androidx.compose.ui.unit.Dp
|
import com.shabinder.common.di.Picture
|
||||||
import androidx.core.net.toUri
|
|
||||||
import com.shabinder.common.Picture
|
|
||||||
import com.shabinder.common.database.appContext
|
import com.shabinder.common.database.appContext
|
||||||
import dev.chrisbanes.accompanist.coil.CoilImage
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
actual fun ImageLoad(
|
actual fun ImageLoad(
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package com.shabinder.common.list
|
package com.shabinder.common.list
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import com.arkivanov.decompose.ComponentContext
|
import com.arkivanov.decompose.ComponentContext
|
||||||
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
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.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.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
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
interface SpotiFlyerList {
|
interface SpotiFlyerList {
|
||||||
|
@ -17,9 +17,9 @@ import androidx.compose.ui.text.style.TextAlign
|
|||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.shabinder.common.DownloadStatus
|
import com.shabinder.common.models.DownloadStatus
|
||||||
import com.shabinder.common.Picture
|
import com.shabinder.common.di.Picture
|
||||||
import com.shabinder.common.TrackDetails
|
import com.shabinder.common.models.TrackDetails
|
||||||
import com.shabinder.common.ui.*
|
import com.shabinder.common.ui.*
|
||||||
import com.shabinder.common.ui.SpotiFlyerTypography
|
import com.shabinder.common.ui.SpotiFlyerTypography
|
||||||
import com.shabinder.common.ui.colorAccent
|
import com.shabinder.common.ui.colorAccent
|
||||||
|
@ -2,8 +2,8 @@ package com.shabinder.common.list.integration
|
|||||||
|
|
||||||
import com.arkivanov.decompose.ComponentContext
|
import com.arkivanov.decompose.ComponentContext
|
||||||
import com.arkivanov.mvikotlin.extensions.coroutines.states
|
import com.arkivanov.mvikotlin.extensions.coroutines.states
|
||||||
import com.shabinder.common.Picture
|
import com.shabinder.common.di.Picture
|
||||||
import com.shabinder.common.TrackDetails
|
import com.shabinder.common.models.TrackDetails
|
||||||
import com.shabinder.common.list.SpotiFlyerList
|
import com.shabinder.common.list.SpotiFlyerList
|
||||||
import com.shabinder.common.list.SpotiFlyerList.Dependencies
|
import com.shabinder.common.list.SpotiFlyerList.Dependencies
|
||||||
import com.shabinder.common.list.SpotiFlyerList.State
|
import com.shabinder.common.list.SpotiFlyerList.State
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.shabinder.common.list.store
|
package com.shabinder.common.list.store
|
||||||
|
|
||||||
import com.arkivanov.mvikotlin.core.store.Store
|
import com.arkivanov.mvikotlin.core.store.Store
|
||||||
import com.shabinder.common.PlatformQueryResult
|
import com.shabinder.common.models.TrackDetails
|
||||||
import com.shabinder.common.TrackDetails
|
|
||||||
import com.shabinder.common.list.SpotiFlyerList
|
|
||||||
import com.shabinder.common.list.SpotiFlyerList.State
|
import com.shabinder.common.list.SpotiFlyerList.State
|
||||||
import com.shabinder.common.list.store.SpotiFlyerListStore.*
|
import com.shabinder.common.list.store.SpotiFlyerListStore.*
|
||||||
|
|
||||||
|
@ -2,9 +2,13 @@ package com.shabinder.common.list.store
|
|||||||
|
|
||||||
import com.arkivanov.mvikotlin.core.store.*
|
import com.arkivanov.mvikotlin.core.store.*
|
||||||
import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor
|
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.SpotiFlyerList.State
|
||||||
import com.shabinder.common.list.store.SpotiFlyerListStore.Intent
|
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(
|
internal class SpotiFlyerListStoreProvider(
|
||||||
private val storeFactory: StoreFactory,
|
private val storeFactory: StoreFactory,
|
||||||
|
@ -2,9 +2,9 @@ package com.shabinder.common.main
|
|||||||
|
|
||||||
import com.arkivanov.decompose.ComponentContext
|
import com.arkivanov.decompose.ComponentContext
|
||||||
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
||||||
import com.shabinder.common.Dir
|
import com.shabinder.common.di.Dir
|
||||||
import com.shabinder.common.DownloadRecord
|
import com.shabinder.common.models.DownloadRecord
|
||||||
import com.shabinder.common.Picture
|
import com.shabinder.common.di.Picture
|
||||||
import com.shabinder.common.main.integration.SpotiFlyerMainImpl
|
import com.shabinder.common.main.integration.SpotiFlyerMainImpl
|
||||||
import com.shabinder.common.utils.Consumer
|
import com.shabinder.common.utils.Consumer
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
|
@ -25,10 +25,10 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.shabinder.common.DownloadRecord
|
import com.shabinder.common.models.DownloadRecord
|
||||||
import com.shabinder.common.Picture
|
import com.shabinder.common.di.Picture
|
||||||
import com.shabinder.common.main.SpotiFlyerMain.HomeCategory
|
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.*
|
||||||
import com.shabinder.common.ui.SpotiFlyerTypography
|
import com.shabinder.common.ui.SpotiFlyerTypography
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ fun SearchPanel(
|
|||||||
value = link,
|
value = link,
|
||||||
onValueChange = updateLink ,
|
onValueChange = updateLink ,
|
||||||
leadingIcon = {
|
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)) },
|
label = { Text(text = "Paste Link Here...",color = Color(0xFFCCCCCC)) },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
|
@ -2,7 +2,7 @@ package com.shabinder.common.main.integration
|
|||||||
|
|
||||||
import com.arkivanov.decompose.ComponentContext
|
import com.arkivanov.decompose.ComponentContext
|
||||||
import com.arkivanov.mvikotlin.extensions.coroutines.states
|
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.SpotiFlyerMain.*
|
import com.shabinder.common.main.SpotiFlyerMain.*
|
||||||
import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent
|
import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.shabinder.common.main.store
|
package com.shabinder.common.main.store
|
||||||
|
|
||||||
import com.arkivanov.mvikotlin.core.store.Store
|
import com.arkivanov.mvikotlin.core.store.Store
|
||||||
import com.shabinder.common.DownloadRecord
|
|
||||||
import com.shabinder.common.main.SpotiFlyerMain
|
import com.shabinder.common.main.SpotiFlyerMain
|
||||||
import com.shabinder.common.main.store.SpotiFlyerMainStore.*
|
import com.shabinder.common.main.store.SpotiFlyerMainStore.*
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ import com.arkivanov.mvikotlin.core.store.SimpleBootstrapper
|
|||||||
import com.arkivanov.mvikotlin.core.store.Store
|
import com.arkivanov.mvikotlin.core.store.Store
|
||||||
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
||||||
import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor
|
import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor
|
||||||
import com.shabinder.common.DownloadRecord
|
import com.shabinder.common.models.DownloadRecord
|
||||||
import com.shabinder.common.giveDonation
|
import com.shabinder.common.di.giveDonation
|
||||||
import com.shabinder.common.main.SpotiFlyerMain
|
import com.shabinder.common.main.SpotiFlyerMain
|
||||||
import com.shabinder.common.main.SpotiFlyerMain.State
|
import com.shabinder.common.main.SpotiFlyerMain.State
|
||||||
import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent
|
import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent
|
||||||
import com.shabinder.common.openPlatform
|
import com.shabinder.common.di.openPlatform
|
||||||
import com.shabinder.common.shareApp
|
import com.shabinder.common.di.shareApp
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import com.squareup.sqldelight.runtime.coroutines.asFlow
|
import com.squareup.sqldelight.runtime.coroutines.asFlow
|
||||||
import com.squareup.sqldelight.runtime.coroutines.mapToList
|
import com.squareup.sqldelight.runtime.coroutines.mapToList
|
||||||
|
@ -4,8 +4,8 @@ import com.arkivanov.decompose.ComponentContext
|
|||||||
import com.arkivanov.decompose.RouterState
|
import com.arkivanov.decompose.RouterState
|
||||||
import com.arkivanov.decompose.value.Value
|
import com.arkivanov.decompose.value.Value
|
||||||
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
import com.arkivanov.mvikotlin.core.store.StoreFactory
|
||||||
import com.shabinder.common.Dir
|
import com.shabinder.common.di.Dir
|
||||||
import com.shabinder.common.FetchPlatformQueryResult
|
import com.shabinder.common.di.FetchPlatformQueryResult
|
||||||
import com.shabinder.common.list.SpotiFlyerList
|
import com.shabinder.common.list.SpotiFlyerList
|
||||||
import com.shabinder.common.main.SpotiFlyerMain
|
import com.shabinder.common.main.SpotiFlyerMain
|
||||||
import com.shabinder.common.root.SpotiFlyerRoot.Dependencies
|
import com.shabinder.common.root.SpotiFlyerRoot.Dependencies
|
||||||
|
@ -8,7 +8,7 @@ import com.arkivanov.decompose.router
|
|||||||
import com.arkivanov.decompose.statekeeper.Parcelable
|
import com.arkivanov.decompose.statekeeper.Parcelable
|
||||||
import com.arkivanov.decompose.statekeeper.Parcelize
|
import com.arkivanov.decompose.statekeeper.Parcelize
|
||||||
import com.arkivanov.decompose.value.Value
|
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.list.SpotiFlyerList
|
||||||
import com.shabinder.common.main.SpotiFlyerMain
|
import com.shabinder.common.main.SpotiFlyerMain
|
||||||
import com.shabinder.common.root.SpotiFlyerRoot
|
import com.shabinder.common.root.SpotiFlyerRoot
|
||||||
|
@ -16,15 +16,8 @@
|
|||||||
|
|
||||||
package com.shabinder.common.ui
|
package com.shabinder.common.ui
|
||||||
|
|
||||||
import androidx.compose.material.Colors
|
|
||||||
import androidx.compose.material.darkColors
|
import androidx.compose.material.darkColors
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.graphics.Color
|
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 colorPrimary = Color(0xFFFC5C7D)
|
||||||
val colorPrimaryDark = Color(0xFFCE1CFF)
|
val colorPrimaryDark = Color(0xFFCE1CFF)
|
||||||
|
@ -2,7 +2,7 @@ package com.shabinder.common.ui
|
|||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.shabinder.common.Picture
|
import com.shabinder.common.di.Picture
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
expect fun ImageLoad(
|
expect fun ImageLoad(
|
||||||
|
@ -26,7 +26,6 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.rememberUpdatedState
|
import androidx.compose.runtime.rememberUpdatedState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.shabinder.common.ui.*
|
import com.shabinder.common.ui.*
|
||||||
|
@ -16,11 +16,6 @@
|
|||||||
|
|
||||||
package com.shabinder.common.ui.utils
|
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 {
|
fun Color.contrastAgainst(background: Color): Float {
|
||||||
|
@ -16,17 +16,6 @@
|
|||||||
|
|
||||||
package com.shabinder.common.ui.utils
|
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.
|
* Draws a vertical gradient scrim in the foreground.
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.res.vectorXmlResource
|
import androidx.compose.ui.res.vectorXmlResource
|
||||||
import com.shabinder.common.Picture
|
import com.shabinder.common.di.Picture
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
@ -18,6 +18,7 @@ actual fun ImageLoad(
|
|||||||
if(pic == null) {
|
if(pic == null) {
|
||||||
Image(
|
Image(
|
||||||
vectorXmlResource("common/compose-ui/src/main/res/drawable/music.xml"),
|
vectorXmlResource("common/compose-ui/src/main/res/drawable/music.xml"),
|
||||||
|
"",
|
||||||
modifier
|
modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -26,6 +27,7 @@ actual fun ImageLoad(
|
|||||||
org.jetbrains.skija.Image.makeFromEncoded(
|
org.jetbrains.skija.Image.makeFromEncoded(
|
||||||
toByteArray(pic.image)
|
toByteArray(pic.image)
|
||||||
).asImageBitmap(),
|
).asImageBitmap(),
|
||||||
|
"Image",
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
@ -1,4 +1,4 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.models
|
||||||
|
|
||||||
data class DownloadRecord(
|
data class DownloadRecord(
|
||||||
var id:Long = 0,
|
var id:Long = 0,
|
@ -1,4 +1,4 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.models
|
||||||
|
|
||||||
sealed class DownloadResult {
|
sealed class DownloadResult {
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common
|
package com.shabinder.common.models
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,9 +14,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common
|
package com.shabinder.common.models
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
data class GaanaAlbum (
|
data class GaanaAlbum (
|
||||||
val tracks : List<GaanaTrack>,
|
val tracks : List<GaanaTrack>,
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
data class GaanaArtistDetails(
|
data class GaanaArtistDetails(
|
||||||
val artist : List<Artist>,
|
val artist : List<Artist>,
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
data class GaanaArtistTracks(
|
data class GaanaArtistTracks(
|
||||||
val count : Int,
|
val count : Int,
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
data class GaanaPlaylist (
|
data class GaanaPlaylist (
|
||||||
val modified_on : String,
|
val modified_on : String,
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
data class GaanaSong(
|
data class GaanaSong(
|
||||||
val tracks : List<GaanaTrack>
|
val tracks : List<GaanaTrack>
|
@ -14,9 +14,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.gaana
|
package com.shabinder.common.models.gaana
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
enum class Source {
|
enum class Source {
|
||||||
Spotify,
|
Spotify,
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
@ -14,9 +14,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.spotify
|
package com.shabinder.common.models.spotify
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
CREATE TABLE Token (
|
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,
|
accessToken TEXT NOT NULL,
|
||||||
expiry INTEGER NOT NULL
|
expiry INTEGER NOT NULL
|
||||||
);
|
);
|
||||||
@ -11,7 +11,7 @@ VALUES (?,?);
|
|||||||
select:
|
select:
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM Token
|
FROM Token
|
||||||
WHERE index = 0;
|
WHERE tokenIndex = 0;
|
||||||
|
|
||||||
clear:
|
clear:
|
||||||
DELETE FROM Token;
|
DELETE FROM Token;
|
@ -11,6 +11,7 @@ kotlin {
|
|||||||
implementation(project(":common:data-models"))
|
implementation(project(":common:data-models"))
|
||||||
implementation(project(":common:database"))
|
implementation(project(":common:database"))
|
||||||
implementation(project(":fuzzywuzzy:app"))
|
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-serialization-json:1.0.1")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
|
||||||
implementation(Ktor.clientCore)
|
implementation(Ktor.clientCore)
|
||||||
|
@ -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<TrackDetails>){
|
|
||||||
//TODO
|
|
||||||
}
|
|
@ -1,9 +1,6 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import com.shabinder.common.models.TrackDetails
|
||||||
import java.io.*
|
|
||||||
import java.nio.charset.StandardCharsets
|
|
||||||
import javax.imageio.ImageIO
|
|
||||||
|
|
||||||
actual fun openPlatform(platformID:String ,platformLink:String){
|
actual fun openPlatform(platformID:String ,platformLink:String){
|
||||||
//TODO
|
//TODO
|
@ -1,4 +1,4 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
@ -6,6 +6,7 @@ import android.graphics.BitmapFactory
|
|||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.mpatric.mp3agic.Mp3File
|
import com.mpatric.mp3agic.Mp3File
|
||||||
|
import com.shabinder.common.models.TrackDetails
|
||||||
import com.shabinder.common.database.appContext
|
import com.shabinder.common.database.appContext
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -120,7 +121,7 @@ actual class Dir actual constructor(
|
|||||||
val result: Bitmap? = BitmapFactory.decodeFile(cachePath)
|
val result: Bitmap? = BitmapFactory.decodeFile(cachePath)
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
Picture(
|
com.shabinder.common.di.Picture(
|
||||||
source,
|
source,
|
||||||
getNameURL(source),
|
getNameURL(source),
|
||||||
result,
|
result,
|
||||||
@ -144,7 +145,7 @@ actual class Dir actual constructor(
|
|||||||
val result: Bitmap? = BitmapFactory.decodeStream(input)
|
val result: Bitmap? = BitmapFactory.decodeStream(input)
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
val picture = Picture(
|
val picture = com.shabinder.common.di.Picture(
|
||||||
url,
|
url,
|
||||||
getNameURL(url),
|
getNameURL(url),
|
||||||
result,
|
result,
|
@ -1,11 +1,11 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import com.mpatric.mp3agic.ID3v1Tag
|
import com.mpatric.mp3agic.ID3v1Tag
|
||||||
import com.mpatric.mp3agic.ID3v24Tag
|
import com.mpatric.mp3agic.ID3v24Tag
|
||||||
import com.mpatric.mp3agic.Mp3File
|
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.flow.collect
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
|
|
@ -14,13 +14,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.github.kiulian.downloader.YoutubeDownloader
|
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.database.DownloadRecordDatabaseQueries
|
||||||
import com.shabinder.common.spotify.Source
|
import com.shabinder.common.models.spotify.Source
|
||||||
import com.shabinder.common.utils.removeIllegalChars
|
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
@ -1,17 +1,18 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.shabinder.common.database.createDatabase
|
import com.shabinder.common.database.createDatabase
|
||||||
import com.shabinder.common.database.getLogger
|
import com.shabinder.common.database.getLogger
|
||||||
import com.shabinder.common.providers.GaanaProvider
|
import com.shabinder.common.di.providers.GaanaProvider
|
||||||
import com.shabinder.common.providers.SpotifyProvider
|
import com.shabinder.common.di.providers.SpotifyProvider
|
||||||
import com.shabinder.common.providers.YoutubeMusic
|
import com.shabinder.common.di.providers.YoutubeMusic
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import io.ktor.client.features.json.*
|
import io.ktor.client.features.json.*
|
||||||
import io.ktor.client.features.json.serializer.*
|
import io.ktor.client.features.json.serializer.*
|
||||||
import io.ktor.client.features.logging.*
|
import io.ktor.client.features.logging.*
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import org.koin.core.context.startKoin
|
import org.koin.core.context.startKoin
|
||||||
import org.koin.dsl.KoinAppDeclaration
|
import org.koin.dsl.KoinAppDeclaration
|
||||||
@ -40,17 +41,22 @@ val kotlinxSerializer = KotlinxSerializer( Json {
|
|||||||
isLenient = true
|
isLenient = true
|
||||||
ignoreUnknownKeys = true
|
ignoreUnknownKeys = true
|
||||||
})
|
})
|
||||||
|
/*
|
||||||
|
* Refactor This
|
||||||
|
* */
|
||||||
fun isInternetAvailable(): Boolean {
|
fun isInternetAvailable(): Boolean {
|
||||||
return runBlocking {
|
var result = false
|
||||||
|
val job = GlobalScope.launch {
|
||||||
try {
|
try {
|
||||||
ktorHttpClient.head<String>("http://google.com")
|
ktorHttpClient.head<String>("http://google.com")
|
||||||
true
|
result = true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println(e.message)
|
println(e.message)
|
||||||
false
|
result = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (job.isActive){}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
fun createHttpClient(enableNetworkLogs: Boolean = false,serializer: KotlinxSerializer = kotlinxSerializer) = HttpClient {
|
fun createHttpClient(enableNetworkLogs: Boolean = false,serializer: KotlinxSerializer = kotlinxSerializer) = HttpClient {
|
||||||
install(JsonFeature) {
|
install(JsonFeature) {
|
@ -1,7 +1,8 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
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.request.*
|
||||||
import io.ktor.client.statement.*
|
import io.ktor.client.statement.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
@ -1,7 +1,6 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import com.shabinder.common.models.TrackDetails
|
||||||
import com.shabinder.common.utils.removeIllegalChars
|
|
||||||
|
|
||||||
expect class Picture
|
expect class Picture
|
||||||
|
|
@ -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.database.DownloadRecordDatabaseQueries
|
||||||
import com.shabinder.common.providers.GaanaProvider
|
import com.shabinder.common.di.providers.GaanaProvider
|
||||||
import com.shabinder.common.providers.SpotifyProvider
|
import com.shabinder.common.di.providers.SpotifyProvider
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
@ -1,9 +1,9 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.shabinder.common.database.TokenDBQueries
|
import com.shabinder.common.database.TokenDBQueries
|
||||||
import com.shabinder.common.spotify.TokenData
|
import com.shabinder.common.models.spotify.TokenData
|
||||||
import com.shabinder.common.spotify.authenticateSpotify
|
import com.shabinder.common.di.spotify.authenticateSpotify
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
@ -1,4 +1,4 @@
|
|||||||
package com.shabinder.common.utils
|
package com.shabinder.common.di
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removing Illegal Chars from File Name
|
* Removing Illegal Chars from File Name
|
@ -1,6 +1,7 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
|
import com.shabinder.common.models.PlatformQueryResult
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
|
|
@ -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.*
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
|
|
@ -14,14 +14,18 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.providers
|
package com.shabinder.common.di.providers
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.shabinder.common.*
|
|
||||||
import com.shabinder.common.database.DownloadRecordDatabaseQueries
|
import com.shabinder.common.database.DownloadRecordDatabaseQueries
|
||||||
import com.shabinder.common.gaana.GaanaRequests
|
import com.shabinder.common.di.Dir
|
||||||
import com.shabinder.common.gaana.GaanaTrack
|
import com.shabinder.common.di.finalOutputDir
|
||||||
import com.shabinder.common.spotify.Source
|
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 com.shabinder.database.Database
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -81,7 +85,7 @@ class GaanaProvider(
|
|||||||
dir.defaultDir()
|
dir.defaultDir()
|
||||||
)
|
)
|
||||||
)) {//Download Already Present!!
|
)) {//Download Already Present!!
|
||||||
it.downloaded = DownloadStatus.Downloaded
|
it.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
trackList = listOf(it).toTrackDetailsList(folderType, subFolder)
|
trackList = listOf(it).toTrackDetailsList(folderType, subFolder)
|
||||||
title = it.track_title
|
title = it.track_title
|
||||||
@ -111,7 +115,7 @@ class GaanaProvider(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {//Download Already Present!!
|
) {//Download Already Present!!
|
||||||
track.downloaded = DownloadStatus.Downloaded
|
track.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trackList = it.tracks.toTrackDetailsList(folderType, subFolder)
|
trackList = it.tracks.toTrackDetailsList(folderType, subFolder)
|
||||||
@ -142,7 +146,7 @@ class GaanaProvider(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {//Download Already Present!!
|
) {//Download Already Present!!
|
||||||
track.downloaded = DownloadStatus.Downloaded
|
track.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trackList = it.tracks.toTrackDetailsList(folderType, subFolder)
|
trackList = it.tracks.toTrackDetailsList(folderType, subFolder)
|
||||||
@ -181,7 +185,7 @@ class GaanaProvider(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {//Download Already Present!!
|
) {//Download Already Present!!
|
||||||
track.downloaded = DownloadStatus.Downloaded
|
track.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trackList = it.tracks.toTrackDetailsList(folderType, subFolder)
|
trackList = it.tracks.toTrackDetailsList(folderType, subFolder)
|
@ -14,12 +14,19 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common.providers
|
package com.shabinder.common.di.providers
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.shabinder.common.*
|
|
||||||
import com.shabinder.common.database.DownloadRecordDatabaseQueries
|
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 com.shabinder.database.Database
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -90,7 +97,7 @@ class SpotifyProvider(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {//Download Already Present!!
|
) {//Download Already Present!!
|
||||||
it.downloaded = DownloadStatus.Downloaded
|
it.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
trackList = listOf(it).toTrackDetailsList(folderType, subFolder)
|
trackList = listOf(it).toTrackDetailsList(folderType, subFolder)
|
||||||
title = it.name.toString()
|
title = it.name.toString()
|
||||||
@ -122,7 +129,7 @@ class SpotifyProvider(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {//Download Already Present!!
|
) {//Download Already Present!!
|
||||||
it.downloaded = DownloadStatus.Downloaded
|
it.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
it.album = Album(
|
it.album = Album(
|
||||||
images = listOf(
|
images = listOf(
|
||||||
@ -171,7 +178,7 @@ class SpotifyProvider(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {//Download Already Present!!
|
) {//Download Already Present!!
|
||||||
it1.downloaded = DownloadStatus.Downloaded
|
it1.downloaded = com.shabinder.common.models.DownloadStatus.Downloaded
|
||||||
}
|
}
|
||||||
tempTrackList.add(it1)
|
tempTrackList.add(it1)
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package com.shabinder.common.providers
|
package com.shabinder.common.di.providers
|
||||||
|
|
||||||
import co.touchlab.kermit.Logger
|
import co.touchlab.kermit.Logger
|
||||||
import com.shabinder.common.YoutubeTrack
|
import com.shabinder.common.models.YoutubeTrack
|
||||||
import com.willowtreeapps.fuzzywuzzy.diffutils.FuzzySearch
|
import com.willowtreeapps.fuzzywuzzy.diffutils.FuzzySearch
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
@ -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.*
|
||||||
import io.ktor.client.features.auth.*
|
import io.ktor.client.features.auth.*
|
||||||
import io.ktor.client.features.auth.providers.*
|
import io.ktor.client.features.auth.providers.*
|
||||||
import io.ktor.client.features.json.*
|
import io.ktor.client.features.json.*
|
||||||
import io.ktor.client.features.json.serializer.*
|
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.request.forms.*
|
import io.ktor.client.request.forms.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
@ -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.*
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
|
|
@ -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<TrackDetails>){
|
||||||
|
//TODO
|
||||||
|
}
|
@ -1,13 +1,13 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.mpatric.mp3agic.Mp3File
|
import com.mpatric.mp3agic.Mp3File
|
||||||
|
import com.shabinder.common.models.TrackDetails
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.lang.Exception
|
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
@ -110,7 +110,7 @@ actual class Dir actual constructor(private val logger: Kermit) {
|
|||||||
val result: BufferedImage? = ImageIO.read(File(cachePath))
|
val result: BufferedImage? = ImageIO.read(File(cachePath))
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
Picture(
|
com.shabinder.common.di.Picture(
|
||||||
source,
|
source,
|
||||||
getNameURL(source),
|
getNameURL(source),
|
||||||
result,
|
result,
|
||||||
@ -134,7 +134,7 @@ actual class Dir actual constructor(private val logger: Kermit) {
|
|||||||
val result: BufferedImage? = ImageIO.read(input)
|
val result: BufferedImage? = ImageIO.read(input)
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
val picture = Picture(
|
val picture = com.shabinder.common.di.Picture(
|
||||||
url,
|
url,
|
||||||
getNameURL(url),
|
getNameURL(url),
|
||||||
result,
|
result,
|
@ -1,11 +1,11 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import com.mpatric.mp3agic.ID3v1Tag
|
import com.mpatric.mp3agic.ID3v1Tag
|
||||||
import com.mpatric.mp3agic.ID3v24Tag
|
import com.mpatric.mp3agic.ID3v24Tag
|
||||||
import com.mpatric.mp3agic.Mp3File
|
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.flow.collect
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
|
|
@ -14,13 +14,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shabinder.common
|
package com.shabinder.common.di
|
||||||
|
|
||||||
import co.touchlab.kermit.Kermit
|
import co.touchlab.kermit.Kermit
|
||||||
import com.github.kiulian.downloader.YoutubeDownloader
|
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.database.DownloadRecordDatabaseQueries
|
||||||
import com.shabinder.common.spotify.Source
|
import com.shabinder.common.models.spotify.Source
|
||||||
import com.shabinder.common.utils.removeIllegalChars
|
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
@ -1,7 +1,7 @@
|
|||||||
import androidx.compose.desktop.Window
|
import androidx.compose.desktop.Window
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import com.shabinder.common.initKoin
|
import com.shabinder.common.di.initKoin
|
||||||
|
|
||||||
private val koin = initKoin(enableNetworkLogs = true).koin
|
private val koin = initKoin(enableNetworkLogs = true).koin
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user