@@ -765,54 +765,6 @@ class StarButton extends MessageActionSheetMenuItemButton {
765
765
}
766
766
}
767
767
768
- /// Fetch and return the raw Markdown content for [messageId] ,
769
- /// showing an error dialog on failure.
770
- Future <String ?> fetchRawContentWithFeedback ({
771
- required BuildContext context,
772
- required int messageId,
773
- required String errorDialogTitle,
774
- }) async {
775
- Message ? fetchedMessage;
776
- String ? errorMessage;
777
- // TODO, supported by reusable code:
778
- // - (?) Retry with backoff on plausibly transient errors.
779
- // - If request(s) take(s) a long time, show snackbar with cancel
780
- // button, like "Still working on quote-and-reply…".
781
- // On final failure or success, auto-dismiss the snackbar.
782
- final zulipLocalizations = ZulipLocalizations .of (context);
783
- try {
784
- fetchedMessage = await getMessageCompat (PerAccountStoreWidget .of (context).connection,
785
- messageId: messageId,
786
- applyMarkdown: false ,
787
- );
788
- if (fetchedMessage == null ) {
789
- errorMessage = zulipLocalizations.errorMessageDoesNotSeemToExist;
790
- }
791
- } catch (e) {
792
- switch (e) {
793
- case ZulipApiException ():
794
- errorMessage = e.message;
795
- // TODO specific messages for common errors, like network errors
796
- // (support with reusable code)
797
- default :
798
- errorMessage = zulipLocalizations.errorCouldNotFetchMessageSource;
799
- }
800
- }
801
-
802
- if (! context.mounted) return null ;
803
-
804
- if (fetchedMessage == null ) {
805
- assert (errorMessage != null );
806
- // TODO(?) give no feedback on error conditions we expect to
807
- // flag centrally in event polling, like invalid auth,
808
- // user/realm deactivated. (Support with reusable code.)
809
- showErrorDialog (context: context,
810
- title: errorDialogTitle, message: errorMessage);
811
- }
812
-
813
- return fetchedMessage? .content;
814
- }
815
-
816
768
class QuoteAndReplyButton extends MessageActionSheetMenuItemButton {
817
769
QuoteAndReplyButton ({super .key, required super .message, required super .pageContext});
818
770
@@ -849,7 +801,7 @@ class QuoteAndReplyButton extends MessageActionSheetMenuItemButton {
849
801
message: message,
850
802
);
851
803
852
- final rawContent = await fetchRawContentWithFeedback (
804
+ final rawContent = await ZulipAction . fetchRawContentWithFeedback (
853
805
context: pageContext,
854
806
messageId: message.id,
855
807
errorDialogTitle: zulipLocalizations.errorQuotationFailed,
@@ -901,12 +853,13 @@ class CopyMessageTextButton extends MessageActionSheetMenuItemButton {
901
853
902
854
@override void onPressed () async {
903
855
// This action doesn't show request progress.
904
- // But hopefully it won't take long at all; and
905
- // fetchRawContentWithFeedback has a TODO for giving feedback if it does.
856
+ // But hopefully it won't take long at all,
857
+ // and [ZulipAction.fetchRawContentWithFeedback] has a TODO
858
+ // for giving feedback if it does.
906
859
907
860
final zulipLocalizations = ZulipLocalizations .of (pageContext);
908
861
909
- final rawContent = await fetchRawContentWithFeedback (
862
+ final rawContent = await ZulipAction . fetchRawContentWithFeedback (
910
863
context: pageContext,
911
864
messageId: message.id,
912
865
errorDialogTitle: zulipLocalizations.errorCopyingFailed,
@@ -973,7 +926,7 @@ class ShareButton extends MessageActionSheetMenuItemButton {
973
926
974
927
final zulipLocalizations = ZulipLocalizations .of (pageContext);
975
928
976
- final rawContent = await fetchRawContentWithFeedback (
929
+ final rawContent = await ZulipAction . fetchRawContentWithFeedback (
977
930
context: pageContext,
978
931
messageId: message.id,
979
932
errorDialogTitle: zulipLocalizations.errorSharingFailed,
0 commit comments