-
-
Notifications
You must be signed in to change notification settings - Fork 9
make http links clickable in messages #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryThis PR adds clickable URL detection to message text using Android's Key implementation details:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LinkifiedMessageText
participant AnnotatedString
participant GestureDetector
participant Browser
participant MessageBubble
User->>LinkifiedMessageText: Tap on URL
LinkifiedMessageText->>GestureDetector: awaitFirstDown(requireUnconsumed=false)
GestureDetector->>MessageBubble: Press event (for animation)
MessageBubble->>MessageBubble: Start press animation
GestureDetector-->>LinkifiedMessageText: Down event captured
LinkifiedMessageText->>GestureDetector: waitForUpOrCancellation()
GestureDetector-->>LinkifiedMessageText: Up event captured
LinkifiedMessageText->>LinkifiedMessageText: Check tap duration < longPressTimeout
LinkifiedMessageText->>AnnotatedString: getOffsetForPosition(up.position)
AnnotatedString-->>LinkifiedMessageText: Offset at tap location
LinkifiedMessageText->>AnnotatedString: getStringAnnotations(URL_TAG, offset)
AnnotatedString-->>LinkifiedMessageText: URL string
LinkifiedMessageText->>GestureDetector: Consume down & up events
LinkifiedMessageText->>LinkifiedMessageText: toBrowsableUri(url)
LinkifiedMessageText->>Browser: startActivity(ACTION_VIEW, uri)
Browser-->>User: Opens URL in browser
MessageBubble->>MessageBubble: Cancel press animation (events consumed)
|
|
Thank you for this @MatthieuTexier! I had just noticed the need for this in the last few days. Will try it out tonight! |
app/src/main/java/com/lxmf/messenger/ui/screens/MessagingScreen.kt
Outdated
Show resolved
Hide resolved
|
oops sorry I didn't wanted to push this last patch in this pull request. |
no worries! maybe a git revert? |
This reverts commit 2367a15.
Adds the ability to fast tap on urls in message text to open the browser.