From b4834fae4dde46b4c9b56db25d84bddbc1ec8d61 Mon Sep 17 00:00:00 2001 From: DatLag Date: Thu, 13 Jun 2024 23:15:33 +0200 Subject: [PATCH] fix crashes on older phones --- .../aniflow/other/BurningSeriesResolver.android.kt | 8 ++++++-- .../datlag/aniflow/other/InstantAppHelper.android.kt | 3 ++- gradle/libs.versions.toml | 10 +++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/BurningSeriesResolver.android.kt b/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/BurningSeriesResolver.android.kt index 8b7a531..b0cb856 100644 --- a/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/BurningSeriesResolver.android.kt +++ b/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/BurningSeriesResolver.android.kt @@ -21,8 +21,12 @@ actual class BurningSeriesResolver( ) { constructor(packageManager: PackageManager, contentResolver: ContentResolver) : this( packageManager = packageManager, - episodeClient = contentResolver.acquireContentProviderClient(episodesContentUri), - seriesClient = contentResolver.acquireContentProviderClient(seriesContentUri) + episodeClient = scopeCatching { + contentResolver.acquireContentProviderClient(episodesContentUri) + }.getOrNull(), + seriesClient = scopeCatching { + contentResolver.acquireContentProviderClient(seriesContentUri) + }.getOrNull() ) constructor(context: Context) : this(context.packageManager, context.contentResolver) diff --git a/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/InstantAppHelper.android.kt b/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/InstantAppHelper.android.kt index be329ae..a224c29 100644 --- a/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/InstantAppHelper.android.kt +++ b/composeApp/src/androidMain/kotlin/dev/datlag/aniflow/other/InstantAppHelper.android.kt @@ -5,12 +5,13 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext import com.google.android.gms.instantapps.InstantApps +import com.google.android.gms.common.wrappers.InstantApps as CommonInstantApps import dev.datlag.aniflow.findActivity actual class InstantAppHelper(private val context: Context) { actual val isInstantApp: Boolean - get() = InstantApps.getPackageManagerCompat(context).isInstantApp + get() = CommonInstantApps.isInstantApp(context) actual fun showInstallPrompt() { context.findActivity()?.let { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9539abc..c7a691e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,12 +11,12 @@ appcompat = "1.7.0" appupdate = "2.1.0" atomicfu = "0.24.0" coil = "3.0.0-alpha06" -compose = "1.6.10" +compose = "1.6.11" complete-kotlin = "1.1.0" coroutines = "1.8.1" crashlytics-plugin = "3.0.1" datastore = "1.1.1" -datetime = "0.6.0-RC.2" +datetime = "0.6.0" decompose = "3.0.0" desugar = "2.0.4" firebase = "1.12.0" @@ -41,13 +41,13 @@ ksp = "2.0.0-1.0.21" ktor = "2.3.11" ktorfit = "1.14.0" markdown-renderer = "0.16.0" -moko-resources = "0.24.0-beta-4" +moko-resources = "0.24.0" multidex = "2.0.1" napier = "2.7.1" sekret = "2.0.0-alpha-05" -serialization = "1.6.3" +serialization = "1.7.0" splashscreen = "1.0.1" -tooling = "1.5.1" +tooling = "1.5.2" translate = "17.0.2" ump = "2.2.0" versions = "0.51.0"