mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-24 09:54:33 +01:00
(WIP) Web Target
This commit is contained in:
parent
1a7363993c
commit
176141bed5
1
android/proguard-rules.pro
vendored
1
android/proguard-rules.pro
vendored
@ -32,6 +32,7 @@
|
|||||||
kotlinx.serialization.KSerializer serializer(...);
|
kotlinx.serialization.KSerializer serializer(...);
|
||||||
}
|
}
|
||||||
-keep class com.shabinder.** { *; }
|
-keep class com.shabinder.** { *; }
|
||||||
|
-keep class com.mpatric.** { *; }
|
||||||
-keep,includedescriptorclasses class com.shabinder.**$$serializer { *; } # <-- change package name to your app's
|
-keep,includedescriptorclasses class com.shabinder.**$$serializer { *; } # <-- change package name to your app's
|
||||||
-keepclassmembers class com.shabinder.** { # <-- change package name to your app's
|
-keepclassmembers class com.shabinder.** { # <-- change package name to your app's
|
||||||
*** Companion;
|
*** Companion;
|
||||||
|
@ -11,7 +11,8 @@ allprojects {
|
|||||||
maven(url = "https://dl.bintray.com/ekito/koin")
|
maven(url = "https://dl.bintray.com/ekito/koin")
|
||||||
maven(url = "https://kotlin.bintray.com/kotlinx/")
|
maven(url = "https://kotlin.bintray.com/kotlinx/")
|
||||||
maven(url = "https://dl.bintray.com/icerockdev/moko")
|
maven(url = "https://dl.bintray.com/icerockdev/moko")
|
||||||
maven(url = "https://kotlin.bintray.com/kotlin-js-wrappers/")
|
//maven(url = "https://kotlin.bintray.com/kotlin-js-wrappers/")
|
||||||
|
maven(url = "https://dl.bintray.com/kotlin/kotlin-js-wrappers")
|
||||||
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,18 @@ version = "2.1"
|
|||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven(url = "https://jitpack.io")
|
maven(url = "https://jitpack.io")
|
||||||
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
maven(url = "https://dl.bintray.com/kotlin/kotlin-js-wrappers")
|
||||||
|
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.android.tools.build:gradle:4.0.1")
|
implementation("com.android.tools.build:gradle:4.0.2")
|
||||||
implementation("com.google.gms:google-services:4.3.5")
|
implementation("com.google.gms:google-services:4.3.5")
|
||||||
implementation("com.google.firebase:perf-plugin:1.3.4")
|
implementation("com.google.firebase:perf-plugin:1.3.5")
|
||||||
implementation("com.google.firebase:firebase-crashlytics-gradle:2.5.0")
|
implementation("com.google.firebase:firebase-crashlytics-gradle:2.5.1")
|
||||||
implementation(JetBrains.Compose.gradlePlugin)
|
implementation(JetBrains.Compose.gradlePlugin)
|
||||||
implementation(JetBrains.Kotlin.gradlePlugin)
|
implementation(JetBrains.Kotlin.gradlePlugin)
|
||||||
implementation(JetBrains.Kotlin.serialization)
|
implementation(JetBrains.Kotlin.serialization)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
object Versions {
|
object Versions {
|
||||||
const val versionName = "2.2.0"
|
const val versionName = "2.2.0"
|
||||||
const val kotlinVersion = "1.4.30"
|
const val kotlinVersion = "1.4.31"
|
||||||
|
|
||||||
const val coroutinesVersion = "1.4.2"
|
const val coroutinesVersion = "1.4.2"
|
||||||
//const val compose = "1.0.0-alpha12"
|
//const val compose = "1.0.0-alpha12"
|
||||||
@ -67,7 +67,7 @@ object JetBrains {
|
|||||||
|
|
||||||
object Compose {
|
object Compose {
|
||||||
// __LATEST_COMPOSE_RELEASE_VERSION__
|
// __LATEST_COMPOSE_RELEASE_VERSION__
|
||||||
const val VERSION = "0.4.0-build168"
|
const val VERSION = "0.3.2"
|
||||||
const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
|
const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,36 +7,36 @@ plugins {
|
|||||||
kotlin {
|
kotlin {
|
||||||
jvm("desktop")
|
jvm("desktop")
|
||||||
android()
|
android()
|
||||||
// Remove After upgrading dependency
|
js {
|
||||||
/*configurations.all {
|
browser()
|
||||||
resolutionStrategy.eachDependency {
|
nodejs()
|
||||||
if (requested.group.contains("org.jetbrains.compose")) {
|
|
||||||
useVersion(JetBrains.Compose.VERSION)
|
|
||||||
}
|
}
|
||||||
if (requested.group.contains("androidx.compose")) {
|
|
||||||
useVersion(Versions.compose)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
named("commonMain") {
|
named("commonMain") {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(compose.runtime)
|
implementation(compose.runtime)
|
||||||
api(compose.foundation)
|
implementation(compose.foundation)
|
||||||
api(compose.material)
|
implementation(compose.material)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
named("androidMain") {
|
named("androidMain") {
|
||||||
dependencies {
|
dependencies {
|
||||||
api("androidx.appcompat:appcompat:1.2.0")
|
implementation("androidx.appcompat:appcompat:1.2.0")
|
||||||
api(Androidx.core)
|
implementation(Androidx.core)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
named("desktopMain") {
|
named("desktopMain") {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(compose.desktop.common)
|
implementation(compose.desktop.common)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
named("jsMain") {
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains:kotlin-react:17.0.1-pre.148-kotlin-1.4.30")
|
||||||
|
implementation("org.jetbrains:kotlin-styled:1.0.0-pre.115-kotlin-1.4.10")
|
||||||
|
implementation("org.jetbrains:kotlin-react-dom:17.0.1-pre.148-kotlin-1.4.30")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@ kotlin {
|
|||||||
jvm("desktop")
|
jvm("desktop")
|
||||||
android()
|
android()
|
||||||
//ios()
|
//ios()
|
||||||
|
js {
|
||||||
|
browser()
|
||||||
|
nodejs()
|
||||||
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
named("commonTest") {
|
named("commonTest") {
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -26,6 +29,11 @@ kotlin {
|
|||||||
implementation(JetBrains.Kotlin.testJunit)
|
implementation(JetBrains.Kotlin.testJunit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
named("jsTest") {
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||||
|
@ -15,7 +15,8 @@ lateinit var appContext: Context
|
|||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
lateinit var activityContext: Context
|
lateinit var activityContext: Context
|
||||||
|
|
||||||
actual fun createDatabase(): Database {
|
@Suppress("RedundantNullableReturnType")
|
||||||
|
actual fun createDatabase(): Database? {
|
||||||
val driver = AndroidSqliteDriver(Database.Schema, appContext, "Database.db")
|
val driver = AndroidSqliteDriver(Database.Schema, appContext, "Database.db")
|
||||||
return Database(driver)
|
return Database(driver)
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@ package com.shabinder.common.database
|
|||||||
import co.touchlab.kermit.Logger
|
import co.touchlab.kermit.Logger
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
|
|
||||||
expect fun createDatabase() : Database
|
expect fun createDatabase() : Database?
|
||||||
expect fun getLogger(): Logger
|
expect fun getLogger(): Logger
|
@ -6,7 +6,8 @@ import com.shabinder.database.Database
|
|||||||
import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
|
import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
actual fun createDatabase(): Database {
|
@Suppress("RedundantNullableReturnType")
|
||||||
|
actual fun createDatabase(): Database? {
|
||||||
val databasePath = File(System.getProperty("java.io.tmpdir"), "Database.db")
|
val databasePath = File(System.getProperty("java.io.tmpdir"), "Database.db")
|
||||||
val driver = JdbcSqliteDriver(url = "jdbc:sqlite:${databasePath.absolutePath}")
|
val driver = JdbcSqliteDriver(url = "jdbc:sqlite:${databasePath.absolutePath}")
|
||||||
.also { Database.Schema.create(it) }
|
.also { Database.Schema.create(it) }
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.shabinder.common.database
|
||||||
|
|
||||||
|
import co.touchlab.kermit.CommonLogger
|
||||||
|
import co.touchlab.kermit.Logger
|
||||||
|
import com.shabinder.database.Database
|
||||||
|
|
||||||
|
actual fun createDatabase(): Database? = null
|
||||||
|
actual fun getLogger(): Logger = CommonLogger()
|
@ -15,7 +15,7 @@ kotlin {
|
|||||||
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-coroutines-core:1.4.2")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
|
||||||
implementation(Ktor.clientCore)
|
implementation(Ktor.clientCore)
|
||||||
implementation(Ktor.clientCio)
|
implementation(Ktor.clientCio)
|
||||||
@ -43,7 +43,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
desktopMain {
|
desktopMain {
|
||||||
dependencies{
|
dependencies{
|
||||||
implementation("com.github.kokorin.jaffree:jaffree:0.9.10")
|
|
||||||
implementation(Ktor.clientApache)
|
implementation(Ktor.clientApache)
|
||||||
implementation(Ktor.slf4j)
|
implementation(Ktor.slf4j)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.shabinder.common.di
|
||||||
|
|
||||||
|
import com.shabinder.common.models.DownloadStatus
|
||||||
|
import com.shabinder.common.models.TrackDetails
|
||||||
|
import io.ktor.client.request.*
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
|
||||||
|
actual fun openPlatform(packageID:String, platformLink:String){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun shareApp(){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun giveDonation(){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun queryActiveTracks(){}
|
||||||
|
actual fun showPopUpMessage(text:String){}
|
||||||
|
|
||||||
|
actual val dispatcherIO: CoroutineDispatcher = Dispatchers.Default
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Refactor This
|
||||||
|
* */
|
||||||
|
private suspend fun isInternetAvailable(): Boolean {
|
||||||
|
return withContext(dispatcherIO) {
|
||||||
|
try {
|
||||||
|
ktorHttpClient.head<String>("http://google.com")
|
||||||
|
true
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println(e.message)
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual val isInternetAvailable:Boolean
|
||||||
|
get(){
|
||||||
|
var result = false
|
||||||
|
val job = GlobalScope.launch { result = isInternetAvailable() }
|
||||||
|
while(job.isActive){}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
val DownloadProgressFlow: MutableSharedFlow<HashMap<String,DownloadStatus>> = MutableSharedFlow(1)
|
||||||
|
|
||||||
|
actual suspend fun downloadTracks(
|
||||||
|
list: List<TrackDetails>,
|
||||||
|
getYTIDBestMatch:suspend (String,TrackDetails)->String?,
|
||||||
|
saveFileWithMetaData:suspend (mp3ByteArray:ByteArray, trackDetails: TrackDetails) -> Unit
|
||||||
|
){
|
||||||
|
list.forEach {
|
||||||
|
if (!it.videoID.isNullOrBlank()) {//Video ID already known!
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.shabinder.common.di
|
||||||
|
|
||||||
|
import co.touchlab.kermit.Kermit
|
||||||
|
import com.shabinder.common.models.TrackDetails
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import org.w3c.dom.ImageBitmap
|
||||||
|
|
||||||
|
actual class Dir actual constructor(private val logger: Kermit) {
|
||||||
|
|
||||||
|
/*init {
|
||||||
|
createDirectories()
|
||||||
|
}*/
|
||||||
|
/*
|
||||||
|
* TODO
|
||||||
|
* */
|
||||||
|
actual fun fileSeparator(): String = "/"
|
||||||
|
|
||||||
|
actual fun imageCacheDir(): String = "TODO" +
|
||||||
|
fileSeparator() + "SpotiFlyer/.images" + fileSeparator()
|
||||||
|
|
||||||
|
actual fun defaultDir(): String = "TODO" + fileSeparator() +
|
||||||
|
"SpotiFlyer" + fileSeparator()
|
||||||
|
|
||||||
|
actual fun isPresent(path: String): Boolean = false
|
||||||
|
|
||||||
|
actual fun createDirectory(dirPath:String){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
actual suspend fun clearCache() {
|
||||||
|
}
|
||||||
|
|
||||||
|
actual suspend fun cacheImage(image: Any,path:String) {}
|
||||||
|
|
||||||
|
@Suppress("BlockingMethodInNonBlockingContext")
|
||||||
|
actual suspend fun saveFileWithMetadata(
|
||||||
|
mp3ByteArray: ByteArray,
|
||||||
|
trackDetails: TrackDetails
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun addToLibrary(path:String){}
|
||||||
|
|
||||||
|
actual suspend fun loadImage(url: String): ImageBitmap? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadCachedImage(cachePath: String): ImageBitmap? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
private suspend fun freshImage(url:String): ImageBitmap?{
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,6 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(compose.materialIconsExtended)
|
implementation(compose.materialIconsExtended)
|
||||||
implementation(project(":common:dependency-injection"))
|
implementation(project(":common:dependency-injection"))
|
||||||
//implementation("com.alialbaali.kamel:kamel-image:0.1.0")
|
|
||||||
implementation(project(":common:data-models"))
|
implementation(project(":common:data-models"))
|
||||||
implementation(project(":common:database"))
|
implementation(project(":common:database"))
|
||||||
implementation(project(":common:list"))
|
implementation(project(":common:list"))
|
||||||
|
@ -6,7 +6,7 @@ import androidx.compose.runtime.rememberCoroutineScope
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import com.arkivanov.decompose.ComponentContext
|
import com.arkivanov.decompose.ComponentContext
|
||||||
import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent
|
import com.arkivanov.decompose.extensions.compose.jetbrains.rememberRootComponent
|
||||||
import com.arkivanov.mvikotlin.core.lifecycle.LifecycleRegistry
|
import com.arkivanov.mvikotlin.core.lifecycle.LifecycleRegistry
|
||||||
import com.arkivanov.mvikotlin.core.lifecycle.resume
|
import com.arkivanov.mvikotlin.core.lifecycle.resume
|
||||||
import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
|
import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
|
||||||
@ -15,11 +15,7 @@ import com.shabinder.common.di.DownloadProgressFlow
|
|||||||
import com.shabinder.common.di.FetchPlatformQueryResult
|
import com.shabinder.common.di.FetchPlatformQueryResult
|
||||||
import com.shabinder.common.di.initKoin
|
import com.shabinder.common.di.initKoin
|
||||||
import com.shabinder.common.root.SpotiFlyerRoot
|
import com.shabinder.common.root.SpotiFlyerRoot
|
||||||
import com.shabinder.common.root.SpotiFlyerRootContent
|
import com.shabinder.common.uikit.*
|
||||||
import com.shabinder.common.uikit.SpotiFlyerColors
|
|
||||||
import com.shabinder.common.uikit.SpotiFlyerShapes
|
|
||||||
import com.shabinder.common.uikit.SpotiFlyerTypography
|
|
||||||
import com.shabinder.common.uikit.colorOffWhite
|
|
||||||
import com.shabinder.database.Database
|
import com.shabinder.database.Database
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -42,13 +38,7 @@ fun main(){
|
|||||||
typography = SpotiFlyerTypography,
|
typography = SpotiFlyerTypography,
|
||||||
shapes = SpotiFlyerShapes
|
shapes = SpotiFlyerShapes
|
||||||
) {
|
) {
|
||||||
val callBacks = SpotiFlyerRootContent(rootComponent(factory = ::spotiFlyerRoot)).callBacks
|
val callBacks = SpotiFlyerRootContent(rememberRootComponent(factory = ::spotiFlyerRoot)).callBacks
|
||||||
val scope = rememberCoroutineScope()
|
|
||||||
scope.launch {
|
|
||||||
DownloadProgressFlow.collect {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user