@@ -1849,11 +1849,13 @@ class _ComposeBoxState extends State<ComposeBox> with PerAccountStoreAwareStateM
1849
1849
1850
1850
@override
1851
1851
void startEditInteraction (int messageId) async {
1852
- if (await _abortBecauseContentInputNotEmpty ()) return ;
1853
- if (! mounted) return ;
1852
+ final zulipLocalizations = ZulipLocalizations .of (context);
1853
+
1854
+ final abort = await _abortBecauseContentInputNotEmpty (
1855
+ dialogMessage: zulipLocalizations.discardDraftConfirmationDialogMessage);
1856
+ if (abort || ! mounted) return ;
1854
1857
1855
1858
final store = PerAccountStoreWidget .of (context);
1856
- final zulipLocalizations = ZulipLocalizations .of (context);
1857
1859
1858
1860
switch (store.getEditMessageErrorStatus (messageId)) {
1859
1861
case null :
@@ -1878,12 +1880,14 @@ class _ComposeBoxState extends State<ComposeBox> with PerAccountStoreAwareStateM
1878
1880
1879
1881
/// If there's text in the compose box, give a confirmation dialog
1880
1882
/// asking if it can be discarded and await the result.
1881
- Future <bool > _abortBecauseContentInputNotEmpty () async {
1883
+ Future <bool > _abortBecauseContentInputNotEmpty ({
1884
+ required String dialogMessage,
1885
+ }) async {
1882
1886
final zulipLocalizations = ZulipLocalizations .of (context);
1883
1887
if (controller.content.textNormalized.isNotEmpty) {
1884
1888
final dialog = showSuggestedActionDialog (context: context,
1885
1889
title: zulipLocalizations.discardDraftConfirmationDialogTitle,
1886
- message: zulipLocalizations.discardDraftConfirmationDialogMessage ,
1890
+ message: dialogMessage ,
1887
1891
// TODO(#1032) "destructive" style for action button
1888
1892
actionButtonText: zulipLocalizations.discardDraftConfirmationDialogConfirmButton);
1889
1893
if (await dialog.result != true ) return true ;
0 commit comments