Skip to content

feat: a contact card can be saved and added to contacts - #509

Merged
an1ndra merged 1 commit into
Developfrom
fix/contact-actions
Nov 19, 2026
Merged

an1ndra merged 1 commit into
Developfrom
fix/contact-actions

Conversation

@an1ndra

@an1ndra an1ndra commented Nov 19, 2026

Copy link
Copy Markdown
Owner

What changed

A contact card can now be kept, not only looked at.

  • Tap a card → 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).
  • Received cards are imported as a contact row, 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.
  • Save in the selection toolbar is offered for a contact, with its own label, and the saved file keeps the .vcf extension.
  • Save reports success. The counter behind the toast was declared and never incremented, so every save said "could not save" even when the file had been written. It is incremented now, and logged as 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 testDebugUnitTest passes
  • JUnit test added under app/src/test/java/ (ContactActionsTest, MmsSupportTest, SelectionToolbarTest)
  • scripts/test-*.sh added, and it fails before the fix / passes after

scripts/test-contact-card.sh on emulator-5556: 9 passed, 0 failed:

[PASS] tapping the card offers 'Add to contacts' and 'Save contact'
[PASS] the card was saved as a .vcf
[PASS] the save reports success
[PASS] the contacts app opened to add the card

On the previous build the same run fails those four:

[FAIL] the card's actions are not in this build
[FAIL] the card was not saved (log: none)
[FAIL] the save reports failure (log: none)
[FAIL] no contacts app after Add to contacts

The received side is covered by unit tests rather than the script, because an emulator cannot download an MMS:

MmsSupport.content([Part(7, "text/x-vcard")])
  → omittedParts = 0, mediaRows = [("contact", 7)], no "not displayed" notice

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).

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.
@an1ndra
an1ndra merged commit 0b04054 into Develop Nov 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant