Skip to content

Commit

Permalink
chore(deps): update dependencies and target_api
Browse files Browse the repository at this point in the history
  • Loading branch information
mcatta committed Oct 15, 2023
1 parent 1c76f44 commit 12fdc9a
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,4 @@ inline fun <reified T : Any> MockKMatcherScope.anyInline(): T =
this.isAccessible = true
val valueType = parameters[0].type.classifier as KClass<*>
call(match(ConstantMatcher(true), valueType))
}

fun <T : Any> MockKMatcherScope.match(matcher: Matcher<T>, type: KClass<T>): T =
(getProperty("callRecorder") as MockKGateway.CallRecorder).matcher(matcher, type)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -54,7 +55,7 @@ internal class MediaRepositoryImplTest {
fun setup() {
MockKAnnotations.init(this)

coEvery { mediaFileCache.getValue(any(), any()) } returns null
coEvery { mediaFileCache.getValue(any(), any<CachePolicy>()) } returns null
coEvery { mediaFileCache.setValue(any(), any(), any()) } just Runs
coEvery { authDataSource.getAuthToken() } returns Either.Right("token")

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 18 additions & 19 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down Expand Up @@ -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" }
Expand All @@ -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]
Expand Down

0 comments on commit 12fdc9a

Please sign in to comment.