mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-28 16:59:30 +02:00
Enhanced ver. detection bugfix
This commit is contained in:
@@ -30,12 +30,10 @@ class APKDetails {
|
|||||||
late List<String> apkUrls;
|
late List<String> apkUrls;
|
||||||
late bool isStandardVersionName;
|
late bool isStandardVersionName;
|
||||||
|
|
||||||
APKDetails(this.version, this.apkUrls) {
|
APKDetails(version, this.apkUrls) {
|
||||||
var standardVersion = extractStandardVersionName(version);
|
var standardVersion = extractStandardVersionName(version);
|
||||||
isStandardVersionName = standardVersion != null;
|
isStandardVersionName = standardVersion != null;
|
||||||
if (isStandardVersionName) {
|
this.version = standardVersion ?? version;
|
||||||
version = standardVersion!;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,8 +199,10 @@ ObtainiumError getObtainiumHttpError(Response res) {
|
|||||||
tr('errorWithHttpStatusCode', args: [res.statusCode.toString()]));
|
tr('errorWithHttpStatusCode', args: [res.statusCode.toString()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
String? extractStandardVersionName(String version) {
|
String? extractStandardVersionName(String version, {bool strict = false}) {
|
||||||
var match = RegExp('[0-9]+(\\.[0-9]+)*').firstMatch(version);
|
var match = RegExp(
|
||||||
|
'${strict ? '^' : ''}[0-9]+(\\.[0-9]+)*(-(alpha|beta)\\+?[0-9]+)?${strict ? '\$' : ''}')
|
||||||
|
.firstMatch(version);
|
||||||
return match != null ? version.substring(match.start, match.end) : null;
|
return match != null ? version.substring(match.start, match.end) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +302,10 @@ class SourceProvider {
|
|||||||
DateTime.now(),
|
DateTime.now(),
|
||||||
pinned,
|
pinned,
|
||||||
trackOnly,
|
trackOnly,
|
||||||
apk.isStandardVersionName);
|
apk.isStandardVersionName &&
|
||||||
|
(installedVersion == null ||
|
||||||
|
extractStandardVersionName(installedVersion, strict: true) !=
|
||||||
|
null));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns errors in [results, errors] instead of throwing them
|
// Returns errors in [results, errors] instead of throwing them
|
||||||
|
Reference in New Issue
Block a user