From 63b29894f36c1b7faebb7d949259d4e3fbec0e02 Mon Sep 17 00:00:00 2001 From: bram Date: Sat, 1 Mar 2025 18:56:51 -0800 Subject: [PATCH] V9.1.0 release prep --- CHANGELOG.md | 5 +++++ README.md | 2 ++ example/integration_test/load_test.dart | 1 - lib/src/file_downloader.dart | 6 ++++++ pubspec.yaml | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c632294..ed8dadf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 9.1.0 +* Adds `pauseAll`, `cancelAll` and `resumeAll` +* Improves handling `enqueuAll` to not starve the UI thread +* Fixes compilation bug in when compiling with XCode 16.2 + ## 9.0.0 * Introduces URI operations, including file/photo/video/directory pickers, under the `uri` property, and `UriDownloadTask` and `UriUploadTask`. See [Working with URIs](doc/URI.md). * [Breaking] removes references to `asAndroidUri` - use the new methods on the `uri` property instead diff --git a/README.md b/README.md index b9f0602..151513d 100644 --- a/README.md +++ b/README.md @@ -743,6 +743,8 @@ Parallel downloads do not support the use of URIs. To enable pausing, set the `allowPause` field of the `Task` to `true`. This may also cause the task to `pause` un-commanded. For example, the OS may choose to pause the task if someone walks out of WiFi coverage. To cancel, pause or resume a task, call: +* `cancel` to cancel a task +* `cancelAll` to cancel all tasks currently running, a specific list of tasks, or all tasks in a `group`. * `cancelTaskWithId` to cancel the tasks with that taskId * `cancelTasksWithIds` to cancel all tasks with a `taskId` in the provided list of taskIds * `pause` to attempt to pause a task. Pausing is only possible for download GET requests, only if the `Task.allowPause` field is true, and only if the server supports pause/resume. Soon after the task is running (`TaskStatus.running`) you can call `taskCanResume` which will return a Future that resolves to `true` if the server appears capable of pause & resume. If it is not, then `pause` will have no effect and return false diff --git a/example/integration_test/load_test.dart b/example/integration_test/load_test.dart index a8c9c2d..e458bee 100644 --- a/example/integration_test/load_test.dart +++ b/example/integration_test/load_test.dart @@ -1,7 +1,6 @@ // ignore_for_file: avoid_print, empty_catches import 'dart:io'; -import 'dart:math'; import 'package:background_downloader/background_downloader.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/lib/src/file_downloader.dart b/lib/src/file_downloader.dart index 0db0df5..c288577 100644 --- a/lib/src/file_downloader.dart +++ b/lib/src/file_downloader.dart @@ -500,6 +500,12 @@ interface class FileDownloader { /// the registered callback, if requested Future cancelTaskWithId(String taskId) => cancelTasksWithIds([taskId]); + /// Cancel this task + /// + /// The task will emit a [TaskStatus.canceled] update to + /// the registered callback, if requested + Future cancel(Task task) => cancelTasksWithIds([task.taskId]); + /// Cancels all tasks, or those in [tasks], or all tasks in group [group] /// /// Returns true if all cancellations were successful diff --git a/pubspec.yaml b/pubspec.yaml index 25c928e..18a6e5c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: background_downloader description: A multi-platform background file downloader and uploader. Define the task, enqueue and monitor progress -version: 9.0.0 +version: 9.1.0 repository: https://github.com/781flyingdutchman/background_downloader environment: