-
Notifications
You must be signed in to change notification settings - Fork 174
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
[SES-2162] - Remove wrapping of config message #1517
[SES-2162] - Remove wrapping of config message #1517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Nice one!
libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt
Outdated
Show resolved
Hide resolved
latestMessageTimestamp = if ((message.sentTimestamp ?: 0L) > (latestMessageTimestamp ?: 0L)) { message.sentTimestamp } else { latestMessageTimestamp } | ||
} | ||
forConfigObject.merge(hash to body) | ||
latestMessageTimestamp = if (timestamp > (latestMessageTimestamp ?: 0L)) { timestamp } else { latestMessageTimestamp } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latestMessageTimestamp = if (timestamp > (latestMessageTimestamp ?: 0L)) { timestamp } else { latestMessageTimestamp } | |
latestMessageTimestamp = max(timestamp, latestMessageTimestamp ?: 0L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the behaviour as it would never return a null latestMessageTimestamp
. That nullability is used as a check further down and would be set to 0L in this case and pass instead of being caught by that if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here are coming from the groups branch and they will be reverted before the groups are merged back in, I'm not sure if we want to spend too much energy on these
* fix: Authenticate all Open Group API calls * Use unblinded authentication when we have `capabilities` data for the open group server we are sending the request to but don't have the `blind` capability * Use blinded authentication when we haven't gotten any `capabilities` for an open group server, or if we have `capabilities` and the server has the `blind` capability * Hide send button when message contains only whitespace * Fix bug displaying user ID when quoting own message * Fix notification update for incoming unsend request * Improve check if author is own user when quoting messages * Fixed video call auto rotate, when auto rotate is disabled * refactor: simplify comparison * Stop playing message if deleted * Accidental change * Accidental change * Comments * Feedback * Comments * Import * Fix delete message for everyone doesn't stop the audio playing * Correct the usage of flowOn * Import * Optimise XML * Remove unused file * Remove view pools * Remove the use of executor in ThreadUtils * Using trim and empty to capture semantic concept of nothing being in there * Remove config checks (PR 1294) Refactor: remove checks for whether new config is enabled throughout config factory generation. First commit from PR 1294. * [SES-2162] - Remove wrapping of config message (#1517) * Remove wrapping of config message * Addresses feedback * Merged in ThreadUtils fix * JDK installation * Revert JDK change --------- Co-authored-by: fanchao <[email protected]> * Update libsession * [SES-337] Add rounded corners to thumbnail in QuoteView (#1285) * Add rounded corners to thumbnail in QuoteView * Simplify ThumbnailView * Cleanup ThumbnailView * Removed include custom attributes The custom attributes are not passed to the view. I added the radius programatically instead. * Clipping whole thumbnail view instead of just the image requests --------- Co-authored-by: AL-Session <[email protected]> Co-authored-by: ThomasSession <[email protected]> * Highlight @you mentions (#985) * Highlight @you mentions * fix: resolve merge conflicts * Setting the proper design rules for mentions * New RoundedBackgroundSpan, applied to "you" mentions The rounded background highlighter can take padding, so there is no need to add those extra spaces at the start and end. * Better mention highlight logic Some mention highlight should only format the text and not apply any styling. Also making sure we cater for all cases properly * Updated the text color logic based on design rules * Fine tuning the color rules * Removing usage of Resources.getSystem() Only making the db call if there actually is a mention * Moving color definition outside the loop to avoid repetitions --------- Co-authored-by: charles <[email protected]> Co-authored-by: 0x330a <[email protected]> Co-authored-by: ThomasSession <[email protected]> * [SES-2018] Refactor mention (#1510) * Refactor mention * Fixes robolectric test problem * Fixes tests * Naming and comments * Naming * Dispatcher --------- Co-authored-by: fanchao <[email protected]> * [SES-1966] Attachment batch download and tidy-up (#1507) * Attachment batch download * Addressed feedback and test issues * Feedback fixes * timedWindow for flow * Feedback * Dispatchers * Remove `flowOn` * New implementation of timedBuffer * Organise import * Feedback * Fix test * Tidied up logic around `eligibleForDownload` * Updated comment --------- Co-authored-by: fanchao <[email protected]> * Fix issue with span being the full length (#1528) * Proper display of unresolved names in mentions (#1530) * Fix issue with span being the full length * Making sure a mention with a username without a resolved name still displayed with the appropriate style with the truncated is * Testnet build (#1532) Co-authored-by: fanchao <[email protected]> * Allow "public.loki.foundation" to be accessed by http (#1534) Co-authored-by: fanchao <[email protected]> * Bumping the version code and name * Reverting temporary change --------- Co-authored-by: charles <[email protected]> Co-authored-by: andrew <[email protected]> Co-authored-by: aaronkerckhoff <[email protected]> Co-authored-by: Rugved Darwhekar <[email protected]> Co-authored-by: 0x330a <[email protected]> Co-authored-by: fanchao <[email protected]> Co-authored-by: Fanchao Liu <[email protected]> Co-authored-by: AL-Session <[email protected]> Co-authored-by: ceokot <[email protected]>
Background
tldr; Android is doing incorrect config message encoding.
Sometime in the past, any user's config update (like what groups they subscribed to, contacts, etc) will be pushed into the swarm as "messages", just like any other messages the user may see, but with a different type. Because they all push into the same place, when the user tries to restore their account, as all the messages are stored and restored in date sequential order, the user might not get the "config message" in time, if not at all.
To fix the problem, we introduced the concept of
namespaces
, essentially pre-defined constants with meaning. LikeGROUPS
namespace dictates that the messages should be group config messages. By doing this important messages like config messages won't get swamped along side other normal user messages, this improve the reliability greatly.As a side effect coming out from the namespace changes, we can know in advance what the message format is for a given namespace. This eliminates the need to use
protobuf
: where different types of messages are serialised together.So we did move away from the protobuf for the config messages (regular messages still use protobuf!). However, Android codebase still keeps using protobuf for the config messages, this causes trouble for the other clients who no longer use protobuf, as those clients won't be able to decode the protobuf-wrapped messages.
This PR:
libsession
libsession
so that it can handle already-wrapped messages that exist in the wild, so that existing users' configs are preserved.Note
This PR is a temporarily fix for the current production. The config system has been reworked on the groups branch and once that one is about to be merged, all changes here can be discarded first.