fix(mobile): cancel share download when dialog is dismissed (#25466)

* fix(mobile): cancel share download when dialog is dismissed

* refactor: centralize temporary file cleanup logic

* refactor: replace `CancellationToken` with `Completer<void>` for asset sharing cancellation

---------

Co-authored-by: cmdpromptcritical <cmdpromptcritical@github.com>
This commit is contained in:
cmdPromptCritical
2026-02-05 14:08:35 -05:00
committed by GitHub
parent 9d8efe2685
commit ad9f3cfa05
4 changed files with 53 additions and 20 deletions
@@ -405,11 +405,15 @@ class ActionNotifier extends Notifier<void> {
}
}
Future<ActionResult> shareAssets(ActionSource source, BuildContext context) async {
Future<ActionResult> shareAssets(
ActionSource source,
BuildContext context, {
Completer<void>? cancelCompleter,
}) async {
final ids = _getAssets(source).toList(growable: false);
try {
await _service.shareAssets(ids, context);
await _service.shareAssets(ids, context, cancelCompleter: cancelCompleter);
return ActionResult(count: ids.length, success: true);
} catch (error, stack) {
_logger.severe('Failed to share assets', error, stack);