Repository navigation
Fix BioRecipientState equals to compare against its own type - #15038
Open
Andrea-Bruno wants to merge 2 commits into
Open
Andrea-Bruno wants to merge 2 commits into
Andrea-Bruno wants to merge 2 commits into
Conversation
Corrected the callback in NotificationsSettingsFragment to use setMessageNotificationVibration instead of setMessageNotificationsEnabled when toggling vibration setting. This ensures that disabling vibration doesn't turn off notifications entirely.
mtang-signal
left a comment
Contributor
There was a problem hiding this comment.
Hi, I like the change, but could you rebase this to remove the older commit (to fix message vibration)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BioRecipientState is a small wrapper around a Recipient that holds the profile row data for the settings screen. Its equals method checked whether the object being compared was a Recipient. But the class itself is a BioRecipientState, not a Recipient, so two BioRecipientState objects were never equal to each other, even when they wrapped a recipient with identical content.
Because of this, every time the underlying recipient data was re-emitted, the settings screen saw the profile row as changed and refreshed it, even when nothing about the profile had actually changed.
The fix compares against BioRecipientState and then compares the wrapped recipients by their content. The hashCode stays consistent with this, because two recipients that have the same content also have the same id, which is what the hash is built from.