Skip to content

Commit

Permalink
action_sheet: Have "Share" button share message's raw Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Oct 27, 2023
1 parent 256be9a commit 7683436
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}

Expand Down

0 comments on commit 7683436

Please sign in to comment.