Closed rfc2822 closed 11 months ago
@ArnyminerZ Can you please have a look (reproduce with a test first)? I think EventBuilder.buildEvent
should handle date
s with time zone, too (in the when (date) { … }
) to support this specific case. Since we can't store time zone info in the contacts provider, we have to convert it into UTC.
Reproduced with a copy-paste of testType_Birthday
:
@Test
fun testType_BirthdayWithTimezone() {
EventBuilder(Uri.EMPTY, null, Contact().apply {
birthDay = Birthday("19510311T000000+0100")
}, false).build().also { result ->
assertEquals(CommonDataKinds.Event.TYPE_BIRTHDAY, result[0].values[CommonDataKinds.Event.TYPE])
}
}
Does unfortunately not seem to be fixed in 4.3.9 yet :-/
This is the vcard:
BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 4.4.2//EN
UID:LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0
N:Doe;John;;;
FN:John Doe
BDAY:20010415T000000+0200
ITEM1.ADR:;; ;;;;Nederland
ITEM1.X-ABLABEL:Home
CATEGORIES:_personen
GENDER:M
END:VCARD
From the logs:
2023-10-31 21:53:03 46 [network.HttpClient] <?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/addressbooks/users/frara/contacts/LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0.vcf</d:href><d:propstat><d:prop><d:getcontenttype>text/vcard; charset=utf-8</d:getcontenttype><d:getetag>"6d9b6a752c6858863a9018759b9dd5ae"</d:getetag><card:address-data>BEGIN:VCARD
VERSION:4.0
PRODID:-//Sabre//Sabre VObject 4.5.3//EN
UID:LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0
N:Doe;John;;;
FN:John Doe
BDAY:20010415T000000+0200
ITEM1.ADR:;; ;;;;Nederland
ITEM1.X-ABLABEL:Home
CATEGORIES:_personen
GENDER:M
END:VCARD
</card:address-data></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
2023-10-31 21:53:03 46 [network.HttpClient] <-- END HTTP (905-byte body)
2023-10-31 21:53:03 46 [syncadapter.ContactsSyncManager] Processing CardDAV resource LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0.vcf
2023-10-31 21:53:03 46 [syncadapter.ContactsSyncManager] Creating local contact
PARAMETER #0 = at.bitfire.vcard4android.Contact@4ce9893[addresses=[LabeledProperty(property=ezvcard.property.Address [ group=ITEM1 | parameters={} | poBoxes=[] | extendedAddresses=[] | streetAddresses=[ ] | localities=[] | regions=[] | postalCodes=[] | countries=[Nederland] ], label=Home)],anniversary=<null>,birthDay=ezvcard.property.Birthday [ group=null | parameters={} | text=null | date=2001-04-15T00:00+02:00 | partialDate=null ],categories=[_personen],customDates=[],displayName=John Doe,emails=[],familyName=Doe,givenName=John,group=false,impps=[],jobDescription=<null>,jobTitle=<null>,members=[],middleName=<null>,nickName=<null>,note=<null>,organization=<null>,phoneNumbers=[],phoneticFamilyName=<null>,phoneticGivenName=<null>,phoneticMiddleName=<null>,prefix=<null>,relations=[],suffix=<null>,uid=LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0,unknownProperties=BEGIN:VCARD
VERSION:4.0
GENDER:M
END:VCARD
,urls=[]]
2023-10-31 21:53:03 46 [contactrow.EventBuilder] Ignoring date/time without supported (partial) date
PARAMETER #0 = ezvcard.property.Birthday [ group=null | parameters={} | text=null | date=2001-04-15T00:00+02:00 | partialDate=null ]
2023-10-31 21:53:03 46 [BatchOperation] Committing 5 operations:
2023-10-31 21:53:03 46 [BatchOperation] #0: ContentProviderOperation(type=insert uri=content://com.android.contacts/raw_contacts?caller_is_syncadapter=true&account_name=Contactpersonen%20(fwiep%40fwiep.nl%206A)&account_type=at.bitfire.davdroid.address_book values={dirty=0, sync1=LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0, sync2=6d9b6a752c6858863a9018759b9dd5ae, sync4=1, account_name=Contactpersonen (fwiep@fwiep.nl 6A), account_type=at.bitfire.davdroid.address_book, deleted=0, sourceid=LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0.vcf})
2023-10-31 21:53:03 46 [BatchOperation] #1: ContentProviderOperation(type=insert uri=content://com.android.contacts/data?caller_is_syncadapter=true&account_name=Contactpersonen%20(fwiep%40fwiep.nl%206A)&account_type=at.bitfire.davdroid.address_book values={mimetype=vnd.android.cursor.item/name, raw_contact_id=android.content.ContentProviderOperation$BackReference@325f0d0, data1=John Doe, data2=John, data3=Doe, data4=null, data5=null, data6=null, data7=null, data8=null, data9=null})
2023-10-31 21:53:03 46 [BatchOperation] #2: ContentProviderOperation(type=insert uri=content://com.android.contacts/data?caller_is_syncadapter=true&account_name=Contactpersonen%20(fwiep%40fwiep.nl%206A)&account_type=at.bitfire.davdroid.address_book values={mimetype=vnd.android.cursor.item/postal-address_v2, data10=Nederland, raw_contact_id=android.content.ContentProviderOperation$BackReference@76718c9, data1=Nederland, data2=0, data3=Home, data4= , data5=, data6=, data7=, data8=, data9=})
2023-10-31 21:53:03 46 [BatchOperation] #3: ContentProviderOperation(type=insert uri=content://com.android.contacts/data?caller_is_syncadapter=true&account_name=Contactpersonen%20(fwiep%40fwiep.nl%206A)&account_type=at.bitfire.davdroid.address_book values={mimetype=vnd.android.cursor.item/group_membership, raw_contact_id=android.content.ContentProviderOperation$BackReference@4e8fbce, data1=44})
2023-10-31 21:53:03 46 [BatchOperation] #4: ContentProviderOperation(type=insert uri=content://com.android.contacts/data?caller_is_syncadapter=true&account_name=Contactpersonen%20(fwiep%40fwiep.nl%206A)&account_type=at.bitfire.davdroid.address_book values={mimetype=x.davdroid/unknown-properties, raw_contact_id=android.content.ContentProviderOperation$BackReference@3402aef, data1=BEGIN:VCARD
VERSION:4.0
GENDER:M
END:VCARD
})
2023-10-31 21:53:03 46 [BatchOperation] Running 5 operations (0 .. 4)
2023-10-31 21:53:03 46 [BatchOperation] … 5 record(s) affected
I also noticed that there is a "&# 13;" at the end of each line of the processed vcard. Does this has something to do with it?
Please can you check again whats the case with this vcard? @ArnyminerZ
Reference: Zammad #2891
Guess that's becauseVCardDateFormat.parse
creates an OffsetDateTime
, not a ZonedDateTime
:
We should
Hello again,
I had to wait for F-Droid to build and distribute the 4.3.10-ose package. Now I have tested and the problem is not yet fixed - but I think I know why.
If I compare the used library versions in the app's About dialog, I see the same vcard4android version as with 4.3.9-ose (b376d2e
), and not version a7a1f42
which contains the most recent fix.
Is this an issue with F-Droid's build process, or is there another way to get a true-full-up-to-date apk for testing?
Thanks and kind regards, FWieP
Discussed in https://github.com/bitfireAT/davx5-ose/discussions/385