diff --git a/app/src/main/java/ru/tech/imageresizershrinker/presentation/main_screen/viewModel/MainViewModel.kt b/app/src/main/java/ru/tech/imageresizershrinker/presentation/main_screen/viewModel/MainViewModel.kt index 4151148030..a70d4c73e9 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/presentation/main_screen/viewModel/MainViewModel.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/presentation/main_screen/viewModel/MainViewModel.kt @@ -326,7 +326,11 @@ class MainViewModel @Inject constructor( } } - if (isNeedUpdate(nameFrom = BuildConfig.VERSION_NAME, nameTo = tag)) { + if (isNeedUpdate( + currentName = BuildConfig.VERSION_NAME, + updateName = tag + ) + ) { _updateAvailable.value = true if (showDialog) { _showUpdateDialog.value = true @@ -341,7 +345,7 @@ class MainViewModel @Inject constructor( } } - private fun isNeedUpdate(nameFrom: String, nameTo: String): Boolean { + private fun isNeedUpdate(currentName: String, updateName: String): Boolean { fun String.toVersionCode(): Int { return replace( regex = Regex("0\\d"), @@ -363,15 +367,17 @@ class MainViewModel @Inject constructor( "alpha", "beta", "rc" ) - val tagVC = nameTo.toVersionCode() - val buildVC = nameFrom.toVersionCode() - return if (betaList.all { it !in nameTo }) { - tagVC > buildVC - } else { - if (settingsState.allowBetas || betaList.any { it in nameFrom }) { - tagVC > buildVC - } else false - } + val updateVersionCode = updateName.toVersionCode() + val currentVersionCode = currentName.toVersionCode() + return if (!updateName.startsWith(currentName)) { + if (betaList.all { it !in updateName }) { + updateVersionCode > currentVersionCode + } else { + if (settingsState.allowBetas || betaList.any { it in currentName }) { + updateVersionCode > currentVersionCode + } else false + } + } else false } fun hideSelectDialog() { diff --git a/app/src/market/java/ru/tech/imageresizershrinker/presentation/main_screen/components/UpdateSheet.kt b/app/src/market/java/ru/tech/imageresizershrinker/presentation/main_screen/components/UpdateSheet.kt index 9dfce5b84c..0d57e50caa 100644 --- a/app/src/market/java/ru/tech/imageresizershrinker/presentation/main_screen/components/UpdateSheet.kt +++ b/app/src/market/java/ru/tech/imageresizershrinker/presentation/main_screen/components/UpdateSheet.kt @@ -108,7 +108,11 @@ fun UpdateSheet(changelog: String, tag: String, visible: MutableState) verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { - Column(Modifier.verticalScroll(rememberScrollState())) { + Column( + modifier = Modifier + .fillMaxWidth() + .verticalScroll(rememberScrollState()) + ) { HtmlText( html = changelog.trimIndent(), modifier = Modifier.padding( diff --git a/build.gradle.kts b/build.gradle.kts index 87360a1fe7..8c488cece4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:8.1.3") + classpath("com.android.tools.build:gradle:8.1.4") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10") classpath("com.google.dagger:hilt-android-gradle-plugin:2.49") classpath("com.google.gms:google-services:4.4.0")