diff --git a/app/build.gradle b/app/build.gradle index 822f9ae89..dad63da03 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,8 +25,8 @@ android { applicationId "net.xzos.upgradeall" minSdkVersion 21 targetSdkVersion 30 - versionCode 51 - versionName "0.1.4.24" + versionCode 52 + versionName "0.1.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" kapt { arguments { diff --git a/core/src/main/java/net/xzos/upgradeall/core/data/config/AppConfig.kt b/core/src/main/java/net/xzos/upgradeall/core/data/config/AppConfig.kt index 94947b480..6eb7efdad 100644 --- a/core/src/main/java/net/xzos/upgradeall/core/data/config/AppConfig.kt +++ b/core/src/main/java/net/xzos/upgradeall/core/data/config/AppConfig.kt @@ -18,5 +18,6 @@ object AppValue { const val default_cloud_rules_hub_url = "FromUpdateServer" const val def_update_server_url = "update-server.xzos.net:5255" val git_url_arg_regex = "(%.*?)\\w*".toRegex() - val version_number_match_regex = "(\\d+(\\.\\d+)*)(([.|\\-|+|_| ]|[0-9A-Za-z])*)".toRegex() + val version_number_strict_match_regex = "\\d+(\\.\\d+)+([.|\\-|+|_| ]*[A-Za-z0-9]+)*".toRegex() + val version_number_match_regex = "\\d+(\\.\\d+)*([.|\\-|+|_| ]*[A-Za-z0-9]+)*".toRegex() } diff --git a/core/src/main/java/net/xzos/upgradeall/core/data_manager/utils/VersioningUtils.kt b/core/src/main/java/net/xzos/upgradeall/core/data_manager/utils/VersioningUtils.kt index 4943e10da..9573ecec2 100644 --- a/core/src/main/java/net/xzos/upgradeall/core/data_manager/utils/VersioningUtils.kt +++ b/core/src/main/java/net/xzos/upgradeall/core/data_manager/utils/VersioningUtils.kt @@ -1,6 +1,7 @@ package net.xzos.upgradeall.core.data_manager.utils -import net.xzos.upgradeall.core.data.config.AppValue +import net.xzos.upgradeall.core.data.config.AppValue.version_number_match_regex +import net.xzos.upgradeall.core.data.config.AppValue.version_number_strict_match_regex import net.xzos.upgradeall.core.data.json.nongson.ObjectTag import org.apache.maven.artifact.versioning.DefaultArtifactVersion @@ -14,8 +15,8 @@ object VersioningUtils { fun matchVersioningString(versionString: CharSequence?): String? { return if (versionString != null) { - val regex = AppValue.version_number_match_regex - regex.find(versionString)?.value?.trim() + (version_number_strict_match_regex.find(versionString) + ?: version_number_match_regex.find(versionString))?.value } else null } @@ -24,7 +25,7 @@ object VersioningUtils { * 若,前者比后者大,则返回 true * 若,版本号不是语义化版本号,返回 NULL */ - internal fun compareVersionNumber(versionNumber0: String?, versionNumber1: String?): Boolean? { + fun compareVersionNumber(versionNumber0: String?, versionNumber1: String?): Boolean? { // 检查强制忽略版本号 if (versionNumber0 == FOREVER_IGNORE) return true if (versionNumber1 == FOREVER_IGNORE) return false