Skip to content

Commit a1a071d

Browse files
[fix|build] Fix deeplink; use LocalActivity.current; use new R8 DSL; bump dependencies
1 parent a0ed6bc commit a1a071d

24 files changed

Lines changed: 102 additions & 296 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ kotlin.native.ignoreDisabledTargets=true
1515
org.jetbrains.compose.experimental.macos.enabled=true
1616

1717
# Android
18-
android.useAndroidX=true
1918
android.enableBuildConfigAsBytecode=true
19+
android.r8.gradual.support=true
2020
android.r8.maxWorkers=4
2121
android.injected.androidTest.leaveApksInstalledAfterRun=true
2222

gradle/libs.versions.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[versions]
2-
agp = "9.2.0"
2+
agp = "9.2.1"
33
kotlin = "2.3.21"
4-
kotlinx-datetime = "0.7.1"
5-
kotlinx-coroutines = "1.10.2"
4+
kotlinx-datetime = "0.8.0"
5+
kotlinx-coroutines = "1.11.0"
66
kotlinx-serialization = "1.11.0"
77
kotlinx-io = "0.9.0"
88
ksp = "2.3.7"
9-
compose = "1.11.0-beta03"
9+
compose = "1.11.0-rc01"
1010
compose-material3 = "1.11.0-alpha07"
1111
compose-material3-adaptive = "1.3.0-alpha07"
1212
compose-materialIconsExtended = "1.7.3"
1313
lifecycle = "2.10.0"
14-
navigation3 = "1.1.0"
14+
navigation3 = "1.1.1"
1515
ktor = "3.4.3"
1616
koin = "4.2.1"
1717
ksoup = "0.2.6"
18-
coil = "3.4.0"
19-
paging = "3.4.2"
18+
coil = "3.5.0-beta01"
19+
paging = "3.5.0"
2020
worker = "2.11.2"
2121
room = "2.8.4"
22-
filekit = "0.13.0"
22+
filekit = "0.14.1"
2323
xmlutil = "0.91.3"
2424
tracing-perfetto = "1.0.1"
2525

@@ -29,7 +29,7 @@ androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", versi
2929
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.13.0" }
3030
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.1" }
3131
androidx-constraintlayout-compose = { module = "tech.annexflow.compose:constraintlayout-compose-multiplatform", version = "0.7.0-shaded" }
32-
androidx-media = { module = "androidx.media:media", version = "1.7.1" }
32+
androidx-media = { module = "androidx.media:media", version = "1.8.0" }
3333
androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version = "1.4.1" }
3434
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version = "0.37.3" }
3535
desugar-jdk-libs = { module = "com.android.tools:desugar_jdk_libs", version = "2.1.5" }
@@ -157,4 +157,4 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
157157
compose-multiplatform = { id = "org.jetbrains.compose", version.ref = "compose" }
158158
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
159159
room = { id = "androidx.room", version.ref = "room" }
160-
buildkonfig = { id = "com.codingfeline.buildkonfig", version = "0.18.0" }
160+
buildkonfig = { id = "com.codingfeline.buildkonfig", version = "0.20.0" }

platform/android/app/build.gradle.kts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ android {
8181
if (signing != null) {
8282
signingConfig = signingConfigs.getByName("release") // signing
8383
}
84-
isMinifyEnabled = true
85-
isShrinkResources = true
86-
proguardFiles(
87-
getDefaultProguardFile("proguard-android-optimize.txt"),
88-
"proguard-rules.pro"
89-
)
84+
optimization.enable = true
9085
}
9186
debug {
9287
applicationIdSuffix = ".debug"

platform/android/app/proguard-rules.pro

Lines changed: 0 additions & 111 deletions
This file was deleted.

platform/android/app/src/main/java/com/skyd/podaura/ui/player/PlayerView.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.skyd.podaura.ui.player
22

3+
import androidx.activity.compose.LocalActivity
34
import androidx.compose.foundation.Image
45
import androidx.compose.foundation.background
56
import androidx.compose.foundation.layout.aspectRatio
@@ -14,15 +15,13 @@ import androidx.compose.runtime.setValue
1415
import androidx.compose.ui.Modifier
1516
import androidx.compose.ui.graphics.Color
1617
import androidx.compose.ui.layout.ContentScale
17-
import androidx.compose.ui.platform.LocalContext
1818
import androidx.lifecycle.Lifecycle
1919
import androidx.lifecycle.compose.LifecycleStartEffect
2020
import androidx.lifecycle.compose.collectAsStateWithLifecycle
2121
import coil3.compose.rememberAsyncImagePainter
2222
import com.skyd.compone.ext.ratio
2323
import com.skyd.compone.ext.size
2424
import com.skyd.compone.ext.thenIfNotNull
25-
import com.skyd.podaura.ext.activity
2625
import com.skyd.podaura.model.preference.player.BackgroundPlayPreference
2726
import com.skyd.podaura.ui.component.OnLifecycleEvent
2827
import com.skyd.podaura.ui.component.rememberOrientationController
@@ -54,7 +53,6 @@ import com.skyd.podaura.ui.screen.settings.playerconfig.ForwardSecondsDialog
5453
import com.skyd.podaura.ui.screen.settings.playerconfig.ReplaySecondsDialog
5554
import io.github.vinceglb.filekit.PlatformFile
5655

57-
5856
@Composable
5957
fun PlayerViewRoute(
6058
service: PlayerCoordinator?,
@@ -72,7 +70,7 @@ fun PlayerView(
7270
onBack: () -> Unit,
7371
onSaveScreenshot: (PlatformFile) -> Unit,
7472
) {
75-
val context = LocalContext.current
73+
val activity = LocalActivity.current
7674

7775
val playerState by service.playerState.collectAsStateWithLifecycle()
7876
var playState by remember { mutableStateOf(PlayState.initial) }
@@ -140,7 +138,7 @@ fun PlayerView(
140138

141139
val playerObserver = PlayerCoordinator.Observer { command ->
142140
when (command) {
143-
is PlayerEvent.Shutdown -> context.activity.finish()
141+
is PlayerEvent.Shutdown -> activity?.finish()
144142
PlayerEvent.Seek -> playState = playState.copy(isSeeking = false)
145143
else -> Unit
146144
}
@@ -223,7 +221,7 @@ fun PlayerView(
223221

224222
Lifecycle.Event.ON_STOP -> {
225223
if (inPipMode) { // Close button in PIP window is clicked
226-
context.activity.finish()
224+
activity?.finish()
227225
}
228226
}
229227

@@ -250,7 +248,6 @@ private fun PipContent(
250248
onCommand = onCommand,
251249
modifier = Modifier
252250
.pipParams(
253-
context = LocalContext.current,
254251
autoEnterPipMode = autoEnterPipMode,
255252
isVideo = true,
256253
playState = playState,
@@ -265,7 +262,6 @@ private fun PipContent(
265262
val modifier = Modifier
266263
.fillMaxSize()
267264
.pipParams(
268-
context = LocalContext.current,
269265
autoEnterPipMode = autoEnterPipMode,
270266
isVideo = false,
271267
playState = playState,
@@ -373,4 +369,4 @@ private fun Content(
373369
visible = { dialogState.forwardSecondsDialogState().show },
374370
onDismissRequest = { onDialogVisibilityChanged.onForwardSecondDialog(false) },
375371
)
376-
}
372+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# FFmpeg
2+
-dontwarn com.arthenica.smartexception.java.Exceptions
3+
4+
# MPV
5+
-keep,allowoptimization class is.xyz.mpv.MPVLib { public *; }
6+
7+
# Allow ProGuard to widen access modifiers
8+
-allowaccessmodification
9+
10+
# Strip Kotlin null checks inserted by the compiler to reduce method count and overhead
11+
-processkotlinnullchecks remove

shared/build.gradle.kts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,6 @@ kotlin {
208208
}
209209
}
210210

211-
// https://github.com/coil-kt/coil/issues/3382
212-
// TODO Remove it after coil 3.5.0-beta01 released
213-
// w: Skiko dependencies' versions are incompatible.
214-
// io.coil-kt.coil3:coil-core-jvm:3.4.0
215-
// \--- org.jetbrains.skiko:skiko:0.9.22.2 -> 0.144.5
216-
//
217-
// io.coil-kt.coil3:coil-svg-jvm:3.4.0
218-
// \--- org.jetbrains.skiko:skiko:0.9.22.2 -> 0.144.5
219-
configurations.all {
220-
resolutionStrategy.force("org.jetbrains.skiko:skiko:0.144.5")
221-
}
222-
223211
compose.resources {
224212
publicResClass = true
225213
}

shared/src/androidMain/kotlin/com/skyd/podaura/ext/ContextExt.kt

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,17 @@
11
package com.skyd.podaura.ext
22

3-
import android.app.Activity
43
import android.content.Context
5-
import android.content.ContextWrapper
64
import android.content.pm.PackageInfo
75
import android.content.pm.PackageManager
86
import android.content.res.Configuration
97
import android.os.Build
108
import android.os.Build.VERSION.SDK_INT
119
import android.os.Vibrator
1210
import android.os.VibratorManager
13-
import android.view.Window
1411
import androidx.core.content.pm.PackageInfoCompat
1512
import kotlinx.coroutines.runBlocking
1613
import org.jetbrains.compose.resources.StringResource
1714

18-
val Context.activity: Activity
19-
get() {
20-
return tryActivity ?: error("Can't find activity: $this")
21-
}
22-
23-
@get:JvmName("tryActivity")
24-
val Context.tryActivity: Activity?
25-
get() {
26-
var ctx = this
27-
while (ctx is ContextWrapper) {
28-
if (ctx is Activity) {
29-
return ctx
30-
}
31-
ctx = ctx.baseContext
32-
}
33-
return null
34-
}
35-
36-
val Context.tryWindow: Window?
37-
get() {
38-
var ctx = this
39-
while (ctx is ContextWrapper) {
40-
if (ctx is Activity) {
41-
return ctx.window
42-
}
43-
ctx = ctx.baseContext
44-
}
45-
return null
46-
}
47-
4815
fun Context.getAppVersionName(): String {
4916
var appVersionName = ""
5017
try {
@@ -105,4 +72,4 @@ fun Context.vibrator(): Vibrator {
10572
@Suppress("DEPRECATION")
10673
getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
10774
}
108-
}
75+
}

shared/src/androidMain/kotlin/com/skyd/podaura/ext/ViewExt.kt

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)