6.3.2 - Fix - 检查更新时无法获取版本信息
This commit is contained in:
@@ -33,21 +33,16 @@ class VersionInfo : ExtendedVersionInfo {
|
||||
val versionNameKey = str(R.string.property_key_app_version_name)
|
||||
val versionCodeKey = str(R.string.property_key_app_version_code)
|
||||
|
||||
val regexVersionName = "$versionNameKey(</\\w+>)?=.+".toRegex()
|
||||
val regexVersionCode = "$versionCodeKey(</\\w+>)?=.+".toRegex()
|
||||
val regexVersionName = "$versionNameKey(?:</\\w+>)?=([\\w.]+)".toRegex()
|
||||
val regexVersionCode = "$versionCodeKey(?:</\\w+>)?=(\\d+)".toRegex()
|
||||
|
||||
for (string in propertiesFileRawString.split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) {
|
||||
for (string in propertiesFileRawString.split("\\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) {
|
||||
if (versionName.isEmpty() && string.contains(regexVersionName)) {
|
||||
string.split("$versionNameKey(</\\w+>)?=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
|
||||
.replace("<.+?>".toRegex(), "")
|
||||
.takeIf { it.isNotEmpty() }?.let { versionName = it }
|
||||
versionName = regexVersionName.find(string)?.groupValues?.get(1) ?: ""
|
||||
Log.d(TAG, "versionName: $versionName")
|
||||
}
|
||||
if (versionCode <= 0 && string.contains(regexVersionCode)) {
|
||||
string.split("$versionCodeKey(</\\w+>)?=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
|
||||
.replace("<.+?>".toRegex(), "")
|
||||
.toInt()
|
||||
.takeIf { it > 0 }?.let { versionCode = it }
|
||||
versionCode = regexVersionCode.find(string)?.groupValues?.get(1)?.toInt() ?: -1
|
||||
Log.d(TAG, "versionCode: $versionCode")
|
||||
}
|
||||
if (versionName.isNotEmpty() && versionCode > 0) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Fri Jul 07 00:40:51 CST 2023
|
||||
BUILD_TIME=1688661651706
|
||||
#Fri Jul 07 01:39:02 CST 2023
|
||||
BUILD_TIME=1688665142214
|
||||
COMPILE_SDK_VERSION=33
|
||||
JAVA_VERSION=20
|
||||
MIN_SDK_VERSION=24
|
||||
TARGET_SDK_VERSION=33
|
||||
VERSION_BUILD=1997
|
||||
VERSION_BUILD=1999
|
||||
VERSION_NAME=6.3.2
|
||||
|
||||
Reference in New Issue
Block a user