From 7683436fc590f0c76825ada5b04bf68e8567c548 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Wed, 9 Aug 2023 14:35:11 -0700 Subject: [PATCH] action_sheet: Have "Share" button share message's raw Markdown --- lib/widgets/action_sheet.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/widgets/action_sheet.dart b/lib/widgets/action_sheet.dart index 0019583883..af445b20e7 100644 --- a/lib/widgets/action_sheet.dart +++ b/lib/widgets/action_sheet.dart @@ -85,13 +85,22 @@ class ShareButton extends MessageActionSheetMenuItemButton { // share sheet. Navigator.of(context).pop(); + final rawContent = await fetchRawContentWithFeedback( + context: messageListContext, + messageId: message.id, + errorDialogTitle: 'Sharing failed', + ); + + if (rawContent == null) return; + + if (!messageListContext.mounted) return; + // TODO: to support iPads, we're asked to give a // `sharePositionOrigin` param, or risk crashing / hanging: // https://pub.dev/packages/share_plus#ipad // Perhaps a wart in the API; discussion: // https://github.com/zulip/zulip-flutter/pull/12#discussion_r1130146231 - // TODO: Share raw Markdown, not HTML - await Share.shareWithResult(message.content); + await Share.shareWithResult(rawContent); }; }