fix: show "preparing" when sharing in beta timeline (#21390)

* fix: show "preparing" when sharing in beta timeline

* embed dialog inside of share_action_button

* dont await the share sheet so "preparing" dialog disappears once share sheet presents

this mimics old timeline behavior

* chore: lint
This commit is contained in:
Brandon Wees
2025-08-30 13:51:32 -05:00
committed by GitHub
parent aacb27ea5f
commit 32955915dd
3 changed files with 59 additions and 31 deletions
@@ -104,15 +104,18 @@ class AssetMediaRepository {
return 0;
}
final result = await Share.shareXFiles(downloadedXFiles);
for (var file in downloadedXFiles) {
try {
await File(file.path).delete();
} catch (e) {
_log.warning("Failed to delete temporary file: ${file.path}", e);
// we dont want to await the share result since the
// "preparing" dialog will not disappear unti
Share.shareXFiles(downloadedXFiles).then((result) async {
for (var file in downloadedXFiles) {
try {
await File(file.path).delete();
} catch (e) {
_log.warning("Failed to delete temporary file: ${file.path}", e);
}
}
}
return result.status == ShareResultStatus.success ? downloadedXFiles.length : 0;
});
return downloadedXFiles.length;
}
}