commit d5007f084bc3aef7b721bae927617500dabacb44 Author: shabinder Date: Tue Jan 26 18:24:28 2021 +0530 Initial Commit diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 00000000..d7b69677 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,102 @@ +import org.jetbrains.compose.compose + +plugins { + id("org.jetbrains.compose") + id("com.android.application") + kotlin("android") +} + +group = "com.shabinder" +version = Versions.versionName + +repositories { + google() +} + +android { + compileSdkVersion(29) + defaultConfig { + applicationId = "com.shabinder.android" + minSdkVersion(Versions.minSdkVersion) + targetSdkVersion(Versions.targetSdkVersion) + versionCode = Versions.versionCode + versionName = Versions.versionName + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + //isShrinkResources = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + // Flag to enable support for the new language APIs + //coreLibraryDesugaringEnabled = true + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + configurations { + "implementation" { + exclude(group = "androidx.compose.animation") + exclude(group = "androidx.compose.foundation") + exclude(group = "androidx.compose.material") + exclude(group = "androidx.compose.runtime") + exclude(group = "androidx.compose.ui") + } + } + kotlinOptions { + jvmTarget = "1.8" + useIR = true + } +} +dependencies { + implementation(compose.material) + implementation(project(":common:database")) + implementation(project(":common:compose-ui")) + implementation(project(":common:dependency-injection")) + implementation(project(":common:data-models")) + implementation(Androidx.appCompat) + implementation(Androidx.coroutines) + implementation(Androidx.core) + implementation(Androidx.palette) + //implementation(JetBrains.Compose.materialIcon) + + //Compose-Navigation + implementation(Androidx.composeNavigation) + + //Lifecycle + Versions.androidLifecycle.let{ + implementation("androidx.lifecycle:lifecycle-runtime-ktx:$it") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:$it") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$it") + implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$it") + } + + //Coil-Image Loading + Versions.coilVersion.let{ + implementation("dev.chrisbanes.accompanist:accompanist-coil:$it") + implementation("dev.chrisbanes.accompanist:accompanist-insets:$it") + } + + Extras.Android.apply { + implementation(appUpdator) + implementation(razorpay) + implementation(fetch) + } + + //Test + testImplementation("junit:junit:4.13.1") + androidTestImplementation(Androidx.junit) + androidTestImplementation(Androidx.expresso) + + //Desugaring + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.1") +} +tasks.withType { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check", + "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi" + ) + } +} \ No newline at end of file diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d829873d --- /dev/null +++ b/android/src/main/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/android/src/main/java/com/shabinder/android/MainActivity.kt b/android/src/main/java/com/shabinder/android/MainActivity.kt new file mode 100644 index 00000000..e06784af --- /dev/null +++ b/android/src/main/java/com/shabinder/android/MainActivity.kt @@ -0,0 +1,25 @@ +package com.shabinder.android + +import android.os.Bundle +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.platform.setContent +import com.shabinder.common.authenticateSpotify +import com.shabinder.common.ui.SpotiFlyerMain +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + val scope = rememberCoroutineScope() + SpotiFlyerMain() + scope.launch(Dispatchers.IO) { + val token = authenticateSpotify() + Log.i("Spotify",token.toString()) + } + } + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..6129eee2 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + `kotlin-dsl` +} + +allprojects { + repositories { + google() + jcenter() + mavenCentral() + maven(url = "https://jitpack.io") + maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") + } +} +buildscript { + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..f3e50a09 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,46 @@ +plugins { + `kotlin-dsl` + `kotlin-dsl-precompiled-script-plugins` +} + +group = "com.shabinder" +version = "2.1" + +buildscript{ + repositories { + // TODO: remove after new build is published + mavenLocal() + google() + jcenter() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + } + + dependencies { + classpath("com.android.tools.build:gradle:4.0.2") + classpath(JetBrains.Compose.gradlePlugin) + classpath(JetBrains.Kotlin.gradlePlugin) + } +} + +repositories { + jcenter() + mavenLocal() + google() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") +} + +dependencies { + implementation("com.android.tools.build:gradle:4.0.2") + implementation(JetBrains.Compose.gradlePlugin) + implementation(JetBrains.Kotlin.gradlePlugin) + implementation(JetBrains.Kotlin.serialization) + implementation(SqlDelight.gradlePlugin) +} + +kotlinDslPluginOptions { + experimentalWarning.set(false) +} +kotlin { + // Add Deps to compilation, so it will become available in main project + sourceSets.getByName("main").kotlin.srcDir("buildSrc/src/main/kotlin") +} \ No newline at end of file diff --git a/buildSrc/buildSrc/build.gradle.kts b/buildSrc/buildSrc/build.gradle.kts new file mode 100644 index 00000000..3d7a9541 --- /dev/null +++ b/buildSrc/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + jcenter() +} diff --git a/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/buildSrc/src/main/kotlin/Deps.kt new file mode 100644 index 00000000..40d5463d --- /dev/null +++ b/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -0,0 +1,33 @@ +object Deps { + object ArkIvanov { + object MVIKotlin { + private const val VERSION = "2.0.0" + const val rx = "com.arkivanov.mvikotlin:rx:$VERSION" + const val mvikotlin = "com.arkivanov.mvikotlin:mvikotlin:$VERSION" + const val mvikotlinMain = "com.arkivanov.mvikotlin:mvikotlin-main:$VERSION" + const val mvikotlinMainIosX64 = "com.arkivanov.mvikotlin:mvikotlin-main-iosx64:$VERSION" + const val mvikotlinMainIosArm64 = "com.arkivanov.mvikotlin:mvikotlin-main-iosarm64:$VERSION" + const val mvikotlinLogging = "com.arkivanov.mvikotlin:mvikotlin-logging:$VERSION" + const val mvikotlinTimeTravel = "com.arkivanov.mvikotlin:mvikotlin-timetravel:$VERSION" + const val mvikotlinExtensionsReaktive = "com.arkivanov.mvikotlin:mvikotlin-extensions-reaktive:$VERSION" + } + + object Decompose { + private const val VERSION = "0.1.6" + const val decompose = "com.arkivanov.decompose:decompose:$VERSION" + const val decomposeIosX64 = "com.arkivanov.decompose:decompose-iosx64:$VERSION" + const val decomposeIosArm64 = "com.arkivanov.decompose:decompose-iosarm64:$VERSION" + const val extensionsCompose = "com.arkivanov.decompose:extensions-compose-jetbrains:$VERSION" + } + } + + object Badoo { + object Reaktive { + private const val VERSION = "1.1.19" + const val reaktive = "com.badoo.reaktive:reaktive:$VERSION" + const val reaktiveTesting = "com.badoo.reaktive:reaktive-testing:$VERSION" + const val utils = "com.badoo.reaktive:utils:$VERSION" + const val coroutinesInterop = "com.badoo.reaktive:coroutines-interop:$VERSION" + } + } +} diff --git a/buildSrc/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/buildSrc/src/main/kotlin/Versions.kt new file mode 100644 index 00000000..6a46a602 --- /dev/null +++ b/buildSrc/buildSrc/src/main/kotlin/Versions.kt @@ -0,0 +1,103 @@ +@file:Suppress("MayBeConstant", "SpellCheckingInspection") + +object Versions { + const val versionName = "2.2" + const val kotlinVersion = "1.4.21" + + const val coroutinesVersion = "1.4.2" + const val composeVersion = "1.0.0-alpha10" + const val coilVersion = "0.4.1" + //DI + const val kodein = "7.2.0" + + //Internet + const val ktor = "1.5.0" + + const val kotlinxSerialization = "1.0.1" + //Database + const val sqlDelight = "1.4.4" + + const val sqliteJdbcDriver = "3.30.1" + const val slf4j = "1.7.30" + + //Android + const val versionCode = 15 + const val minSdkVersion = 24 + const val compileSdkVersion = 30 + const val targetSdkVersion = 29 + const val androidLifecycle = "2.3.0-rc01" +} + +object Androidx{ + const val appCompat = "androidx.appcompat:appcompat:1.2.0" + const val core = "androidx.core:core-ktx:1.5.0-beta01" + const val palette = "androidx.palette:palette-ktx:1.0.0" + const val composeNavigation = "androidx.navigation:navigation-compose:1.0.0-alpha05" + const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutinesVersion}" + + const val junit = "androidx.test.ext:junit:1.1.2" + const val expresso = "androidx.test.espresso:espresso-core:3.3.0" +} +object JetBrains { + object Kotlin { + const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}" + const val serialization = "org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlinVersion}" + const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:${Versions.kotlinVersion}" + const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.kotlinVersion}" + const val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:${Versions.kotlinVersion}" + } + + object Compose { + // __LATEST_COMPOSE_RELEASE_VERSION__ + private const val VERSION = "0.3.0-build140" + const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" + const val materialIcon = "androidx.compose.material:material-icons-extended:${Versions.composeVersion}" + } +} +object Ktor { + val clientCore = "io.ktor:ktor-client-core:${Versions.ktor}" + val clientJson = "io.ktor:ktor-client-json:${Versions.ktor}" + val clientLogging = "io.ktor:ktor-client-logging:${Versions.ktor}" + val clientSerialization = "io.ktor:ktor-client-serialization:${Versions.ktor}" + + val auth = "io.ktor:ktor-client-auth:${Versions.ktor}" + val clientAndroid = "io.ktor:ktor-client-android:${Versions.ktor}" + val clientDesktop = "io.ktor:ktor-client-curl:${Versions.ktor}" + val clientApache = "io.ktor:ktor-client-apache:${Versions.ktor}" + val slf4j = "org.slf4j:slf4j-simple:${Versions.slf4j}" + val clientIos = "io.ktor:ktor-client-ios:${Versions.ktor}" + val clientCio = "io.ktor:ktor-client-cio:${Versions.ktor}" + val clientJs = "io.ktor:ktor-client-js:${Versions.ktor}" +} + +object Extras { + val youtubeDownloader = "com.github.sealedtx:java-youtube-downloader:2.4.6" + val fuzzyWuzzy = "me.xdrop:fuzzywuzzy:1.3.1" + val mp3agic = "com.mpatric:mp3agic:0.9.1" + val jsonKlaxon = "com.beust:klaxon:5.4" + object Android { + val razorpay = "com.razorpay:checkout:1.6.4" + val fetch = "androidx.tonyodev.fetch2:xfetch2:3.1.5" + val appUpdator = "com.github.amitbd1508:AppUpdater:4.1.0" + } +} + +object JetpackDataStore { + val dep = "androidx.datastore:datastore-preferences-core:1.0.0-alpha05" +} + +object Serialization { + val core = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.kotlinxSerialization}" +} + +object SqlDelight { + val runtime = "com.squareup.sqldelight:runtime:${Versions.sqlDelight}" + val coroutineExtensions = "com.squareup.sqldelight:coroutines-extensions:${Versions.sqlDelight}" + + const val gradlePlugin = "com.squareup.sqldelight:gradle-plugin:${Versions.sqlDelight}" + const val androidDriver = "com.squareup.sqldelight:android-driver:${Versions.sqlDelight}" + const val sqliteDriver = "com.squareup.sqldelight:sqlite-driver:${Versions.sqlDelight}" + const val nativeDriver = "com.squareup.sqldelight:native-driver:${Versions.sqlDelight}" + val nativeDriverMacos = "com.squareup.sqldelight:native-driver-macosx64:${Versions.sqlDelight}" + val jdbcDriver = "org.xerial:sqlite-jdbc:${Versions.sqliteJdbcDriver}" +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/android-setup.gradle.kts b/buildSrc/src/main/kotlin/android-setup.gradle.kts new file mode 100644 index 00000000..8d437967 --- /dev/null +++ b/buildSrc/src/main/kotlin/android-setup.gradle.kts @@ -0,0 +1,29 @@ +//import gradle.kotlin.dsl.accessors._2e8a70bdda5e56ec477a6ff432ddf9d7.android + +plugins { + id("com.android.library") +} + +android { + compileSdkVersion(29) + + defaultConfig { + minSdkVersion(Versions.minSdkVersion) + targetSdkVersion(Versions.targetSdkVersion) + } + composeOptions { + kotlinCompilerExtensionVersion = Versions.composeVersion + kotlinCompilerVersion = Versions.kotlinVersion + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + sourceSets { + named("main") { + manifest.srcFile("src/androidMain/AndroidManifest.xml") + res.srcDirs("src/androidMain/res") + } + } +} diff --git a/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts new file mode 100644 index 00000000..73261337 --- /dev/null +++ b/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts @@ -0,0 +1,39 @@ +import org.jetbrains.compose.compose + +plugins { + id("com.android.library") + id("kotlin-multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + jvm("desktop") + android() + + sourceSets { + named("commonMain") { + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + } + } + + named("androidMain") { + dependencies { + implementation(Androidx.appCompat) + implementation(Androidx.core) + } + } + + named("desktopMain") { + dependencies { + implementation(compose.desktop.common) + } + } + } + + tasks.withType { + kotlinOptions.jvmTarget = "1.8" + } +} diff --git a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts new file mode 100644 index 00000000..75cedec1 --- /dev/null +++ b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts @@ -0,0 +1,34 @@ +plugins { + id("com.android.library") + id("kotlin-multiplatform") +} + +kotlin { + jvm("desktop") + android() + //ios() + + sourceSets { + named("commonTest") { + dependencies { + implementation(JetBrains.Kotlin.testCommon) + implementation(JetBrains.Kotlin.testAnnotationsCommon) + } + } + + named("androidTest") { + dependencies { + implementation(JetBrains.Kotlin.testJunit) + } + } + named("desktopTest") { + dependencies { + implementation(JetBrains.Kotlin.testJunit) + } + } + } + + tasks.withType { + kotlinOptions.jvmTarget = "1.8" + } +} diff --git a/common/compose-ui/build.gradle.kts b/common/compose-ui/build.gradle.kts new file mode 100644 index 00000000..476cd3fd --- /dev/null +++ b/common/compose-ui/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + id("multiplatform-compose-setup") + id("android-setup") +} + +kotlin { + sourceSets { + named("commonMain") { + dependencies { + implementation(Deps.ArkIvanov.Decompose.decompose) + implementation(Deps.ArkIvanov.Decompose.extensionsCompose) + } + } + } +} diff --git a/common/compose-ui/src/androidMain/AndroidManifest.xml b/common/compose-ui/src/androidMain/AndroidManifest.xml new file mode 100644 index 00000000..17d82132 --- /dev/null +++ b/common/compose-ui/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/SpotiFlyerMain.kt b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/SpotiFlyerMain.kt new file mode 100644 index 00000000..01e17d00 --- /dev/null +++ b/common/compose-ui/src/commonMain/kotlin/com/shabinder/common/ui/SpotiFlyerMain.kt @@ -0,0 +1,12 @@ +package com.shabinder.common.ui + +import androidx.compose.foundation.layout.Column +import androidx.compose.material.Text +import androidx.compose.runtime.Composable + +@Composable +fun SpotiFlyerMain(){ + Column { + Text("Hello World") + } +} \ No newline at end of file diff --git a/common/data-models/build.gradle.kts b/common/data-models/build.gradle.kts new file mode 100644 index 00000000..741d3f10 --- /dev/null +++ b/common/data-models/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + id("multiplatform-compose-setup") + id("android-setup") + kotlin("plugin.serialization") +} + +kotlin { + sourceSets { + named("commonMain") { + dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") + } + } + } +} diff --git a/common/data-models/src/androidMain/AndroidManifest.xml b/common/data-models/src/androidMain/AndroidManifest.xml new file mode 100644 index 00000000..17d82132 --- /dev/null +++ b/common/data-models/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadObject.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadObject.kt new file mode 100644 index 00000000..5b1048f9 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/DownloadObject.kt @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common + +import com.shabinder.common.spotify.Source +import kotlinx.serialization.Serializable + +@Serializable +data class TrackDetails( + var title:String, + var artists:List, + var durationSec:Int, + var albumName:String?=null, + var year:String?=null, + var comment:String?=null, + var lyrics:String?=null, + var trackUrl:String?=null, + //TODO var albumArt: File, + var albumArtURL: String, + var source: Source, + var downloaded: DownloadStatus = DownloadStatus.NotDownloaded, + var progress: Int = 2,//2 for visual progress bar hint + var outputFile: String, + var videoID:String? = null +) + +enum class DownloadStatus{ + Downloaded, + Downloading, + Queued, + NotDownloaded, + Converting, + Failed +} \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/Optional.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/Optional.kt new file mode 100644 index 00000000..c56b1758 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/Optional.kt @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common + +import kotlinx.serialization.Serializable + +@Serializable +data class Optional(val value: T?) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/PlatformQueryResult.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/PlatformQueryResult.kt new file mode 100644 index 00000000..5c6868b3 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/PlatformQueryResult.kt @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common + +import com.shabinder.common.spotify.Source +import kotlinx.serialization.Serializable + +@Serializable +data class PlatformQueryResult( + var folderType: String, + var subFolder: String, + var title: String, + var coverUrl: String, + var trackList: List, + var source: Source +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/YoutubeTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/YoutubeTrack.kt new file mode 100644 index 00000000..ca7dc59f --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/YoutubeTrack.kt @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common + +import kotlinx.serialization.Serializable + +@Serializable +data class YoutubeTrack( + var name: String? = null, + var type: String? = null, // Song / Video + var artist: String? = null, + var duration:String? = null, + var videoId: String? = null +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Artist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Artist.kt new file mode 100644 index 00000000..e76857e6 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Artist.kt @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Artist ( + val popularity : Int, + val seokey : String, + val name : String, + @SerialName("artwork_175x175")var artworkLink :String? +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/CustomArtworks.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/CustomArtworks.kt new file mode 100644 index 00000000..9df6fdc2 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/CustomArtworks.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +import kotlinx.serialization.SerialName + +data class CustomArtworks ( + @SerialName("40x40") val size_40p : String, + @SerialName("80x80") val size_80p : String, + @SerialName("110x110")val size_110p : String, + @SerialName("175x175")val size_175p : String, + @SerialName("480x480")val size_480p : String, +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaAlbum.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaAlbum.kt new file mode 100644 index 00000000..f7c76310 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaAlbum.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +data class GaanaAlbum ( + val tracks : List, + val count : Int, + val custom_artworks : CustomArtworks, + val release_year : Int, + val favorite_count : Int, +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistDetails.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistDetails.kt new file mode 100644 index 00000000..cf580679 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistDetails.kt @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +data class GaanaArtistDetails( + val artist : List, + val count : Int, +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistTracks.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistTracks.kt new file mode 100644 index 00000000..3dbe52b1 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaArtistTracks.kt @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +data class GaanaArtistTracks( + val count : Int, + val tracks : List +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaPlaylist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaPlaylist.kt new file mode 100644 index 00000000..735630aa --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaPlaylist.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +data class GaanaPlaylist ( + val modified_on : String, + val count : Int, + val created_on : String, + val favorite_count : Int, + val tracks : List, +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaSong.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaSong.kt new file mode 100644 index 00000000..449fb5c2 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaSong.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +data class GaanaSong( + val tracks : List +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaTrack.kt new file mode 100644 index 00000000..acbdebf6 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/GaanaTrack.kt @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +import com.shabinder.common.DownloadStatus +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GaanaTrack ( + val tags : List?, + val seokey : String, + val albumseokey : String?, + val track_title : String, + val album_title : String?, + val language : String?, + val duration: Int, + @SerialName("artwork_large") val artworkLink : String, + val artist : List, + @SerialName("gener") val genre : List?, + val lyrics_url : String?, + val youtube_id : String?, + val total_favourite_count : Int?, + val release_date : String?, + val play_ct : String?, + val secondary_language : String?, + var downloaded: DownloadStatus? = DownloadStatus.NotDownloaded +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Genre.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Genre.kt new file mode 100644 index 00000000..46d0c616 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Genre.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +import kotlinx.serialization.Serializable + +@Serializable +data class Genre ( + val genre_id : Int, + val name : String +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Tags.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Tags.kt new file mode 100644 index 00000000..ab428255 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/gaana/Tags.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.gaana + +import kotlinx.serialization.Serializable + +@Serializable +data class Tags ( + val tag_id : Int, + val tag_name : String +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Album.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Album.kt new file mode 100644 index 00000000..63f3bde6 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Album.kt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class Album( + var album_type: String? = null, + var artists: List? = null, + var available_markets: List? = null, + var copyrights: List? = null, + var external_ids: Map? = null, + var external_urls: Map? = null, + var genres: List? = null, + var href: String? = null, + var id: String? = null, + var images: List? = null, + var label :String? = null, + var name: String? = null, + var popularity: Int? = null, + var release_date: String? = null, + var release_date_precision: String? = null, + var tracks: PagingObjectTrack? = null, + var type: String? = null, + var uri: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Artist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Artist.kt new file mode 100644 index 00000000..99401f29 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Artist.kt @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class Artist( + var external_urls: Map? = null, + var href: String? = null, + var id: String? = null, + var name: String? = null, + var type: String? = null, + var uri: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Copyright.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Copyright.kt new file mode 100644 index 00000000..7d9a1d3c --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Copyright.kt @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class Copyright( + var text: String? = null, + var type: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Episodes.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Episodes.kt new file mode 100644 index 00000000..fa7cf2a0 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Episodes.kt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class Episodes( + var audio_preview_url:String?, + var description:String?, + var duration_ms:Int?, + var explicit:Boolean?, + var external_urls:Map?, + var href:String?, + var id:String?, + var images:List?, + var is_externally_hosted:Boolean?, + var is_playable:Boolean?, + var language:String?, + var languages:List?, + var name:String?, + var release_date:String?, + var release_date_precision:String?, + var type:String?, + var uri:String +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Followers.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Followers.kt new file mode 100644 index 00000000..c9bf926d --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Followers.kt @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class Followers( + var href: String? = null, + var total: Int? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Image.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Image.kt new file mode 100644 index 00000000..aedc3f36 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Image.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class Image( + var width: Int? = null, + var height: Int? = null, + var url: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/LinkedTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/LinkedTrack.kt new file mode 100644 index 00000000..9b581ab8 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/LinkedTrack.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class LinkedTrack( + var external_urls: Map? = null, + var href: String? = null, + var id: String? = null, + var type: String? = null, + var uri: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectPlaylistTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectPlaylistTrack.kt new file mode 100644 index 00000000..29c7f11e --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectPlaylistTrack.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class PagingObjectPlaylistTrack( + var href: String? = null, + var items: List? = null, + var limit: Int = 0, + var next: String? = null, + var offset: Int = 0, + var previous: String? = null, + var total: Int = 0) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectTrack.kt new file mode 100644 index 00000000..84b50a4f --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PagingObjectTrack.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class PagingObjectTrack( + var href: String? = null, + var items: List? = null, + var limit: Int = 0, + var next: String? = null, + var offset: Int = 0, + var previous: String? = null, + var total: Int = 0) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Playlist.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Playlist.kt new file mode 100644 index 00000000..69867bd1 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Playlist.kt @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Playlist( + @SerialName("collaborative")var is_collaborative: Boolean? = null, + var description: String? = null, + var external_urls: Map? = null, + var followers: Followers? = null, + var href: String? = null, + var id: String? = null, + var images: List? = null, + var name: String? = null, + var owner: UserPublic? = null, + @SerialName("public")var is_public: Boolean? = null, + var snapshot_id: String? = null, + var tracks: PagingObjectPlaylistTrack? = null, + var type: String? = null, + var uri: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PlaylistTrack.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PlaylistTrack.kt new file mode 100644 index 00000000..bf14a6b5 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/PlaylistTrack.kt @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class PlaylistTrack( + var added_at: String? = null, + var added_by: UserPublic? = null, + var track: Track? = null, + var is_local: Boolean? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Source.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Source.kt new file mode 100644 index 00000000..73b8425e --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Source.kt @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +enum class Source { + Spotify, + YouTube, + Gaana, +} \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Token.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Token.kt new file mode 100644 index 00000000..fa57c3ab --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Token.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Token( + var access_token:String?, + var token_type:String?, + @SerialName("expires_in") var expiry:Long? +) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Track.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Track.kt new file mode 100644 index 00000000..b9609f3e --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/Track.kt @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import com.shabinder.common.DownloadStatus +import kotlinx.serialization.Serializable + +@Serializable +data class Track( + var artists: List? = null, + var available_markets: List? = null, + var is_playable: Boolean? = null, + var linked_from: LinkedTrack? = null, + var disc_number: Int = 0, + var duration_ms: Long = 0, + var explicit: Boolean? = null, + var external_urls: Map? = null, + var href: String? = null, + var name: String? = null, + var preview_url: String? = null, + var track_number: Int = 0, + var type: String? = null, + var uri: String? = null, + var album: Album? = null, + var external_ids: Map? = null, + var popularity: Int? = null, + var downloaded: DownloadStatus = DownloadStatus.NotDownloaded +) + diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPrivate.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPrivate.kt new file mode 100644 index 00000000..b4b76a89 --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPrivate.kt @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class UserPrivate( + val country:String, + var display_name: String, + val email:String, + var external_urls: Map? = null, + var followers: Followers? = null, + var href: String? = null, + var id: String? = null, + var images: List? = null, + var product:String, + var type: String? = null, + var uri: String? = null) \ No newline at end of file diff --git a/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPublic.kt b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPublic.kt new file mode 100644 index 00000000..e05cd92e --- /dev/null +++ b/common/data-models/src/commonMain/kotlin/com/shabinder/common/spotify/UserPublic.kt @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Shabinder Singh + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.shabinder.common.spotify + +import kotlinx.serialization.Serializable + +@Serializable +data class UserPublic( + var display_name: String? = null, + var external_urls: Map? = null, + var followers: Followers? = null, + var href: String? = null, + var id: String? = null, + var images: List? = null, + var type: String? = null, + var uri: String? = null) \ No newline at end of file diff --git a/common/database/build.gradle.kts b/common/database/build.gradle.kts new file mode 100644 index 00000000..805dd3e6 --- /dev/null +++ b/common/database/build.gradle.kts @@ -0,0 +1,40 @@ +plugins { + id("multiplatform-setup") + id("android-setup") + id("com.squareup.sqldelight") +} + +sqldelight { + database("TodoDatabase") { + packageName = "com.shabinder.database" + } +} + +kotlin { + sourceSets { + commonMain { + dependencies { + implementation(Deps.Badoo.Reaktive.reaktive) + } + } + + androidMain { + dependencies { + implementation(SqlDelight.androidDriver) + implementation(SqlDelight.sqliteDriver) + } + } + + desktopMain { + dependencies { + implementation(SqlDelight.sqliteDriver) + } + } + + /*iosMain { + dependencies { + implementation(Deps.Squareup.SQLDelight.nativeDriver) + } + }*/ + } +} diff --git a/common/database/src/androidMain/AndroidManifest.xml b/common/database/src/androidMain/AndroidManifest.xml new file mode 100644 index 00000000..fc851138 --- /dev/null +++ b/common/database/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/common/database/src/androidMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt b/common/database/src/androidMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt new file mode 100644 index 00000000..365ab422 --- /dev/null +++ b/common/database/src/androidMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt @@ -0,0 +1,13 @@ +package com.shabinder.common.database + +import com.squareup.sqldelight.db.SqlDriver +import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver +import com.shabinder.database.TodoDatabase + +@Suppress("FunctionName") // FactoryFunction +actual fun TestDatabaseDriver(): SqlDriver { + val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY) + TodoDatabase.Schema.create(driver) + + return driver +} diff --git a/common/database/src/androidMain/kotlin/com/shabinder/common/database/TodoDatabaseDriverFactory.kt b/common/database/src/androidMain/kotlin/com/shabinder/common/database/TodoDatabaseDriverFactory.kt new file mode 100644 index 00000000..6949a0ba --- /dev/null +++ b/common/database/src/androidMain/kotlin/com/shabinder/common/database/TodoDatabaseDriverFactory.kt @@ -0,0 +1,14 @@ +package com.shabinder.common.database + +import android.content.Context +import com.squareup.sqldelight.android.AndroidSqliteDriver +import com.squareup.sqldelight.db.SqlDriver +import com.shabinder.database.TodoDatabase + +@Suppress("FunctionName") // FactoryFunction +fun TodoDatabaseDriver(context: Context): SqlDriver = + AndroidSqliteDriver( + schema = TodoDatabase.Schema, + context = context, + name = "TodoDatabase.db" + ) diff --git a/common/database/src/commonMain/kotlin/com/shabinder/common/database/ReaktiveExt.kt b/common/database/src/commonMain/kotlin/com/shabinder/common/database/ReaktiveExt.kt new file mode 100644 index 00000000..8a8b84ce --- /dev/null +++ b/common/database/src/commonMain/kotlin/com/shabinder/common/database/ReaktiveExt.kt @@ -0,0 +1,28 @@ +package com.shabinder.common.database + +import com.badoo.reaktive.base.setCancellable +import com.badoo.reaktive.observable.Observable +import com.badoo.reaktive.observable.map +import com.badoo.reaktive.observable.observable +import com.badoo.reaktive.observable.observeOn +import com.badoo.reaktive.scheduler.ioScheduler +import com.squareup.sqldelight.Query + +fun Query.asObservable(execute: (Query) -> R): Observable = + asObservable() + .observeOn(ioScheduler) + .map(execute) + +fun Query.asObservable(): Observable> = + observable { emitter -> + val listener = + object : Query.Listener { + override fun queryResultsChanged() { + emitter.onNext(this@asObservable) + } + } + + emitter.onNext(this@asObservable) + addListener(listener) + emitter.setCancellable { removeListener(listener) } + } diff --git a/common/database/src/commonMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt b/common/database/src/commonMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt new file mode 100644 index 00000000..ce2aab7c --- /dev/null +++ b/common/database/src/commonMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt @@ -0,0 +1,6 @@ +package com.shabinder.common.database + +import com.squareup.sqldelight.db.SqlDriver + +@Suppress("FunctionName") +expect fun TestDatabaseDriver(): SqlDriver diff --git a/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TodoDatabase.sq b/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TodoDatabase.sq new file mode 100644 index 00000000..796a31cf --- /dev/null +++ b/common/database/src/commonMain/sqldelight/com/shabinder/common/database/TodoDatabase.sq @@ -0,0 +1,39 @@ +CREATE TABLE IF NOT EXISTS TodoItemEntity ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + orderNum INTEGER NOT NULL, + text TEXT NOT NULL, + isDone INTEGER AS Boolean NOT NULL DEFAULT 0 +); + +selectAll: +SELECT * +FROM TodoItemEntity; + +select: +SELECT * +FROM TodoItemEntity +WHERE id = :id; + +add: +INSERT INTO TodoItemEntity (orderNum, text) +VALUES ((CASE (SELECT COUNT(*) FROM TodoItemEntity) WHEN 0 THEN 1 ELSE (SELECT MAX(orderNum)+1 FROM TodoItemEntity) END), :text); + +setText: +UPDATE TodoItemEntity +SET text = :text +WHERE id = :id; + +setDone: +UPDATE TodoItemEntity +SET isDone = :isDone +WHERE id = :id; + +delete: +DELETE FROM TodoItemEntity +WHERE id = :id; + +getLastInsertId: +SELECT last_insert_rowid(); + +clear: +DELETE FROM TodoItemEntity; diff --git a/common/database/src/desktopMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt b/common/database/src/desktopMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt new file mode 100644 index 00000000..365ab422 --- /dev/null +++ b/common/database/src/desktopMain/kotlin/com/shabinder/common/database/TestDatabaseDriverFactory.kt @@ -0,0 +1,13 @@ +package com.shabinder.common.database + +import com.squareup.sqldelight.db.SqlDriver +import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver +import com.shabinder.database.TodoDatabase + +@Suppress("FunctionName") // FactoryFunction +actual fun TestDatabaseDriver(): SqlDriver { + val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY) + TodoDatabase.Schema.create(driver) + + return driver +} diff --git a/common/database/src/desktopMain/kotlin/com/shabinder/common/database/TodoDatabaseDriverFactory.kt b/common/database/src/desktopMain/kotlin/com/shabinder/common/database/TodoDatabaseDriverFactory.kt new file mode 100644 index 00000000..2dcf1846 --- /dev/null +++ b/common/database/src/desktopMain/kotlin/com/shabinder/common/database/TodoDatabaseDriverFactory.kt @@ -0,0 +1,15 @@ +package com.shabinder.common.database + +import com.squareup.sqldelight.db.SqlDriver +import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver +import com.shabinder.database.TodoDatabase +import java.io.File + +@Suppress("FunctionName") // FactoryFunction +fun TodoDatabaseDriver(): SqlDriver { + val databasePath = File(System.getProperty("java.io.tmpdir"), "ComposeTodoDatabase.db") + val driver = JdbcSqliteDriver(url = "jdbc:sqlite:${databasePath.absolutePath}") + TodoDatabase.Schema.create(driver) + + return driver +} diff --git a/common/dependency-injection/build.gradle.kts b/common/dependency-injection/build.gradle.kts new file mode 100644 index 00000000..c23288b8 --- /dev/null +++ b/common/dependency-injection/build.gradle.kts @@ -0,0 +1,34 @@ +plugins { + id("multiplatform-compose-setup") + id("android-setup") + kotlin("plugin.serialization") +} + +kotlin { + sourceSets { + named("commonMain") { + dependencies { + implementation(project(":common:data-models")) + implementation(project(":common:database")) + implementation("org.kodein.di:kodein-di:${Versions.kodein}") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1") + implementation(Ktor.clientCore) + implementation(Ktor.clientCio) + implementation(Ktor.clientJson) + implementation(Ktor.clientSerialization) + implementation(Ktor.auth) + } + } + named("androidMain"){ + dependencies{ + implementation(Ktor.clientAndroid) + + } + } + named("desktopMain"){ + dependencies{ + //implementation(Ktor.clientDesktop) + } + } + } +} diff --git a/common/dependency-injection/src/androidMain/AndroidManifest.xml b/common/dependency-injection/src/androidMain/AndroidManifest.xml new file mode 100644 index 00000000..17d82132 --- /dev/null +++ b/common/dependency-injection/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DI.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DI.kt new file mode 100644 index 00000000..8c3ccb98 --- /dev/null +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DI.kt @@ -0,0 +1,2 @@ +package com.shabinder.common + diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DIModule.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DIModule.kt new file mode 100644 index 00000000..679f7925 --- /dev/null +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/DIModule.kt @@ -0,0 +1,16 @@ +package com.shabinder.common + +import com.shabinder.common.spotify.Token +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.* +import org.kodein.di.DI + +val networking = DI.Module("Networking"){ + +} \ No newline at end of file diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/SpotifyAuth.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/SpotifyAuth.kt new file mode 100644 index 00000000..11a194d7 --- /dev/null +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/SpotifyAuth.kt @@ -0,0 +1,38 @@ +package com.shabinder.common + +import com.shabinder.common.spotify.Token +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.* + +suspend fun authenticateSpotify(): Token { + return spotifyAuthClient.post("https://accounts.spotify.com/api/token"){ + body = FormDataContent(Parameters.build { append("grant_type","client_credentials") }) + } +} + +private val spotifyAuthClient = HttpClient { + val clientId = "694d8bf4f6ec420fa66ea7fb4c68f89d" + val clientSecret = "02ca2d4021a7452dae2328b47a6e8fe8" + + install(Auth) { + basic { + sendWithoutRequest = true + username = clientId + password = clientSecret + } + } + install(JsonFeature) { + serializer = kotlinxSerializer + } +} + +val kotlinxSerializer = KotlinxSerializer( kotlinx.serialization.json.Json { + isLenient = true + ignoreUnknownKeys = true +}) \ No newline at end of file diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts new file mode 100644 index 00000000..dad3cc2f --- /dev/null +++ b/desktop/build.gradle.kts @@ -0,0 +1,38 @@ +import org.jetbrains.compose.compose +import org.jetbrains.compose.desktop.application.dsl.TargetFormat + +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +group = "com.shabinder" +version = Versions.versionName + +kotlin { + jvm { + compilations.all { + kotlinOptions.jvmTarget = "11" + } + } + sourceSets { + val jvmMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + implementation(project(":common:database")) + implementation(project(":common:compose-ui")) + } + } + val jvmTest by getting + } +} + +compose.desktop { + application { + mainClass = "MainKt" + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "SpotiFlyer" + } + } +} \ No newline at end of file diff --git a/desktop/src/jvmMain/kotlin/main.kt b/desktop/src/jvmMain/kotlin/main.kt new file mode 100644 index 00000000..94149b33 --- /dev/null +++ b/desktop/src/jvmMain/kotlin/main.kt @@ -0,0 +1,5 @@ +import androidx.compose.desktop.Window + +fun main() = Window { + //TODO +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..ae8bfed2 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,5 @@ +kotlin.code.style=official +android.useAndroidX=true +kotlin.mpp.enableGranularSourceSetsMetadata=true +kotlin.native.enableDependencyPropagation=false +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ff007c6d --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https://services.gradle.org/distributions/gradle-6.8-rc-4-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..4ca47f57 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,19 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") + } +} + +rootProject.name = "spotiflyer" +enableFeaturePreview("GRADLE_METADATA") + +include( + ":common:database", + ":common:compose-ui", + ":common:data-models", + ":common:dependency-injection", + ":android", + ":desktop" +) \ No newline at end of file