mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-14 02:48:10 +02:00
Bugfix for installing apps with ID change step (#1424)
This commit is contained in:
@@ -717,7 +717,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
appsToInstall =
|
appsToInstall =
|
||||||
moveStrToEnd(appsToInstall, obtainiumId, strB: obtainiumTempId);
|
moveStrToEnd(appsToInstall, obtainiumId, strB: obtainiumTempId);
|
||||||
|
|
||||||
Future<void> updateFn(String id, {bool skipInstalls = false}) async {
|
Future<String> updateFn(String id, {bool skipInstalls = false}) async {
|
||||||
try {
|
try {
|
||||||
var downloadedArtifact =
|
var downloadedArtifact =
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
@@ -730,8 +730,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
} else {
|
} else {
|
||||||
downloadedDir = downloadedArtifact as DownloadedXApkDir;
|
downloadedDir = downloadedArtifact as DownloadedXApkDir;
|
||||||
}
|
}
|
||||||
var appId = downloadedFile?.appId ?? downloadedDir!.appId;
|
id = downloadedFile?.appId ?? downloadedDir!.appId;
|
||||||
bool willBeSilent = await canInstallSilently(apps[appId]!.app);
|
bool willBeSilent = await canInstallSilently(apps[id]!.app);
|
||||||
switch (settingsProvider.installMethod) {
|
switch (settingsProvider.installMethod) {
|
||||||
case InstallMethodSettings.normal:
|
case InstallMethodSettings.normal:
|
||||||
if (!(await settingsProvider.getInstallPermission(
|
if (!(await settingsProvider.getInstallPermission(
|
||||||
@@ -773,18 +773,19 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
if (willBeSilent && context == null) {
|
if (willBeSilent && context == null) {
|
||||||
notificationsProvider?.notify(SilentUpdateAttemptNotification(
|
notificationsProvider?.notify(SilentUpdateAttemptNotification(
|
||||||
[apps[appId]!.app],
|
[apps[id]!.app],
|
||||||
id: appId.hashCode));
|
id: id.hashCode));
|
||||||
}
|
}
|
||||||
|
installedIds.add(id);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
apps[id]?.downloadProgress = null;
|
apps[id]?.downloadProgress = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
installedIds.add(id);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errors.add(id, e, appName: apps[id]?.name);
|
errors.add(id, e, appName: apps[id]?.name);
|
||||||
}
|
}
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forceParallelDownloads || !settingsProvider.parallelDownloads) {
|
if (forceParallelDownloads || !settingsProvider.parallelDownloads) {
|
||||||
@@ -792,9 +793,9 @@ class AppsProvider with ChangeNotifier {
|
|||||||
await updateFn(id);
|
await updateFn(id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await Future.wait(
|
List<String> ids = await Future.wait(
|
||||||
appsToInstall.map((id) => updateFn(id, skipInstalls: true)));
|
appsToInstall.map((id) => updateFn(id, skipInstalls: true)));
|
||||||
for (var id in appsToInstall) {
|
for (var id in ids) {
|
||||||
if (!errors.appIdNames.containsKey(id)) {
|
if (!errors.appIdNames.containsKey(id)) {
|
||||||
await updateFn(id);
|
await updateFn(id);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user