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