mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-25 20:03:44 +02:00 
			
		
		
		
	Correctly report and auto-delete bad APKs (#1251)
This commit is contained in:
		| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Obrni regularni izraz", |     "invertRegEx": "Obrni regularni izraz", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Želite li ukloniti aplikaciju?", |         "one": "Želite li ukloniti aplikaciju?", | ||||||
|         "other": "Želite li ukloniti aplikacije?" |         "other": "Želite li ukloniti aplikacije?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Invertovat regulární výraz", |     "invertRegEx": "Invertovat regulární výraz", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Odstranit Apku?", |         "one": "Odstranit Apku?", | ||||||
|         "other": "Odstranit Apky?" |         "other": "Odstranit Apky?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Regulären Ausdruck  invertieren", |     "invertRegEx": "Regulären Ausdruck  invertieren", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "App entfernen?", |         "one": "App entfernen?", | ||||||
|         "other": "Apps entfernen?" |         "other": "Apps entfernen?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Invert regular expression", |     "invertRegEx": "Invert regular expression", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Remove App?", |         "one": "Remove App?", | ||||||
|         "other": "Remove Apps?" |         "other": "Remove Apps?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Invertir expresión regular", |     "invertRegEx": "Invertir expresión regular", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "¿Eliminar Aplicación?", |         "one": "¿Eliminar Aplicación?", | ||||||
|         "other": "¿Eliminar Aplicaciones?" |         "other": "¿Eliminar Aplicaciones?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "معکوس کردن عبارت منظم", |     "invertRegEx": "معکوس کردن عبارت منظم", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "برنامه حذف شود؟", |         "one": "برنامه حذف شود؟", | ||||||
|         "other": "برنامه ها حذف شوند؟" |         "other": "برنامه ها حذف شوند؟" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Inverser l'expression régulière", |     "invertRegEx": "Inverser l'expression régulière", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Supprimer l'application ?", |         "one": "Supprimer l'application ?", | ||||||
|         "other": "Supprimer les applications ?" |         "other": "Supprimer les applications ?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Invertált reguláris kifejezés", |     "invertRegEx": "Invertált reguláris kifejezés", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Eltávolítja az alkalmazást?", |         "one": "Eltávolítja az alkalmazást?", | ||||||
|         "other": "Eltávolítja az alkalmazást?" |         "other": "Eltávolítja az alkalmazást?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Inverti espressione regolare", |     "invertRegEx": "Inverti espressione regolare", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Rimuovere l'app?", |         "one": "Rimuovere l'app?", | ||||||
|         "other": "Rimuovere le app?" |         "other": "Rimuovere le app?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "正規表現を反転", |     "invertRegEx": "正規表現を反転", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "アプリを削除しますか?", |         "one": "アプリを削除しますか?", | ||||||
|         "other": "アプリを削除しますか?" |         "other": "アプリを削除しますか?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Reguliere expressie omkeren", |     "invertRegEx": "Reguliere expressie omkeren", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "App verwijderen?", |         "one": "App verwijderen?", | ||||||
|         "other": "Apps verwijderen?" |         "other": "Apps verwijderen?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Odwróć wyrażenie regularne", |     "invertRegEx": "Odwróć wyrażenie regularne", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Usunąć aplikację?", |         "one": "Usunąć aplikację?", | ||||||
|         "few": "Usunąć aplikacje?", |         "few": "Usunąć aplikacje?", | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Inverter expressão regular", |     "invertRegEx": "Inverter expressão regular", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Remover aplicativo?", |         "one": "Remover aplicativo?", | ||||||
|         "other": "Remover aplicativos?" |         "other": "Remover aplicativos?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Инвертировать регулярное выражение", |     "invertRegEx": "Инвертировать регулярное выражение", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Удалить приложение?", |         "one": "Удалить приложение?", | ||||||
|         "other": "Удалить приложения?" |         "other": "Удалить приложения?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Invertera reguljärt uttryck", |     "invertRegEx": "Invertera reguljärt uttryck", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Ta Bort App?", |         "one": "Ta Bort App?", | ||||||
|         "other": "Ta Bort Appar?" |         "other": "Ta Bort Appar?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Normal ifadeyi ters çevir", |     "invertRegEx": "Normal ifadeyi ters çevir", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Uygulamayı Kaldır?", |         "one": "Uygulamayı Kaldır?", | ||||||
|         "other": "Uygulamaları Kaldır?" |         "other": "Uygulamaları Kaldır?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "Đảo ngược biểu thức chính quy", |     "invertRegEx": "Đảo ngược biểu thức chính quy", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Gỡ ứng dụng?", |         "one": "Gỡ ứng dụng?", | ||||||
|         "other": "Gỡ ứng dụng?" |         "other": "Gỡ ứng dụng?" | ||||||
|   | |||||||
| @@ -300,6 +300,7 @@ | |||||||
|     "invertRegEx": "反转正则表达式", |     "invertRegEx": "反转正则表达式", | ||||||
|     "note": "Note", |     "note": "Note", | ||||||
|     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", |     "selfHostedNote": "The \"{}\" dropdown can be used to reach self-hosted/custom instances of any source.", | ||||||
|  |     "badDownload": "The APK could not be parsed (incompatible or partial download)", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "是否删除应用?", |         "one": "是否删除应用?", | ||||||
|         "other": "是否删除应用?" |         "other": "是否删除应用?" | ||||||
|   | |||||||
| @@ -532,9 +532,18 @@ class AppsProvider with ChangeNotifier { | |||||||
|       {bool needsBGWorkaround = false}) async { |       {bool needsBGWorkaround = false}) async { | ||||||
|     var newInfo = |     var newInfo = | ||||||
|         await pm.getPackageArchiveInfo(archiveFilePath: file.file.path); |         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); |     PackageInfo? appInfo = await getInstalledInfo(apps[file.appId]!.app.id); | ||||||
|     if (appInfo != null && |     if (appInfo != null && | ||||||
|         newInfo!.versionCode! < appInfo.versionCode! && |         newInfo.versionCode! < appInfo.versionCode! && | ||||||
|         !(await canDowngradeApps())) { |         !(await canDowngradeApps())) { | ||||||
|       throw DowngradeError(); |       throw DowngradeError(); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user