fixed pending share race error on warm app start

This commit is contained in:
2026-07-02 15:28:05 +02:00
parent 4bc7ffd37a
commit 32f7c311bc
9 changed files with 125 additions and 9 deletions
@@ -197,7 +197,7 @@ void _setExternalDraftAndOpenChat(
final settings = context.read<SettingsCubit>();
settings.val(write: true).talkSettings.drafts[room.token] = share.text!;
}
ShareIntentListener.instance.clear();
ShareIntentListener.instance.clear(ifCurrent: share);
_finishWithChat(context, room);
}
@@ -212,13 +212,18 @@ Future<void> _externalUploadFlow(
screen: FilesUploadDialog(
filePaths: share.filePaths,
remotePath: targetPath.join('/'),
onUploadFinished: (_) => _afterExternalUploaded(context, targetPath),
onUploadFinished: (_) =>
_afterExternalUploaded(context, targetPath, share),
),
);
}
void _afterExternalUploaded(BuildContext context, List<String> targetPath) {
ShareIntentListener.instance.clear();
void _afterExternalUploaded(
BuildContext context,
List<String> targetPath,
PendingShare share,
) {
ShareIntentListener.instance.clear(ifCurrent: share);
if (!context.mounted) return;
_finishWithFolder(context, targetPath);
}
@@ -40,7 +40,7 @@ class ShareTargetPage extends StatelessWidget {
@override
Widget build(BuildContext context) => PopScope(
onPopInvokedWithResult: (didPop, _) {
if (didPop) ShareIntentListener.instance.clear();
if (didPop) ShareIntentListener.instance.clear(ifCurrent: share);
},
child: Scaffold(
appBar: AppBar(title: Text(_appBarTitle())),