Reverse changes related to App ID changes (#270)

This commit is contained in:
Imran Remtulla
2023-02-12 14:36:54 -05:00
parent 1be38d361f
commit fd9aebc5b2
10 changed files with 16 additions and 3 deletions

View File

@@ -44,6 +44,10 @@ class DowngradeError extends ObtainiumError {
DowngradeError() : super(tr('cantInstallOlderVersion'));
}
class IDChangedError extends ObtainiumError {
IDChangedError() : super(tr('appIdMismatch'));
}
class NotImplementedError extends ObtainiumError {
NotImplementedError() : super(tr('functionNotImplemented'));
}

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.10.8';
const String currentVersion = '0.10.9';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

View File

@@ -179,9 +179,12 @@ class AppsProvider with ChangeNotifier {
}
}
// If the APK package ID is different from the App ID, it is either new (using a placeholder ID) or the ID has changed
// In either case, the app should be given the new ID
// The former case should be handled (give the App its real ID), the latter is a security issue
var newInfo = await PackageArchiveInfo.fromPath(downloadedFile.path);
if (app.id != newInfo.packageName) {
if (apps[app.id] != null && !SourceProvider().isTempId(app.id)) {
throw IDChangedError();
}
var originalAppId = app.id;
app.id = newInfo.packageName;
downloadedFile = downloadedFile.renameSync(