mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-31 21:00:15 +02:00
Correctly report and auto-delete bad APKs (#1251)
This commit is contained in:
@@ -532,9 +532,18 @@ class AppsProvider with ChangeNotifier {
|
||||
{bool needsBGWorkaround = false}) async {
|
||||
var newInfo =
|
||||
await pm.getPackageArchiveInfo(archiveFilePath: file.file.path);
|
||||
if (newInfo == null) {
|
||||
try {
|
||||
file.file.deleteSync(recursive: true);
|
||||
} catch (e) {
|
||||
//
|
||||
} finally {
|
||||
throw ObtainiumError(tr('badDownload'));
|
||||
}
|
||||
}
|
||||
PackageInfo? appInfo = await getInstalledInfo(apps[file.appId]!.app.id);
|
||||
if (appInfo != null &&
|
||||
newInfo!.versionCode! < appInfo.versionCode! &&
|
||||
newInfo.versionCode! < appInfo.versionCode! &&
|
||||
!(await canDowngradeApps())) {
|
||||
throw DowngradeError();
|
||||
}
|
||||
|
Reference in New Issue
Block a user