Skip to content
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

Fixes oxen-io/session-android#704 - Reply state is lost when replying with link preview #1387

Merged

Conversation

alansley
Copy link

@alansley alansley commented Jan 6, 2024

First time contributor checklist

Contributor checklist

  • I have tested my contribution on these devices:
  • Samsung S9+ on Android 9 / API 28
  • Virtual Pixel 3a on Android 14 / API 34
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

This PR fixes the issue that any message could only ever have a quote/reply element (as in when replying to a message the first part of the message being replied to is quoted before the reply itself) OR it could have a URI preview - but it could never have both, as adding a URI preview to a message that was a reply removed the quote element, and adding a quote element to a message that had a URI preview removed that preview and replaced it with the quote element.

To perform this fix the 'additional content' layout was modified from a FrameLayout (which typically only holds a single child View) to a LinearLayout with vertical orientation so that both a quote View and a link-preview View can exist as part of the message and be displayed at the same time (both on the sending and receiving devices). Then, the InputBar.kt class was adjusted so that quote and preview Views could co-exist in the layout, and that adding one type of View did not remove the other.

The quote/reply View is always displayed at the top of the message, and may be removed and re-added at will. Additionally, users are are free to add/remove/update a single link preview (generated from the first identified URI in the message) at will.

Users running session-android v1.17.5 can successfully receive and display messages that contain both a quote/reply and a link preview - but they will be unable to respond with their own messages that contain both a quote & a preview because they do not have this patched version of the code yet.

These adjustments were tested by sending multiple messages between users in both direct mode and as part of a group, and adding/removing reply elements, as well as adding/removing/updating link-preview elements both with and without quote/reply elements. To the best of my knowledge the functionality of having both reply/quote and link-preview elements now works as it should.

Demonstration of a message containing both a reply and a link preview (which looked identical on the receiving device - the Samsung S9+ running stock session-android v1.17.5):

Session-Android_Issue_704_Fixed_Example

@0x330a 0x330a merged commit c366574 into oxen-io:dev Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants