Repository navigation
feat: a contact card can be saved and added to contacts - #509
Merged
Merged
Conversation
A card could be seen and nothing else: tapping it did nothing, the selection toolbar offered no Save for it, and a card sent *to* this app arrived as "[MMS: 1 additional/unsupported attachment(s) not displayed]" because the importer only knew pictures, clips, voice notes and text. - Tapping a card opens a small dialog: "Add to contacts" (the contacts app's new-contact editor, prefilled with the name and number) and "Save contact" (a .vcf in Downloads/Messages). - A received text/x-vcard part is imported as a `contact` row, so the same card bubble shows up instead of the unsupported-attachment notice. - Save is offered for a contact in the selection toolbar, and the card keeps its .vcf name when written. - The save counter is incremented: it never was, so every save reported "could not save" even when the file had been written. The outcome is logged as "saved=N/total" because a toast cannot be read back. JUnit: ContactActionsTest (the values the insert carries, and that a card without a number cannot become a contact), MmsSupportTest (a received vCard becomes a contact row, not a notice; vCard files are kind contact) and SelectionToolbarTest (a card is saveable, with its own label). scripts/test-contact-card.sh: 9 checks on emulator-5556, 0 failed. On the previous build the four that cover keeping a card fail — no dialog, no save, no contacts app.
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.
What changed
A contact card can now be kept, not only looked at.
.vcfinDownloads/Messages).contactrow, so a card sent to this app shows the same card bubble. Before this it arrived as[MMS: 1 additional/unsupported attachment(s) not displayed]— the importer only knew pictures, clips, voice notes and text..vcfextension.saved=N/total(a toast is its own window, so no dump can read it back).Why
The previous change made a contact leave as a real vCard, but a card you cannot keep is only decoration: tapping did nothing, there was no Save for it, and an incoming card was reported as an unsupported attachment.
Testing
./gradlew testDebugUnitTestpassesapp/src/test/java/(ContactActionsTest,MmsSupportTest,SelectionToolbarTest)scripts/test-*.shadded, and it fails before the fix / passes afterscripts/test-contact-card.shonemulator-5556: 9 passed, 0 failed:On the previous build the same run fails those four:
The received side is covered by unit tests rather than the script, because an emulator cannot download an MMS:
Related issue
None — found while checking what happens when the receiver wants to keep a contact.
New strings:
chat_add_to_contacts,chat_save_contact,chat_contact_saved,chat_contact_save_failed,notif_contact(all 13 locales).