From 12fdc9abcc9b59128bbfeeddf3920db1526a27c5 Mon Sep 17 00:00:00 2001 From: mcatta Date: Sun, 15 Oct 2023 09:19:11 +0200 Subject: [PATCH] chore(deps): update dependencies and target_api --- .github/workflows/ci.yml | 2 +- .idea/androidTestResultsUserPreferences.xml | 13 +++++ .idea/kotlinc.xml | 2 +- app/src/main/AndroidManifest.xml | 1 + .../notification/PlayerNotificationManager.kt | 55 +++++++++++++++---- .../sleep/buildtools/android/AndroidConfig.kt | 2 +- .../marcocattaneo/core/testing/MockkUtils.kt | 5 +- .../data/repository/MediaRepositoryImpl.kt | 2 +- .../repository/MediaRepositoryImplTest.kt | 3 +- gradle.properties | 2 +- gradle/libs.versions.toml | 37 ++++++------- 11 files changed, 83 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 664cdcf..ba52346 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} - files: "app/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,data/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,features/player/presentation/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,core/design/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,app/build/reports/coverage/androidTest/debug/connected/report.xml,core/design/build/reports/coverage/androidTest/debug/connected/report.xml,feature/player/presentation/build/reports/coverage/androidTest/debug/connected/report.xml,data/build/reports/coverage/androidTest/debug/connected/report.xml" + files: "feature/playlist/presentation/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,feature/catalog/presentation/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,data/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,features/player/presentation/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,core/design/build/reports/jacoco/createDebugCoverage/createDebugCoverage.xml,core/design/build/reports/coverage/androidTest/debug/connected/report.xml,feature/player/presentation/build/reports/coverage/androidTest/debug/connected/report.xml,data/build/reports/coverage/androidTest/debug/connected/report.xml" - name: Upload test report artifact if: ${{ failure() }} uses: actions/upload-artifact@v3 diff --git a/.idea/androidTestResultsUserPreferences.xml b/.idea/androidTestResultsUserPreferences.xml index 8639777..97ee659 100644 --- a/.idea/androidTestResultsUserPreferences.xml +++ b/.idea/androidTestResultsUserPreferences.xml @@ -16,6 +16,19 @@ + + + + + + + diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index ff9696e..f8467b4 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 39a7075..b667fe6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,6 +17,7 @@ + diff --git a/app/src/main/java/dev/marcocattaneo/sleep/ui/notification/PlayerNotificationManager.kt b/app/src/main/java/dev/marcocattaneo/sleep/ui/notification/PlayerNotificationManager.kt index 6dd0dd8..c594a2e 100644 --- a/app/src/main/java/dev/marcocattaneo/sleep/ui/notification/PlayerNotificationManager.kt +++ b/app/src/main/java/dev/marcocattaneo/sleep/ui/notification/PlayerNotificationManager.kt @@ -16,13 +16,16 @@ package dev.marcocattaneo.sleep.ui.notification +import android.Manifest import android.app.Notification import android.app.NotificationChannel import android.app.NotificationManager import android.app.PendingIntent import android.content.Context import android.content.Intent +import android.content.pm.PackageManager import android.os.Build +import androidx.core.app.ActivityCompat import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.media.app.NotificationCompat.MediaStyle @@ -52,12 +55,13 @@ class PlayerNotificationManager @Inject constructor( private val stopPendingIntent: PendingIntent get() = createPendingIntent(PlayerNotificationService.Action.STOP) - private fun createPendingIntent(action: PlayerNotificationService.Action) = PendingIntent.getService( - context, - 0, - Intent(context, PlayerNotificationService::class.java).setAction(action.key), - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) PendingIntent.FLAG_IMMUTABLE else 0 - ) + private fun createPendingIntent(action: PlayerNotificationService.Action) = + PendingIntent.getService( + context, + 0, + Intent(context, PlayerNotificationService::class.java).setAction(action.key), + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) PendingIntent.FLAG_IMMUTABLE else 0 + ) init { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @@ -76,8 +80,15 @@ class PlayerNotificationManager @Inject constructor( } } - private fun NotificationCompat.Builder.show() = - NotificationManagerCompat.from(context).notify(NOTIFICATION_ID, build()) + private fun NotificationCompat.Builder.show() = if ( + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && + ActivityCompat.checkSelfPermission( + context, + Manifest.permission.POST_NOTIFICATIONS + ) != PackageManager.PERMISSION_GRANTED + ) { + throw IllegalStateException("You need to add the permission ${Manifest.permission.POST_NOTIFICATIONS} to your AndroidManifest.xml") + } else NotificationManagerCompat.from(context).notify(NOTIFICATION_ID, build()) private fun baseNotification( cancelable: Boolean @@ -94,14 +105,34 @@ class PlayerNotificationManager @Inject constructor( isPlaying: Boolean, ) = baseNotification(cancelable = !isPlaying) .apply { - addAction(NotificationCompat.Action.Builder(PlayerR.drawable.ic_baseline_close_24, "Stop", stopPendingIntent).build()) + addAction( + NotificationCompat.Action.Builder( + PlayerR.drawable.ic_baseline_close_24, + "Stop", + stopPendingIntent + ).build() + ) if (isPlaying) { - addAction(NotificationCompat.Action.Builder(PlayerR.drawable.ic_baseline_pause_24, "Pause", pausePendingIntent).build()) + addAction( + NotificationCompat.Action.Builder( + PlayerR.drawable.ic_baseline_pause_24, + "Pause", + pausePendingIntent + ).build() + ) } else { - addAction(NotificationCompat.Action.Builder(PlayerR.drawable.ic_baseline_play_arrow_24, "Play", playPendingIntent).build()) + addAction( + NotificationCompat.Action.Builder( + PlayerR.drawable.ic_baseline_play_arrow_24, + "Play", + playPendingIntent + ).build() + ) } } - .setStyle(MediaStyle().setShowActionsInCompactView(1).setMediaSession(audioPlayer.sessionToken)) + .setStyle( + MediaStyle().setShowActionsInCompactView(1).setMediaSession(audioPlayer.sessionToken) + ) .show() fun removeNotification() = NotificationManagerCompat.from(context).cancel(NOTIFICATION_ID) diff --git a/build-tools/android/src/main/kotlin/sleep/buildtools/android/AndroidConfig.kt b/build-tools/android/src/main/kotlin/sleep/buildtools/android/AndroidConfig.kt index e76c0ae..90e3e40 100644 --- a/build-tools/android/src/main/kotlin/sleep/buildtools/android/AndroidConfig.kt +++ b/build-tools/android/src/main/kotlin/sleep/buildtools/android/AndroidConfig.kt @@ -20,7 +20,7 @@ package sleep.buildtools.android * Defines the shared configuration for Android targets. */ internal object AndroidConfigs { - const val COMPILE_SDK: Int = 33 + const val COMPILE_SDK: Int = 34 const val MIN_SDK: Int = 24 const val TARGET_SDK: Int = 33 diff --git a/core/testing/src/main/kotlin/dev/marcocattaneo/core/testing/MockkUtils.kt b/core/testing/src/main/kotlin/dev/marcocattaneo/core/testing/MockkUtils.kt index 7456d40..53f6ee1 100644 --- a/core/testing/src/main/kotlin/dev/marcocattaneo/core/testing/MockkUtils.kt +++ b/core/testing/src/main/kotlin/dev/marcocattaneo/core/testing/MockkUtils.kt @@ -41,7 +41,4 @@ inline fun MockKMatcherScope.anyInline(): T = this.isAccessible = true val valueType = parameters[0].type.classifier as KClass<*> call(match(ConstantMatcher(true), valueType)) - } - -fun MockKMatcherScope.match(matcher: Matcher, type: KClass): T = - (getProperty("callRecorder") as MockKGateway.CallRecorder).matcher(matcher, type) + } \ No newline at end of file diff --git a/data/src/main/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImpl.kt b/data/src/main/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImpl.kt index e3ea704..1584424 100644 --- a/data/src/main/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImpl.kt +++ b/data/src/main/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImpl.kt @@ -17,7 +17,7 @@ package dev.marcocattaneo.sleep.data.repository import arrow.core.Either -import arrow.core.computations.either +import arrow.core.raise.either import dev.marcocattaneo.sleep.data.auth.AuthDataSource import dev.marcocattaneo.sleep.data.http.SleepService import dev.marcocattaneo.sleep.data.mapper.MediaFileMapper diff --git a/data/src/test/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImplTest.kt b/data/src/test/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImplTest.kt index 9a47ec9..7078b01 100644 --- a/data/src/test/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImplTest.kt +++ b/data/src/test/java/dev/marcocattaneo/sleep/data/repository/MediaRepositoryImplTest.kt @@ -23,6 +23,7 @@ import dev.marcocattaneo.sleep.data.mapper.MediaFileMapper import dev.marcocattaneo.sleep.data.model.MediaFile import dev.marcocattaneo.sleep.data.model.MediaUrl import dev.marcocattaneo.sleep.domain.AppException +import dev.marcocattaneo.sleep.domain.cache.CachePolicy import dev.marcocattaneo.sleep.domain.cache.CacheService import dev.marcocattaneo.sleep.domain.model.MediaFileEntity import dev.marcocattaneo.sleep.domain.repository.MediaRepository @@ -54,7 +55,7 @@ internal class MediaRepositoryImplTest { fun setup() { MockKAnnotations.init(this) - coEvery { mediaFileCache.getValue(any(), any()) } returns null + coEvery { mediaFileCache.getValue(any(), any()) } returns null coEvery { mediaFileCache.setValue(any(), any(), any()) } just Runs coEvery { authDataSource.getAuthToken() } returns Either.Right("token") diff --git a/gradle.properties b/gradle.properties index 3fd3018..241688d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4608m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8497120..a56d397 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,27 +1,26 @@ [versions] -compose = "1.2.0" -composeNavigation = "2.5.1" +compose = "1.5.3" +composeNavigation = "2.7.4" composeNavigationHilt = "1.0.0" -activity = "1.5.0" -kotlin = "1.7.0" -hilt = "2.44" -coroutine = "1.6.4" +kotlin = "1.9.10" +hilt = "2.48.1" +coroutine = "1.7.3" detekt = "1.21.0" -mockk = "1.12.5" +mockk = "1.13.8" accompanist = "0.25.1" androidGradlePlugin = "8.1.2" jacoco = "0.8.8" [libraries] -bom-compose = { group = "androidx.compose", name = "compose-bom", version = "2022.12.00" } -bom-firebase = { group = "com.google.firebase", name = "firebase-bom", version = "31.2.3" } +bom-compose = { group = "androidx.compose", name = "compose-bom", version = "2023.10.00" } +bom-firebase = { group = "com.google.firebase", name = "firebase-bom", version = "32.3.1" } -androidx-appCompat = { module = "androidx.appcompat:appcompat", version.ref = "activity" } -androidx-core = { module = "androidx.core:core-ktx", version.ref = "activity" } -androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version = "2.5.1" } -androidx-media = { module = "androidx.media:media", version = "1.5.0" } -androidx-material = { module = "com.google.android.material:material", version = "1.6.1" } -androidx-junit = { module = "androidx.test.ext:junit", version = "1.1.3" } +androidx-appCompat = { module = "androidx.appcompat:appcompat", version = "1.6.1" } +androidx-core = { module = "androidx.core:core-ktx", version = "1.12.0" } +androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version = "2.6.2" } +androidx-media = { module = "androidx.media:media", version = "1.6.0" } +androidx-material = { module = "com.google.android.material:material", version = "1.10.0" } +androidx-junit = { module = "androidx.test.ext:junit", version = "1.1.5" } compose-ui = { group = "androidx.compose.ui", name = "ui" } compose-material = { group = "androidx.compose.material", name = "material" } @@ -50,12 +49,12 @@ firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics firebase-auth = { group = "com.google.firebase", name = "firebase-auth-ktx" } firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics-ktx" } -arrow = { module = "io.arrow-kt:arrow-core", version = "1.0.1" } +arrow = { module = "io.arrow-kt:arrow-core", version = "1.2.1" } timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" } retrofit-client = { module = "com.squareup.retrofit2:retrofit", version = "2.9.0" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version = "2.9.0" } -retrofit-logger = { module = "com.squareup.okhttp3:logging-interceptor", version = "4.10.0" } -turbine = { module = "app.cash.turbine:turbine", version = "0.11.0" } +retrofit-logger = { module = "com.squareup.okhttp3:logging-interceptor", version = "4.11.0" } +turbine = { module = "app.cash.turbine:turbine", version = "1.0.0" } roboeletric = { module = "org.robolectric:robolectric", version = "4.8" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } @@ -69,7 +68,7 @@ polpetta = { module = "dev.mcatta:polpetta", version = "0.0.6" } gradle-android-api = { module = "com.android.tools.build:gradle-api", version.ref = "androidGradlePlugin" } gradle-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } -gradle-firebase = { module = "com.google.firebase:firebase-crashlytics-gradle", version = "2.9.4" } +gradle-firebase = { module = "com.google.firebase:firebase-crashlytics-gradle", version = "2.9.9" } gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } [bundles]