fix: Display button only when contact is not already saved#2966
Draft
Elouan1411 wants to merge 1 commit into
Draft
fix: Display button only when contact is not already saved#2966Elouan1411 wants to merge 1 commit into
Elouan1411 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to hide the “Add to contacts” action in the detailed contact bottom sheet when the recipient is already saved in the user’s remote address book. To support this, it introduces a parsed remote contact identifier from the contacts API and persists it in the user-info Realm.
Changes:
- Add
Contact.idparsing (int-or-string tolerant) and persistremoteContactIdonMergedContact. - Hide the “Add to contacts” button based on merged-contact lookup from
MainViewModel. - Bump
USER_INFO_SCHEMA_VERSIONto account for the updated user-info Realm schema.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| OldKotlin/realm-models/src/main/kotlin/com/infomaniak/mail/data/models/correspondent/MergedContact.kt | Persist remoteContactId on MergedContact and populate it from API contacts. |
| OldKotlin/realm-models/src/main/kotlin/com/infomaniak/mail/data/models/correspondent/Contact.kt | Add id field to the API Contact model using a custom serializer. |
| OldKotlin/realm-models/src/main/kotlin/com/infomaniak/mail/data/api/IntOrStringSerializer.kt | Add a serializer to parse IDs returned as either JSON numbers or strings. |
| app/src/main/java/com/infomaniak/mail/ui/MainViewModel.kt | Add shouldShowAddToContacts helper used by UI to decide button visibility. |
| app/src/main/java/com/infomaniak/mail/ui/main/thread/DetailedContactBottomSheetDialog.kt | Toggle addToContacts visibility when opening the detailed contact bottom sheet. |
| app/src/main/java/com/infomaniak/mail/data/cache/RealmDatabase.kt | Increment USER_INFO_SCHEMA_VERSION to reflect the new persisted field in user-info Realm. |
Comment on lines
+311
to
+314
| fun shouldShowAddToContacts(recipient: Recipient): Boolean { | ||
| val remoteContactId = mergedContactController.getMergedContactFromEmail(recipient.email)?.remoteContactId | ||
| return remoteContactId.isNullOrBlank() | ||
| } |
Contributor
Author
There was a problem hiding this comment.
iOS does not work that way
3273b21 to
b3fbdb8
Compare
|
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.



No description provided.