mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-23 06:29:29 +02:00
Don't use partial downloads for BG tasks (more reliable)
This commit is contained in:
@@ -421,7 +421,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Object> downloadApp(App app, BuildContext? context,
|
Future<Object> downloadApp(App app, BuildContext? context,
|
||||||
{NotificationsProvider? notificationsProvider}) async {
|
{NotificationsProvider? notificationsProvider,
|
||||||
|
bool useExisting = true}) async {
|
||||||
var notifId = DownloadNotification(app.finalName, 0).id;
|
var notifId = DownloadNotification(app.finalName, 0).id;
|
||||||
if (apps[app.id] != null) {
|
if (apps[app.id] != null) {
|
||||||
apps[app.id]!.downloadProgress = 0;
|
apps[app.id]!.downloadProgress = 0;
|
||||||
@@ -453,7 +454,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
notificationsProvider?.notify(notif);
|
notificationsProvider?.notify(notif);
|
||||||
}
|
}
|
||||||
prevProg = prog;
|
prevProg = prog;
|
||||||
}, APKDir.path);
|
}, APKDir.path, useExisting: useExisting);
|
||||||
// Set to 90 for remaining steps, will make null in 'finally'
|
// Set to 90 for remaining steps, will make null in 'finally'
|
||||||
if (apps[app.id] != null) {
|
if (apps[app.id] != null) {
|
||||||
apps[app.id]!.downloadProgress = -1;
|
apps[app.id]!.downloadProgress = -1;
|
||||||
@@ -766,7 +767,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
Future<List<String>> downloadAndInstallLatestApps(
|
Future<List<String>> downloadAndInstallLatestApps(
|
||||||
List<String> appIds, BuildContext? context,
|
List<String> appIds, BuildContext? context,
|
||||||
{NotificationsProvider? notificationsProvider,
|
{NotificationsProvider? notificationsProvider,
|
||||||
bool forceParallelDownloads = false}) async {
|
bool forceParallelDownloads = false,
|
||||||
|
bool useExisting = true}) async {
|
||||||
notificationsProvider =
|
notificationsProvider =
|
||||||
notificationsProvider ?? context?.read<NotificationsProvider>();
|
notificationsProvider ?? context?.read<NotificationsProvider>();
|
||||||
List<String> appsToInstall = [];
|
List<String> appsToInstall = [];
|
||||||
@@ -823,7 +825,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
var downloadedArtifact =
|
var downloadedArtifact =
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
await downloadApp(apps[id]!.app, context,
|
await downloadApp(apps[id]!.app, context,
|
||||||
notificationsProvider: notificationsProvider);
|
notificationsProvider: notificationsProvider,
|
||||||
|
useExisting: useExisting);
|
||||||
DownloadedApk? downloadedFile;
|
DownloadedApk? downloadedFile;
|
||||||
DownloadedXApkDir? downloadedDir;
|
DownloadedXApkDir? downloadedDir;
|
||||||
if (downloadedArtifact is DownloadedApk) {
|
if (downloadedArtifact is DownloadedApk) {
|
||||||
@@ -1927,7 +1930,8 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
|||||||
await appsProvider.downloadAndInstallLatestApps(
|
await appsProvider.downloadAndInstallLatestApps(
|
||||||
toInstall.map((e) => e.key).toList(), null,
|
toInstall.map((e) => e.key).toList(), null,
|
||||||
notificationsProvider: notificationsProvider,
|
notificationsProvider: notificationsProvider,
|
||||||
forceParallelDownloads: true);
|
forceParallelDownloads: true,
|
||||||
|
useExisting: false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e is MultiAppMultiError) {
|
if (e is MultiAppMultiError) {
|
||||||
e.idsByErrorString.forEach((key, value) {
|
e.idsByErrorString.forEach((key, value) {
|
||||||
|
Reference in New Issue
Block a user