Compare commits

...

2 Commits

Author SHA1 Message Date
a1518480db Updated build number 2022-12-07 20:43:35 -05:00
fd3ee02e52 Completely removed enhanced version detection 2022-12-07 20:36:14 -05:00
6 changed files with 36 additions and 54 deletions

View File

@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';
const String currentVersion = '0.8.5';
const String currentVersion = '0.8.6';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
@ -194,7 +194,6 @@ class _ObtainiumState extends State<Obtainium> {
['true'],
null,
false,
false,
false)
]);
}

View File

@ -114,7 +114,7 @@ class _AppPageState extends State<AppPage> {
height: 32,
),
Text(
'Last Update Check: ${app?.app.lastUpdateCheck == null ? 'Never' : '\n${app?.app.lastUpdateCheck?.toLocal()}'}${app?.app.enhancedVersionDetection == true ? '\n\nThis App has enhanced version detection.' : ''}',
'Last Update Check: ${app?.app.lastUpdateCheck == null ? 'Never' : '\n${app?.app.lastUpdateCheck?.toLocal()}'}',
textAlign: TextAlign.center,
style: const TextStyle(
fontStyle: FontStyle.italic, fontSize: 12),
@ -141,9 +141,7 @@ class _AppPageState extends State<AppPage> {
children: [
if (app?.app.installedVersion != null &&
app?.app.trackOnly == false &&
app?.app.installedVersion !=
app?.app.latestVersion &&
app?.app.enhancedVersionDetection != true)
app?.app.installedVersion != app?.app.latestVersion)
IconButton(
onPressed: app?.downloadProgress != null
? null

View File

@ -526,8 +526,8 @@ class AppsPageState extends State<AppsPage> {
.selectionClick();
appsProvider
.saveApps(selectedApps.map((a) {
if (a.installedVersion != null &&
!a.enhancedVersionDetection) {
if (a.installedVersion !=
null) {
a.installedVersion = a.latestVersion;
}
return a;

View File

@ -9,6 +9,7 @@ import 'package:device_info_plus/device_info_plus.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:install_plugin_v2/install_plugin_v2.dart';
import 'package:installed_apps/app_info.dart';
import 'package:installed_apps/installed_apps.dart';
@ -400,9 +401,9 @@ class AppsProvider with ChangeNotifier {
}
// If the App says it is installed but installedInfo is null, set it to not installed
// If the App says is is not installed but installedInfo exists, set it to the real installed version
// If the internal version does not match the real one, sync them if the App supports enhanced version detection
// Enhanced version detection will be true if the version extracted from source matches the standard version format
// If the App says is is not installed but installedInfo exists, try to set it to installed as latest version...
// ...if the latestVersion seems to match the version in installedInfo (not guaranteed)
// If that fails, just set it to the actual version string (all we can do at that point)
// Don't save changes, just return the object if changes were made (else null)
// If in a background isolate, return null straight away as the required plugin won't work anyways
App? getCorrectedInstallStatusAppIfPossible(App app, AppInfo? installedInfo) {
@ -415,22 +416,30 @@ class AppsProvider with ChangeNotifier {
!app.trackOnly) {
app.installedVersion = null;
modded = true;
} else if (installedInfo != null && app.installedVersion == null) {
if (app.enhancedVersionDetection) {
app.installedVersion = installedInfo.versionName;
}
if (installedInfo != null && app.installedVersion == null) {
if (app.latestVersion.characters
.where((p0) => [
// TODO: Won't work for other charsets
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'.'
].contains(p0))
.join('') ==
installedInfo.versionName) {
app.installedVersion = app.latestVersion;
} else {
if (app.latestVersion.contains(installedInfo.versionName!)) {
app.installedVersion = app.latestVersion;
} else {
app.installedVersion = installedInfo.versionName;
}
app.installedVersion = installedInfo.versionName;
}
modded = true;
} else if (installedInfo?.versionName != app.installedVersion &&
app.enhancedVersionDetection &&
!app.trackOnly) {
app.installedVersion = installedInfo?.versionName;
modded = true;
}
return modded ? app : null;
}

View File

@ -27,15 +27,9 @@ class AppNames {
class APKDetails {
late String version;
late String versionFromSource;
late bool isStandardVersion;
late List<String> apkUrls;
APKDetails(this.versionFromSource, this.apkUrls) {
var temp = extractStandardVersionName(versionFromSource);
isStandardVersion = temp != null;
version = temp ?? versionFromSource;
}
APKDetails(this.version, this.apkUrls);
}
class App {
@ -51,7 +45,6 @@ class App {
late DateTime? lastUpdateCheck;
bool pinned = false;
bool trackOnly = false;
bool enhancedVersionDetection = false;
App(
this.id,
this.url,
@ -64,8 +57,7 @@ class App {
this.additionalData,
this.lastUpdateCheck,
this.pinned,
this.trackOnly,
this.enhancedVersionDetection);
this.trackOnly);
@override
String toString() {
@ -94,8 +86,7 @@ class App {
? null
: DateTime.fromMicrosecondsSinceEpoch(json['lastUpdateCheck']),
json['pinned'] ?? false,
json['trackOnly'] ?? false,
json['enhancedVersionDetection'] ?? false);
json['trackOnly'] ?? false);
Map<String, dynamic> toJson() => {
'id': id,
@ -109,8 +100,7 @@ class App {
'additionalData': jsonEncode(additionalData),
'lastUpdateCheck': lastUpdateCheck?.microsecondsSinceEpoch,
'pinned': pinned,
'trackOnly': trackOnly,
'enhancedVersionDetection': enhancedVersionDetection
'trackOnly': trackOnly
};
}
@ -200,13 +190,6 @@ ObtainiumError getObtainiumHttpError(Response res) {
tr('errorWithHttpStatusCode', args: [res.statusCode.toString()]));
}
String? extractStandardVersionName(String version, {bool strict = false}) {
var match =
RegExp('${strict ? '^' : ''}[0-9]+(\\.[0-9]+)+${strict ? '\$' : ''}')
.firstMatch(version);
return match != null ? version.substring(match.start, match.end) : null;
}
abstract class MassAppUrlSource {
late String name;
late List<String> requiredArgs;
@ -285,12 +268,6 @@ class SourceProvider {
if (apk.apkUrls.isEmpty && !trackOnly) {
throw NoAPKError();
}
bool enhancedVersionDetection = apk.isStandardVersion &&
installedVersion != null &&
extractStandardVersionName(installedVersion, strict: true) != null;
if (!enhancedVersionDetection) {
apk.version = apk.versionFromSource;
}
String apkVersion = apk.version.replaceAll('/', '-');
return App(
id ??
@ -308,8 +285,7 @@ class SourceProvider {
additionalData,
DateTime.now(),
pinned,
trackOnly,
enhancedVersionDetection);
trackOnly);
}
// Returns errors in [results, errors] instead of throwing them

View File

@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.8.5+68 # When changing this, update the tag in main() accordingly
version: 0.8.5+69 # When changing this, update the tag in main() accordingly
environment:
sdk: '>=2.18.2 <3.0.0'