Repository navigation
feat: a sent contact is a real vCard, not its text - #508
Merged
Merged
Conversation
Attaching a contact pasted the vCard into the body of a text message, so the receiving phone showed a wall of BEGIN:VCARD properties — a message, not a contact. It now leaves as an MMS part: `text/x-vcard`, named `contact.vcf`, which is what a contacts app on the other end turns into a card it can save. - The tile writes the card to the cache and sends it as the `contact` kind; the send path declares the part's type and the MMS builder names it `contact.vcf`. - The chat draws a `contact` row as a card: the name and number read back from the attachment (so it survives the cache file being cleaned up), with the person badge; the raw properties never reach the screen. - The conversation preview says "Contact" instead of "Voice message". - Saving a card writes a .vcf rather than a .bin. - A contact that cannot be read — a denied READ_CONTACTS, a contact with no number — now says so. It used to do nothing at all. ContactCard.kt was a second, unused vCard builder left behind by an earlier merge, with the name folding the live one was missing: a name with a line break or a semicolon produced a malformed card. ContactShare now folds both, and the duplicate object and its test are gone. JUnit: ContactShareTest (the card's shape, folding, read-back), ContactCardWiringTest (the tile writes and sends a card, the chat draws one), MmsSupportTest (the wire type, the preview, the saved name) and a SendReqBuilderTest case pinning the part as text/x-vcard named contact.vcf. scripts/test-contact-card.sh: 5 checks on emulator-5556, 0 failed; on the previous build the same run fails the three that matter — the message is stored as `text`, has no .vcf, and the chat shows the raw properties.
2 tasks done
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
The Contact tile now sends a real vCard: an MMS part typed
text/x-vcard, namedcontact.vcf, instead of pasting the card's properties into the body of a text message.contactkind; the send path declares the part type and the MMS builder names itcontact.vcf.contactrow as a card — the name and number, with the person badge — read back from the attachment, so it survives the cache file being cleaned up. The rawBEGIN:VCARDproperties never reach the screen..vcfrather than a.bin.READ_CONTACTS, or a contact with no number) now says so; it used to do nothing at all.Why
Attaching a contact stored the vCard as the message body. The receiving phone — Google Messages included — shows that as a wall of
BEGIN:VCARDproperties: a text message, not a contact. Only the attachment form is a card.Also removed:
ContactCard.kt, a second vCard builder left unused by an earlier merge, which held the name folding the live one was missing. A contact saved with a line break or a semicolon in the name produced a malformed card;ContactSharenow folds both.Testing
./gradlew testDebugUnitTestpasses (and:mms:test)app/src/test/java/(ContactShareTest,ContactCardWiringTest,MmsSupportTest,SendReqBuilderTest)scripts/test-*.shadded, and it fails before the fix / passes afterscripts/test-contact-card.shonemulator-5556: 5 passed, 0 failed. On the previous build the same run fails the three that matter:The stored row after the fix (
emulator-5556, MMS itself cannot leave an emulator without a carrier):and the PDU level, from
SendReqBuilderTest:Related issue
None — reported while checking that a contact arrives as a card.
Note: this changes the transport. A contact now costs an MMS (data / carrier MMS profile) instead of an SMS, and fails where MMS is unavailable — the same as sending a photo.