App Builds!

This commit is contained in:
shabinder 2021-02-09 18:01:50 +05:30
parent 77d6996f5d
commit 85a8dfec68
80 changed files with 229 additions and 235 deletions

View File

@ -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

View File

@ -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

View File

@ -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(

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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.*

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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.*

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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(

View File

@ -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.*

View File

@ -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 {

View File

@ -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.
*

View File

@ -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
)
}

View File

@ -14,9 +14,9 @@
* 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
@Serializable

View File

@ -1,4 +1,4 @@
package com.shabinder.common
package com.shabinder.common.models
data class DownloadRecord(
var id:Long = 0,

View File

@ -1,4 +1,4 @@
package com.shabinder.common
package com.shabinder.common.models
sealed class DownloadResult {

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,9 +14,9 @@
* 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
@Serializable

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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.Serializable

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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 (
val tracks : List<GaanaTrack>,

View File

@ -14,7 +14,7 @@
* 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(
val artist : List<Artist>,

View File

@ -14,7 +14,7 @@
* 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(
val count : Int,

View File

@ -14,7 +14,7 @@
* 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 (
val modified_on : String,

View File

@ -14,7 +14,7 @@
* 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(
val tracks : List<GaanaTrack>

View File

@ -14,9 +14,9 @@
* 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.Serializable

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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.Serializable

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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 {
Spotify,

View File

@ -14,7 +14,7 @@
* 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.Serializable

View File

@ -14,9 +14,9 @@
* 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
@Serializable

View File

@ -14,7 +14,7 @@
* 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

View File

@ -14,7 +14,7 @@
* 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

View File

@ -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;

View File

@ -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)

View File

@ -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
}

View File

@ -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

View File

@ -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
@ -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,
@ -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,

View File

@ -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

View File

@ -1,4 +1,4 @@
package com.shabinder.common
package com.shabinder.common.di
import android.graphics.Bitmap

View File

@ -14,13 +14,15 @@
* 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 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

View File

@ -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<String>("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) {

View File

@ -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.*

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
package com.shabinder.common.utils
package com.shabinder.common.di
/**
* Removing Illegal Chars from File Name

View File

@ -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.*

View File

@ -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.*

View File

@ -14,14 +14,18 @@
* 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 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)

View File

@ -14,12 +14,19 @@
* 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 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
@ -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)
}

View File

@ -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.*

View File

@ -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.*

View File

@ -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.*

View File

@ -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
}

View File

@ -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
@ -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,
@ -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,

View File

@ -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

View File

@ -1,4 +1,4 @@
package com.shabinder.common
package com.shabinder.common.di
import java.awt.image.BufferedImage

View File

@ -14,13 +14,15 @@
* 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 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

View File

@ -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