diff --git a/app/src/main/java/org/autojs/autojs/network/entity/VersionInfo.kt b/app/src/main/java/org/autojs/autojs/network/entity/VersionInfo.kt index b24acbbb..e95a34c2 100644 --- a/app/src/main/java/org/autojs/autojs/network/entity/VersionInfo.kt +++ b/app/src/main/java/org/autojs/autojs/network/entity/VersionInfo.kt @@ -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()?=.+".toRegex() - val regexVersionCode = "$versionCodeKey()?=.+".toRegex() + val regexVersionName = "$versionNameKey(?:)?=([\\w.]+)".toRegex() + val regexVersionCode = "$versionCodeKey(?:)?=(\\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()?=".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()?=".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) { diff --git a/version.properties b/version.properties index 58b9be30..a3ee7381 100644 --- a/version.properties +++ b/version.properties @@ -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