fix(Updater): is release build check
This commit is contained in:
parent
197bb84c21
commit
2aab80dd96
5 changed files with 5 additions and 15 deletions
|
|
@ -8,6 +8,7 @@ plugins {
|
|||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
val isRelease = System.getenv("RELEASE")?.toBoolean() ?: false
|
||||
val gitCurrentBranch = providers.execIgnoreCode("git", "symbolic-ref", "--quiet", "--short", "HEAD").takeIf { it.isNotEmpty() }
|
||||
val gitLatestCommit = providers.execIgnoreCode("git", "rev-parse", "--short", "HEAD")
|
||||
val gitHasLocalCommits = gitCurrentBranch?.let { providers.execIgnoreCode("git", "log", "origin/$gitCurrentBranch..HEAD").isNotEmpty() } ?: false
|
||||
|
|
@ -32,6 +33,7 @@ android {
|
|||
|
||||
buildConfigField("String", "BACKEND_URL", "\"https://aliucord.com/\"")
|
||||
|
||||
buildConfigField("Boolean", "RELEASE", isRelease.toString())
|
||||
buildConfigField("String", "GIT_BRANCH", "\"$gitCurrentBranch\"")
|
||||
buildConfigField("String", "GIT_COMMIT", "\"$gitLatestCommit\"")
|
||||
buildConfigField("boolean", "GIT_LOCAL_COMMITS", "$gitHasLocalCommits")
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import com.aliucord.manager.ui.components.dialogs.StoragePermissionsDialog
|
|||
import com.aliucord.manager.ui.screens.home.HomeScreen
|
||||
import com.aliucord.manager.ui.theme.ManagerTheme
|
||||
import com.aliucord.manager.ui.widgets.updater.UpdaterDialog
|
||||
import com.aliucord.manager.util.IS_CUSTOM_BUILD
|
||||
import com.aliucord.manager.util.back
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ class MainActivity : ComponentActivity() {
|
|||
theme = preferences.theme,
|
||||
dynamicColor = preferences.dynamicColor,
|
||||
) {
|
||||
if (!IS_CUSTOM_BUILD) {
|
||||
if (BuildConfig.RELEASE) {
|
||||
UpdaterDialog()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.aliucord.manager.patcher.steps.StepGroup
|
|||
import com.aliucord.manager.patcher.steps.base.Step
|
||||
import com.aliucord.manager.patcher.steps.download.*
|
||||
import com.aliucord.manager.ui.screens.patchopts.PatchOptions
|
||||
import com.aliucord.manager.util.IS_CUSTOM_BUILD
|
||||
import com.github.diamondminer88.zip.ZipWriter
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.koin.core.component.KoinComponent
|
||||
|
|
@ -34,7 +33,7 @@ class SaveMetadataStep(private val options: PatchOptions) : Step(), KoinComponen
|
|||
|
||||
val metadata = InstallMetadata(
|
||||
options = options,
|
||||
customManager = IS_CUSTOM_BUILD,
|
||||
customManager = !BuildConfig.RELEASE,
|
||||
managerVersion = SemVer.parse(BuildConfig.VERSION_NAME),
|
||||
aliuhookVersion = aliuhook.targetVersion,
|
||||
injectorVersion = injector.targetVersion,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class SettingsModel(
|
|||
Aliucord Manager
|
||||
Version: ${BuildConfig.VERSION_NAME}
|
||||
Version Code: ${BuildConfig.VERSION_CODE}
|
||||
Release: ${if (BuildConfig.RELEASE) "Yes" else "No"}
|
||||
Git Branch: ${BuildConfig.GIT_BRANCH}
|
||||
Git Commit: ${BuildConfig.GIT_COMMIT}
|
||||
Git Changes: ${if (BuildConfig.GIT_LOCAL_CHANGES) "Yes" else "No"}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.aliucord.manager.util
|
|||
|
||||
import android.os.Build
|
||||
import androidx.collection.ObjectList
|
||||
import com.aliucord.manager.BuildConfig
|
||||
import java.io.BufferedReader
|
||||
import java.io.IOException
|
||||
import kotlin.math.pow
|
||||
|
|
@ -25,16 +24,6 @@ inline fun <E> ObjectList<E>.find(block: (E) -> Boolean): E? {
|
|||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this manager build is not an official release.
|
||||
*/
|
||||
@Suppress("KotlinConstantConditions", "SimplifyBooleanWithConstants")
|
||||
val IS_CUSTOM_BUILD by lazy {
|
||||
BuildConfig.GIT_BRANCH != "release"
|
||||
|| BuildConfig.GIT_LOCAL_CHANGES
|
||||
|| BuildConfig.GIT_LOCAL_COMMITS
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this device is most likely an emulator.
|
||||
* src: https://stackoverflow.com/a/21505193/13964629
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue