Fixes oxen-io/session-android#704 - Reply state is lost when replying with link preview #1387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First time contributor checklist
Contributor checklist
Fixes #1234
syntaxDescription
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 aLinearLayout
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, theInputBar.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):