Clickable hyperlinks for MessageBubbles
#235
Merged
sarah
merged 9 commits from NimaBoscarino/cwtch-ui:nima/clickable-links
into trunk
2 years ago
Reviewers
Request review
Labels
This issue requires effort from an external organization to move forward bug
Something is not working bugbash component/bindings component/bine component/connectivity component/cwtch component/tapir component/ui cwtch-beta-1.1 cwtch-beta-1.10
Changes Planned for Cwtch Beta 1.10 cwtch-beta-1.11 cwtch-beta-1.12 cwtch-beta-1.2 cwtch-beta-1.3 cwtch-beta-1.4 cwtch-beta-1.5 cwtch-beta-1.5.x
point release vug fixes for 1.5 cwtch-beta-1.6 cwtch-beta-1.7 cwtch-beta-1.8 cwtch-beta-1.9 design duplicate
This issue or pull request already exists enhancement
New feature flutter funding-needed help wanted
Need some help in-nightly in-progress invalid
Something is wrong ios linux mac need-replication-or-investigation ops post-stable
These issues won't be considered until after Cwtch Stable ships. question
More information is needed questionable
there is an open question as to whether this is an issue at all / if we can even fix this requires-more-effort-than-we-can-spare
The amount of work involved to solve this issue would occupy our entire development team for a significant period of time and/or provide little benefit to the rest of the project rust scheduled tails testing-needed tor waiting-on-fix-confirmation waiting-on-new-flutter-feature
The cause of this issue is a bug in the underlying flutter framework. whonix windows wontfix
This won't be fixed
Apply labels
Clear labels
android
arch
backlog
blocked-on-external
This issue requires effort from an external organization to move forward bug
Something is not working bugbash component/bindings component/bine component/connectivity component/cwtch component/tapir component/ui cwtch-beta-1.1 cwtch-beta-1.10
Changes Planned for Cwtch Beta 1.10 cwtch-beta-1.11 cwtch-beta-1.12 cwtch-beta-1.2 cwtch-beta-1.3 cwtch-beta-1.4 cwtch-beta-1.5 cwtch-beta-1.5.x
point release vug fixes for 1.5 cwtch-beta-1.6 cwtch-beta-1.7 cwtch-beta-1.8 cwtch-beta-1.9 design duplicate
This issue or pull request already exists enhancement
New feature flutter funding-needed help wanted
Need some help in-nightly in-progress invalid
Something is wrong ios linux mac need-replication-or-investigation ops post-stable
These issues won't be considered until after Cwtch Stable ships. question
More information is needed questionable
there is an open question as to whether this is an issue at all / if we can even fix this requires-more-effort-than-we-can-spare
The amount of work involved to solve this issue would occupy our entire development team for a significant period of time and/or provide little benefit to the rest of the project rust scheduled tails testing-needed tor waiting-on-fix-confirmation waiting-on-new-flutter-feature
The cause of this issue is a bug in the underlying flutter framework. whonix windows wontfix
This won't be fixed
No Label
android
arch
backlog
blocked-on-external
bug
bugbash
component/bindings
component/bine
component/connectivity
component/cwtch
component/tapir
component/ui
cwtch-beta-1.1
cwtch-beta-1.10
cwtch-beta-1.11
cwtch-beta-1.12
cwtch-beta-1.2
cwtch-beta-1.3
cwtch-beta-1.4
cwtch-beta-1.5
cwtch-beta-1.5.x
cwtch-beta-1.6
cwtch-beta-1.7
cwtch-beta-1.8
cwtch-beta-1.9
design
duplicate
enhancement
flutter
funding-needed
help wanted
in-nightly
in-progress
invalid
ios
linux
mac
need-replication-or-investigation
ops
post-stable
question
questionable
requires-more-effort-than-we-can-spare
rust
scheduled
tails
testing-needed
tor
waiting-on-fix-confirmation
waiting-on-new-flutter-feature
whonix
windows
wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: cwtch.im/cwtch-ui#235
Reference in new issue
There is no content yet.
Delete Branch 'NimaBoscarino/cwtch-ui:nima/clickable-links'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Addresses #169. Clickable links are added only to
MessageBubble
, and are locked behind an experiment gate.Note that the PR is currently riddled with TODOs! Specific questions are annotated directly in the code view here on Git, but the main issues are:
onOpen
breaks the selectable text<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
I still need to test this on my Android emulator this weekend (currently only working in the macOS app), so I'm not yet sure if this needs to be like this.
},
activeTrackColor: settings.theme.defaultButtonActiveColor(),
inactiveTrackColor: settings.theme.defaultButtonDisabledColor(),
secondary: Icon(Icons.link, color: settings.current().mainTextColor()),
Let me know if there's a preferred icon to use!
Our staff designer @marcia will create an icon for this :)
text: widget.content + '\u202F',
// TODO: onOpen breaks the "selectable" functionality. Maybe something to do with gesture handler?
options: LinkifyOptions(humanize: false),
linkifiers: [UrlLinkifier()], // TODO: double-check on this (only web links to avoid Android messiness)
This restricts Linkify to only format URLs. Does this sound okay for now?
Yeah this sounds good.
} else {
wdgMessage = SelectableLinkify(
text: widget.content + '\u202F',
// TODO: onOpen breaks the "selectable" functionality. Maybe something to do with gesture handler?
For some reason, once I add the
onOpen
handler the text selection breaks (e.g. https://i.imgur.com/SrtOLIG.mp4). I don't know enough about Flutter/Dart to figure it out easily, do you know what the case might be? I tried to recreate it in a fresh sandbox but had no luck, so I'm wondering if maybe theTapGestureRecognizer
in Linkify conflicts with theMouseRegion
inmessagerow.dart
?We've definitely had a few issues with widgets interacting in these kinds of ways. I will take a look into this early next week.
I could not replicate the lack of text selection on Linux under the following Flutter Build
As such I wonder if this is platform specific (or perhaps fixed in a newer version of flutter).
I tried it with
and still ran into the issue, so it looks like it might be as macOS-specific issue!
builder: (BuildContext bcontext) {
return Container(
// TODO: Ask re: hard-coded height
height: 200, // bespoke value courtesy of the [TextField] docs
I stole this modal from elsewhere in the code. Since the height has been hard-coded to 200 in several places, should I extract the modal out to be its own widget?
I think having this widget defined here right now is fine. We have a separate task planned to go through and check widgets like (with hard coded heights etc.)
"Opening this link will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open links from people you trust. Are you sure you want to continue?"
),
// TODO: Ask about styling preferences (should this be a reusable "inline-button"?)
Flex(direction: Axis.horizontal, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
I'm quite new to styling and layout in Flutter. Does this look okay, or are there cleaner/other ways preferred?
This looks fine :)
Clipboard.setData(new ClipboardData(text: link.url));
// TODO: Ask about desired SnackBar + modal behaviour
final snackBar = SnackBar(
I saw that in other places in Cwtch there's a snackbar displayed for the "Copy to clipboard" action, so I did the same here. It currently renders under the modal though, and I'm not sure how to make it display above. Any thoughts/suggestions for that?
You will probably need to cancel/destroy the modal prior to launching the snackBar.
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch-ui/326
@NimaBoscarino This is looking really good :)
I will take a closer look at this early next week and probably get some more comments back to you on Monday. And will also get Marcia to start thinking about the icon for the experiment switch.
I will also make a start at creating the translatable strings.
FYI: When you want to get down to some fuzz testing, I upgraded FuzzBot(
4y2hxlxqzautabituedksnh2ulcgm2coqbure6wvfpg4gi2ci25ta5ad
) yesterday to be on the most recent version of Cwtch so it should be more available and faster to respond.Definitely interested to see how
blns
integrates with this new feature :)Thanks again!
I tested it out with
blns
and I didn't catch anything that seemed strange! Just a few things like the pictures attached. Links are only detected if there's anhttp://
orhttps://
to start it.I also managed to set it up to test it out on my Android emulator and it looks like links can open up properly now!
I got this running this morning :) It works very well! And I think this is almost ready to be pulled into nightly.
Few small things:
- The color of the links needs to be set. Ideally they should either be set inmkThemeData
(referencing.current().mainTextColor()
or useProvider.of<Settings>(context).current().mainTextColor()
Other Notes:
- This change may require an Flutter upgrade to our build server - @dan (url_launcher requires at least 2.4, and we may still be on the earlierdev
release`Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch-ui/327
WIP: Clickable hyperlinks for MessageBubblesto Clickable hyperlinks for MessageBubbles 2 years ago@NimaBoscarino - Thank you so much for your work on this. I've been using this experiment for a few days now and it has made a significant improvement to my workflow.
How would you like to credited in the changelog of the next cwtch release? Additionally: is there any profile/website you would like linked to the credit?
@sarah Woo I'm so glad to hear that! And thank you so much for all the help with this issue! You can just credit me as Nima Boscarino, and my site is https://www.n11o.com/
Looks good to me. We've used this to determine we need/are moving our build infra to flutter stable 2.5.3, (from dev 2.5.0-6pre) so I first need to upgrade all the build envs before this can be built and merged
secondary: Icon(Icons.attach_file, color: settings.current().mainTextColor()),
),
SwitchListTile(
title: Text("Enable Clickable Links", style: TextStyle(color: settings.current().mainTextColor())),
I beleive Sarah you will translate these in a follow up PR?
Yup.
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch-ui/346
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch-ui/340
Merging this. Build bot needs some updates to allow building from different forks. But we've now built this for all platforms.
2c1347e50e
into trunk 2 years agoReviewers
2c1347e50e
.