diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 44d3a36..3037b34 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -11,27 +11,21 @@ dependencies { implementation("com.google.android.material:material:1.6.1") implementation("androidx.appcompat:appcompat:1.4.2") implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1") - implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.0-rc02") - implementation("androidx.activity:activity-compose:1.4.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0-alpha01") + implementation("androidx.activity:activity-compose:1.5.0") implementation("androidx.palette:palette-ktx:1.0.0") - implementation("androidx.compose.ui:ui-util:1.2.0-rc02") - implementation("androidx.compose.material:material:1.2.0-rc02") - implementation("androidx.compose.ui:ui:1.2.0-rc02") - implementation("androidx.compose.animation:animation:1.2.0-rc02") - debugImplementation("androidx.compose.ui:ui-tooling:1.2.0-rc02") - implementation("androidx.compose.ui:ui-tooling-preview:1.2.0-rc02") + implementation(libs.bundles.compose) + debugImplementation(libs.compose.ui.preview) - implementation ("com.google.android.exoplayer:exoplayer-core:2.18.0") - implementation ("com.google.android.exoplayer:extension-mediasession:2.18.0") - implementation ("com.google.android.exoplayer:exoplayer-ui:2.18.0") + implementation (libs.bundles.exoplayer) implementation ("dev.chrisbanes.snapper:snapper:0.2.2") implementation ("androidx.work:work-runtime-ktx:2.7.1") - implementation("androidx.lifecycle:lifecycle-process:2.5.0-rc02") + implementation("androidx.lifecycle:lifecycle-process:2.6.0-alpha01") implementation("io.coil-kt:coil-compose:2.1.0") implementation("com.google.dagger:hilt-android:2.42") kapt("com.google.dagger:hilt-android-compiler:2.42") @@ -46,13 +40,13 @@ kapt { } android { - compileSdk = 32 + compileSdk = 33 defaultConfig { applicationId = "com.rld.justlisten.android" minSdk = 21 - targetSdk = 32 - versionCode = 18 - versionName = "1.0.6" + targetSdk = 33 + versionCode = 20 + versionName = "1.0.6-b" vectorDrawables { useSupportLibrary = true } @@ -73,13 +67,13 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "17" } buildFeatures { compose = true } composeOptions { - kotlinCompilerExtensionVersion = "1.2.0-beta03" + kotlinCompilerExtensionVersion = "1.2.0" } packagingOptions { diff --git a/androidApp/proguard-rules.pro b/androidApp/proguard-rules.pro index d35a709..8e45295 100644 --- a/androidApp/proguard-rules.pro +++ b/androidApp/proguard-rules.pro @@ -66,4 +66,12 @@ boolean getASSERTIONS_ENABLED() return false; boolean getDEBUG() return false; boolean getRECOVER_STACK_TRACES() return false; -} \ No newline at end of file +} + +-dontwarn org.bouncycastle.jsse.BCSSLSocket +-dontwarn org.bouncycastle.jsse.BCSSLParameters +-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider +-dontwarn org.conscrypt.* +-dontwarn org.openjsse.javax.net.ssl.SSLParameters +-dontwarn org.openjsse.javax.net.ssl.SSLSocket +-dontwarn org.openjsse.net.ssl.OpenJSSE \ No newline at end of file diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml index bfcfd18..bf801be 100644 --- a/androidApp/src/main/AndroidManifest.xml +++ b/androidApp/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/androidApp/src/main/java/com/rld/justlisten/android/MainActivity.kt b/androidApp/src/main/java/com/rld/justlisten/android/MainActivity.kt index 4e4e251..bf01de0 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/MainActivity.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/MainActivity.kt @@ -15,7 +15,6 @@ import com.rld.justlisten.android.ui.theme.JustListenTheme import com.rld.justlisten.android.ui.utils.getColorPallet import com.rld.justlisten.datalayer.datacalls.settings.getSettingsInfo - class MainActivity : ComponentActivity() { @OptIn(ExperimentalMaterialApi::class) diff --git a/androidApp/src/main/java/com/rld/justlisten/android/di/ServiceModule.kt b/androidApp/src/main/java/com/rld/justlisten/android/di/ServiceModule.kt index e95d8aa..63fad51 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/di/ServiceModule.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/di/ServiceModule.kt @@ -45,7 +45,7 @@ object ServiceModule { @Provides @ServiceScoped fun provideAudioAttributes() = AudioAttributes.Builder() - .setContentType(C.CONTENT_TYPE_MUSIC) + .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC) .setUsage(C.USAGE_MEDIA) .build() diff --git a/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerEventListener.kt b/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerEventListener.kt index 5079527..8f4c96b 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerEventListener.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerEventListener.kt @@ -1,5 +1,7 @@ package com.rld.justlisten.android.exoplayer.callbacks +import android.app.Service.STOP_FOREGROUND_DETACH +import android.os.Build import android.widget.Toast import com.google.android.exoplayer2.ExoPlayer import com.google.android.exoplayer2.PlaybackException @@ -17,7 +19,11 @@ class MusicPlayerEventListener( override fun onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) { super.onPlayWhenReadyChanged(playWhenReady, reason) if (reason == Player.STATE_READY && !playWhenReady) { - musicService.stopForeground(false) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + musicService.stopForeground(STOP_FOREGROUND_DETACH) + } else { + musicService.stopForeground(true) + } musicService.isForegroundService = false } } diff --git a/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerNotificationListener.kt b/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerNotificationListener.kt index 0ed7b9d..71cfb8e 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerNotificationListener.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/exoplayer/callbacks/MusicPlayerNotificationListener.kt @@ -1,7 +1,9 @@ package com.rld.justlisten.android.exoplayer.callbacks import android.app.Notification +import android.app.Service import android.content.Intent +import android.os.Build import androidx.core.content.ContextCompat import com.rld.justlisten.android.exoplayer.MusicService import com.rld.justlisten.android.exoplayer.utils.Constants.NOTIFICATION_ID @@ -13,7 +15,11 @@ class MusicPlayerNotificationListener( override fun onNotificationCancelled(notificationId: Int, dismissedByUser: Boolean) { super.onNotificationCancelled(notificationId, dismissedByUser) musicService.apply { - stopForeground(true) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + musicService.stopForeground(Service.STOP_FOREGROUND_DETACH) + } else { + musicService.stopForeground(true) + } isForegroundService = false stopSelf() } diff --git a/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMaximized.kt b/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMaximized.kt index 527c3e3..ee9c3b9 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMaximized.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMaximized.kt @@ -102,7 +102,7 @@ fun PlayBarActionsMaximized( SHUFFLE_MODE_ALL ) }, - painter = painterResource(id = R.drawable.exo_styled_controls_shuffle_off), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_styled_controls_shuffle_off), contentDescription = null, ) } else { @@ -115,7 +115,7 @@ fun PlayBarActionsMaximized( SHUFFLE_MODE_NONE ) }, - painter = painterResource(id = R.drawable.exo_styled_controls_shuffle_on), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_styled_controls_shuffle_on), contentDescription = null, ) } @@ -126,7 +126,7 @@ fun PlayBarActionsMaximized( .clickable { musicServiceConnection.transportControls.skipToPrevious() }, - painter = painterResource(id = R.drawable.exo_ic_skip_previous), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_ic_skip_previous), contentDescription = null, ) if (musicServiceConnection.playbackState.value?.state != PlaybackState.STATE_PLAYING && @@ -142,7 +142,7 @@ fun PlayBarActionsMaximized( .weight(0.2f), onClick = { musicServiceConnection.transportControls.play() }) { Icon( - painter = painterResource(id = R.drawable.exo_icon_play), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_icon_play), contentDescription = null ) } @@ -157,14 +157,14 @@ fun PlayBarActionsMaximized( .weight(0.2f), onClick = { musicServiceConnection.transportControls.pause() }) { Icon( - painter = painterResource(id = R.drawable.exo_icon_pause), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_icon_pause), contentDescription = null ) } } Icon( - painter = painterResource(id = R.drawable.exo_ic_skip_next), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_ic_skip_next), modifier = Modifier .size(40.dp) .clickable(onClick = onSkipNextPressed) @@ -181,7 +181,7 @@ fun PlayBarActionsMaximized( REPEAT_MODE_ONE ) }, - painter = painterResource(id = R.drawable.exo_controls_repeat_off), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off), contentDescription = null, ) REPEAT_MODE_ONE -> Icon( @@ -193,7 +193,7 @@ fun PlayBarActionsMaximized( REPEAT_MODE_ALL ) }, - painter = painterResource(id = R.drawable.exo_controls_repeat_one), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one), contentDescription = null, ) REPEAT_MODE_ALL -> Icon( @@ -205,7 +205,7 @@ fun PlayBarActionsMaximized( REPEAT_MODE_NONE ) }, - painter = painterResource(id = R.drawable.exo_controls_repeat_all), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all), contentDescription = null, ) } diff --git a/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMinimized.kt b/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMinimized.kt index e029189..7596abc 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMinimized.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayBarActionsMinimized.kt @@ -15,7 +15,6 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.rld.justlisten.android.R import com.rld.justlisten.android.exoplayer.MusicServiceConnection import com.rld.justlisten.android.exoplayer.library.extension.artist import com.rld.justlisten.android.ui.theme.typography @@ -33,7 +32,6 @@ fun PlayBarActionsMinimized( Row( Modifier .graphicsLayer(alpha = 1f - currentFraction * 2) - .height(IntrinsicSize.Max) .clickable(onClick = playBarMinimizedClicked) ) { if (currentFraction != 1f) { @@ -106,7 +104,7 @@ fun PlayBarActionsMinimized( musicServiceConnection.playbackState.value?.state != PlaybackState.STATE_BUFFERING ) { Icon( - painter = painterResource(id = R.drawable.exo_icon_play), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_icon_play), modifier = Modifier .padding(8.dp) .clickable( @@ -122,7 +120,7 @@ fun PlayBarActionsMinimized( ) if (musicServiceConnection.playbackState.value?.state == PlaybackState.STATE_PLAYING) { Icon( - painter = painterResource(id = R.drawable.exo_icon_pause), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_icon_pause), modifier = Modifier .padding(8.dp) .clickable( @@ -133,7 +131,7 @@ fun PlayBarActionsMinimized( ) } Icon( - painter = painterResource(id = R.drawable.exo_ic_skip_next), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_ic_skip_next), modifier = Modifier .padding(8.dp) .clickable(onClick = onSkipNextPressed) diff --git a/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayerBottomBar.kt b/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayerBottomBar.kt index 0d4d164..ae6966e 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayerBottomBar.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/ui/bottombars/playbar/components/PlayerBottomBar.kt @@ -14,7 +14,6 @@ import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.rld.justlisten.android.R import com.rld.justlisten.android.exoplayer.MusicService.Companion.curSongDuration import com.rld.justlisten.android.exoplayer.MusicServiceConnection import com.rld.justlisten.android.ui.extensions.noRippleClickable @@ -96,7 +95,7 @@ fun IsLoading(isLoading: Boolean, modifier: Modifier) { ) { CircularProgressIndicator() Icon( - painter = painterResource(id = R.drawable.exo_icon_pause), + painter = painterResource(id = com.google.android.exoplayer2.ui.R.drawable.exo_icon_pause), modifier = modifier.size(35.dp), contentDescription = null ) diff --git a/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/SettingsScreen.kt b/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/SettingsScreen.kt index 2faa948..09d40d9 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/SettingsScreen.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/SettingsScreen.kt @@ -97,7 +97,7 @@ fun SettingsScreen( Row(modifier = Modifier.fillMaxWidth().weight(1f, false), horizontalArrangement = Arrangement.Center) { - Text(text ="App version:1.0.6") + Text(text ="App version:1.0.6-fix") } } } diff --git a/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/components/SettingsContent.kt b/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/components/SettingsContent.kt index d28746d..3f6aa2e 100644 --- a/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/components/SettingsContent.kt +++ b/androidApp/src/main/java/com/rld/justlisten/android/ui/settingsscreen/components/SettingsContent.kt @@ -57,10 +57,11 @@ fun SettingsContent( verticalAlignment = Alignment.CenterVertically ) { Text( - text = "Has Bottom Donation Navigation", + text = "Has Bottom Donation Navigation \nDisabled thanks to google", style = MaterialTheme.typography.h6.copy(fontSize = 14.sp) ) Switch( + enabled = false, checked = settings.hasDonationNavigationOn, modifier = Modifier.padding(8.dp), onCheckedChange = { diff --git a/build.gradle.kts b/build.gradle.kts index 54c467a..d9f214a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,14 +5,11 @@ buildscript { mavenCentral() } - val kotlin_version = "1.6.21" - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") - classpath("com.android.tools.build:gradle:7.2.1") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlinVersion.get()}") + classpath("com.android.tools.build:gradle:8.0.1") classpath("com.squareup.sqldelight:gradle-plugin:1.5.3") - classpath ("com.google.dagger:hilt-android-gradle-plugin:2.40.1") - + classpath ("com.google.dagger:hilt-android-gradle-plugin:2.42") } } @@ -27,9 +24,9 @@ tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } -/* + tasks.withType{ kotlinOptions { freeCompilerArgs = listOf("-Xuse-k2") } -}*/ +} diff --git a/gradle.properties b/gradle.properties index 1728bde..a7ca9f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,7 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" kotlin.code.style=official #Android -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=true +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a370928..98d0c69 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Aug 11 15:11:38 EEST 2021 +#Fri Jul 22 21:14:22 EEST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle.kts b/settings.gradle.kts index b47ab87..130e04b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,6 +7,59 @@ pluginManagement { } } +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + version("kotlinVersion", "1.7.0") + + version("ktorVersion", "2.0.2") + library("ktor-client-content-negotiation", "io.ktor", "ktor-client-content-negotiation").versionRef("ktorVersion") + library("ktor-client-core", "io.ktor", "ktor-client-core").versionRef("ktorVersion") + library("ktor-serialization-kotlinx-json", "io.ktor", "ktor-serialization-kotlinx-json").versionRef("ktorVersion") + library("ktor-client-logging", "io.ktor", "ktor-client-logging").versionRef("ktorVersion") + bundle( + "ktor", + listOf( + "ktor-client-core", + "ktor-client-content-negotiation", + "ktor-serialization-kotlinx-json", + "ktor-client-logging" + ) + ) + + version("composeVersion", "1.3.0-alpha01") + library("compose-ui-util", "androidx.compose.ui", "ui-util").versionRef("composeVersion") + library("compose-ui", "androidx.compose.ui", "ui").versionRef("composeVersion") + library("compose-ui-preview", "androidx.compose.ui", "ui-tooling-preview").versionRef("composeVersion") + library("compose-material", "androidx.compose.material", "material").versionRef("composeVersion") + library("compose-animation", "androidx.compose.animation", "animation").versionRef("composeVersion") + bundle( + "compose", + listOf( + "compose-ui", + "compose-ui-util", + "compose-ui-preview", + "compose-material", + "compose-animation" + ) + ) + + version("exoPlayerVersion", "2.18.6") + library("exoplayer-mediasession", "com.google.android.exoplayer", "extension-mediasession").versionRef("exoPlayerVersion") + library("exoplayer-core", "com.google.android.exoplayer", "exoplayer-core").versionRef("exoPlayerVersion") + library("exoplayer-ui", "com.google.android.exoplayer", "exoplayer-ui").versionRef("exoPlayerVersion") + bundle( + "exoplayer", + listOf( + "exoplayer-mediasession", + "exoplayer-core", + "exoplayer-ui" + ) + ) + } + } +} + rootProject.name = "Just Listen" include(":androidApp") include(":shared") \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index ea495f6..2392112 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,9 +1,10 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget +@Suppress("DSL_SCOPE_VIOLATION") plugins { kotlin("multiplatform") id("com.android.library") - kotlin("plugin.serialization") version "1.6.21" + kotlin("plugin.serialization") version libs.versions.kotlinVersion.get() id("com.squareup.sqldelight") } @@ -24,15 +25,11 @@ kotlin { } } sourceSets { - val ktor_version = "2.0.2" val commonMain by getting { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2") - implementation("io.ktor:ktor-client-core:$ktor_version") - implementation("io.ktor:ktor-client-content-negotiation:$ktor_version") - implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - implementation("io.ktor:ktor-client-logging:$ktor_version") + implementation(libs.bundles.ktor) } } val commonTest by getting { @@ -43,9 +40,8 @@ kotlin { } val androidMain by getting { dependencies { - implementation("io.ktor:ktor-client-android:$ktor_version") + implementation("io.ktor:ktor-client-android:${libs.versions.ktorVersion.get()}") implementation("com.squareup.sqldelight:android-driver:1.5.3") - } } val androidTest by getting { @@ -56,7 +52,7 @@ kotlin { } val iosMain by getting { dependencies { - implementation("io.ktor:ktor-client-ios:$ktor_version") + implementation("io.ktor:ktor-client-ios:${libs.versions.ktorVersion.get()}") implementation("com.squareup.sqldelight:native-driver:1.5.3") } @@ -72,12 +68,25 @@ sqldelight { } } +configurations { + named("debugFrameworkIos") { + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, "my-unique-attribute")) + } + } + named("releaseFrameworkIos") { + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, "huh")) + } + } +} + android { - compileSdk = 30 + compileSdk = 33 sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { minSdk = 21 - targetSdk = 30 + targetSdk = 33 } namespace = "com.rld.justlisten" } \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/rld/justlisten/StateManager.kt b/shared/src/commonMain/kotlin/com/rld/justlisten/StateManager.kt index 035fd73..cd39352 100644 --- a/shared/src/commonMain/kotlin/com/rld/justlisten/StateManager.kt +++ b/shared/src/commonMain/kotlin/com/rld/justlisten/StateManager.kt @@ -102,15 +102,18 @@ class StateManager(repo: Repository) { // ADD SCREEN FUNCTIONS - fun addScreen(screenIdentifier: ScreenIdentifier, screenInitSettings: ScreenInitSettings) { + fun addScreen(screenIdentifier: ScreenIdentifier, screenInitSettings: ScreenInitSettings, triggerRecomposition: Boolean = true) { //debugLogger.log("addScreen: "+screenIdentifier.URI) addScreenToBackstack(screenIdentifier) initScreenScope(screenIdentifier) if (!isInTheStatesMap(screenIdentifier) || screenInitSettings.reinitOnEachNavigation) { screenStatesMap[screenIdentifier.URI] = screenInitSettings.initState(screenIdentifier) - triggerRecomposition() // FIRST UI RECOMPOSITION - runInScreenScope(screenIdentifier) { - screenInitSettings.callOnInit(this) // SECOND UI RECOMPOSITION + screenStatesMap.keys.forEach { println("YOLO 3 $it") } + if (triggerRecomposition) { + triggerRecomposition() // FIRST UI RECOMPOSITION + runInScreenScope(screenIdentifier) { + screenInitSettings.callOnInit(this) // SECOND UI RECOMPOSITION + } } } else { triggerRecomposition() // JUST 1 UI RECOMPOSITION diff --git a/shared/src/commonMain/kotlin/com/rld/justlisten/datalayer/webservices/apis/playlistcalls/FetchTopPlaylist.kt b/shared/src/commonMain/kotlin/com/rld/justlisten/datalayer/webservices/apis/playlistcalls/FetchTopPlaylist.kt index 81a86f7..44fb643 100644 --- a/shared/src/commonMain/kotlin/com/rld/justlisten/datalayer/webservices/apis/playlistcalls/FetchTopPlaylist.kt +++ b/shared/src/commonMain/kotlin/com/rld/justlisten/datalayer/webservices/apis/playlistcalls/FetchTopPlaylist.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable suspend fun ApiClient.fetchPlaylist(index: Int, playListEnum: PlayListEnum, playlistId: String="", queryPlaylist: String = "Rock"): PlayListResponse? { return when (playListEnum) { - TOP_PLAYLIST -> getResponse("/playlists/top?type=playlist&limit=${index}&app_name=$appName") + TOP_PLAYLIST -> getResponse("/full/playlists/top?type=playlist&limit=${index}&app_name=$appName") REMIX -> getResponse("/playlists/search?query=${queryPlaylist}&limit=${index}&app_name=$appName") CURRENT_PLAYLIST -> getResponse("/playlists/${playlistId}/tracks?app_name=$appName") HOT -> getResponse("/playlists/search?query=${queryPlaylist}&limit=${index}&app_name=$appName") diff --git a/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/AudiusViewModel.kt b/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/JustListenViewModel.kt similarity index 93% rename from shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/AudiusViewModel.kt rename to shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/JustListenViewModel.kt index b8d24f0..a2f14b4 100644 --- a/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/AudiusViewModel.kt +++ b/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/JustListenViewModel.kt @@ -6,7 +6,7 @@ import com.rld.justlisten.StateManager import com.rld.justlisten.datalayer.Repository import kotlinx.coroutines.flow.StateFlow -class JustListenViewModel (repo: Repository) { +class JustListenViewModel(repo: Repository) { companion object Factory { // factory methods are defined in the platform-specific shared code (androidMain and iosMain) @@ -15,10 +15,11 @@ class JustListenViewModel (repo: Repository) { val state = StateManager(repo) val repository = repo + private val stateManager by lazy { StateManager(repo) } + val stateFlow: StateFlow get() = stateManager.mutableStateFlow - private val stateManager by lazy { StateManager(repo) } val navigation by lazy { Navigation(stateManager) } } \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/StateProvider.kt b/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/StateProvider.kt index da37d89..e93f126 100644 --- a/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/StateProvider.kt +++ b/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/StateProvider.kt @@ -3,6 +3,7 @@ package com.rld.justlisten.viewmodel import com.rld.justlisten.ScreenIdentifier import com.rld.justlisten.ScreenState import com.rld.justlisten.StateManager +import com.rld.justlisten.viewmodel.screens.playlistdetail.PlaylistDetailState class StateProvider(val stateManager: StateManager) { @@ -10,6 +11,15 @@ class StateProvider(val stateManager: StateManager) { return stateManager.screenStatesMap[screenIdentifier.URI] as T } + fun getPlaylistDetailState() : PlaylistDetailState? { + return try { + val key = stateManager.screenStatesMap.keys.first { it.contains("playlistDetail") } + stateManager.screenStatesMap[key] as PlaylistDetailState + } catch (e: Exception) { + null + } + } + // reified functions cannot be exported to iOS, so we use this function returning the "ScreenState" interface type // on Swift, we then need to cast it to the specific state class fun getToCast(screenIdentifier: ScreenIdentifier) : ScreenState? { diff --git a/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/screens/playlistdetail/PlaylistDetailState.kt b/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/screens/playlistdetail/PlaylistDetailState.kt index b8b6696..c1bc52a 100644 --- a/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/screens/playlistdetail/PlaylistDetailState.kt +++ b/shared/src/commonMain/kotlin/com/rld/justlisten/viewmodel/screens/playlistdetail/PlaylistDetailState.kt @@ -1,7 +1,6 @@ package com.rld.justlisten.viewmodel.screens.playlistdetail import com.rld.justlisten.ScreenState -import com.rld.justlisten.datalayer.models.PlayListModel import com.rld.justlisten.viewmodel.screens.playlist.PlaylistItem data class PlaylistDetailState(