From 098a541318fb223ee7b24a4478e97be911f37a10 Mon Sep 17 00:00:00 2001 From: Usaim Bhayat Date: Thu, 10 Mar 2022 16:24:36 -0500 Subject: [PATCH 1/3] add ability to specify onLinkTap for url attachments --- .../lib/src/attachment/url_attachment.dart | 10 +++++++++- .../stream_chat_flutter/lib/src/message_widget.dart | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart b/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart index 8a79ca21..df05ba5e 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/url_attachment.dart @@ -14,6 +14,7 @@ class UrlAttachment extends StatelessWidget { horizontal: 16, vertical: 8, ), + this.onLinkTap, }) : super(key: key); /// Attachment to be displayed @@ -28,13 +29,20 @@ class UrlAttachment extends StatelessWidget { /// [MessageThemeData] for showing image title final MessageThemeData messageTheme; + /// The function called when tapping on a link + final void Function(String)? onLinkTap; + @override Widget build(BuildContext context) { final chatThemeData = StreamChatTheme.of(context); return GestureDetector( onTap: () { final titleLink = urlAttachment.titleLink; - if (titleLink != null) launchURL(context, titleLink); + if (titleLink != null) { + onLinkTap != null + ? onLinkTap!(titleLink) + : launchURL(context, titleLink); + } }, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index 63f4e805..3ffca84a 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -1013,6 +1013,7 @@ class _MessageWidgetState extends State hostDisplayName: hostDisplayName, textPadding: widget.textPadding, messageTheme: widget.messageTheme, + onLinkTap: widget.onLinkTap, ); } From 39abca308c6269e8a278644bb453a5d1151a0eb4 Mon Sep 17 00:00:00 2001 From: Usaim Bhayat Date: Thu, 10 Mar 2022 16:44:43 -0500 Subject: [PATCH 2/3] Update CHANGELOG.md --- packages/stream_chat_flutter/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 15aea4b1..d0c9c3f9 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -4,6 +4,12 @@ - Mentions overlay now doesn't overflow when not enough height available + +✅ Added + +- `onLinkTap` for `MessageWidget` can now be passed down to `UrlAttachment`. + + ## 3.5.0 🐞 Fixed From 04194cf3ee47b499b349afff07603f662ad29e21 Mon Sep 17 00:00:00 2001 From: GroovinChip Date: Wed, 16 Mar 2022 15:15:49 -0400 Subject: [PATCH 3/3] chore(flutter): don't run actions on draft PR's --- .github/workflows/stream_flutter_workflow.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 16be547c..33298866 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -15,6 +15,7 @@ on: jobs: analyze: timeout-minutes: 15 + if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: "Git Checkout" @@ -45,6 +46,7 @@ jobs: format: runs-on: ubuntu-latest + if: github.event.pull_request.draft == false timeout-minutes: 15 steps: - name: "Git Checkout" @@ -73,6 +75,7 @@ jobs: test: runs-on: macos-latest + if: github.event.pull_request.draft == false timeout-minutes: 20 steps: - name: "Git Checkout" @@ -123,3 +126,12 @@ jobs: with: path: packages/stream_chat_flutter/coverage/lcov.info min_coverage: 67 + + draft-build: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == true + timeout-minutes: 1 + + steps: + - name: Run a one-line script + run: echo Draft PR, you are good. \ No newline at end of file