mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-29 20:43:28 +01:00 
			
		
		
		
	Attempt additional fix for #201
This commit is contained in:
		| @@ -127,7 +127,8 @@ class _AddAppPageState extends State<AddAppPage> { | ||||
|             if (apkUrl == null) { | ||||
|               throw ObtainiumError(tr('cancelled')); | ||||
|             } | ||||
|             app.preferredApkIndex = app.apkUrls.indexOf(apkUrl); | ||||
|             app.preferredApkIndex = | ||||
|                 app.apkUrls.map((e) => e.value).toList().indexOf(apkUrl.value); | ||||
|             // ignore: use_build_context_synchronously | ||||
|             var downloadedApk = await appsProvider.downloadApp( | ||||
|                 app, globalNavigatorKey.currentContext); | ||||
|   | ||||
| @@ -304,7 +304,8 @@ class AppsProvider with ChangeNotifier { | ||||
|   Future<MapEntry<String, String>?> confirmApkUrl( | ||||
|       App app, BuildContext? context) async { | ||||
|     // If the App has more than one APK, the user should pick one (if context provided) | ||||
|     MapEntry<String, String>? apkUrl = app.apkUrls[app.preferredApkIndex]; | ||||
|     MapEntry<String, String>? apkUrl = | ||||
|         app.apkUrls[app.preferredApkIndex >= 0 ? app.preferredApkIndex : 0]; | ||||
|     // get device supported architecture | ||||
|     List<String> archs = (await DeviceInfoPlugin().androidInfo).supportedAbis; | ||||
|  | ||||
| @@ -365,8 +366,13 @@ class AppsProvider with ChangeNotifier { | ||||
|         apkUrl = await confirmApkUrl(apps[id]!.app, context); | ||||
|       } | ||||
|       if (apkUrl != null) { | ||||
|         int urlInd = apps[id]!.app.apkUrls.indexOf(apkUrl); | ||||
|         if (urlInd != apps[id]!.app.preferredApkIndex) { | ||||
|         int urlInd = apps[id]! | ||||
|             .app | ||||
|             .apkUrls | ||||
|             .map((e) => e.value) | ||||
|             .toList() | ||||
|             .indexOf(apkUrl.value); | ||||
|         if (urlInd >= 0 && urlInd != apps[id]!.app.preferredApkIndex) { | ||||
|           apps[id]!.app.preferredApkIndex = urlInd; | ||||
|           await saveApps([apps[id]!.app]); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user