Skip to content

Commit

Permalink
2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Dec 3, 2023
1 parent 4d3f778 commit 8bdaafe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"),
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ fun UpdateSheet(changelog: String, tag: String, visible: MutableState<Boolean>)
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Column(Modifier.verticalScroll(rememberScrollState())) {
Column(
modifier = Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState())
) {
HtmlText(
html = changelog.trimIndent(),
modifier = Modifier.padding(
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8bdaafe

Please sign in to comment.