Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Birthdays not synced from Nextcloud 27 to Android 12/13 #24

Closed
rfc2822 opened this issue Aug 29, 2023 · 6 comments · Fixed by #25 or #26
Closed

Birthdays not synced from Nextcloud 27 to Android 12/13 #24

rfc2822 opened this issue Aug 29, 2023 · 6 comments · Fixed by #25 or #26
Assignees
Labels
bug Something isn't working

Comments

@rfc2822
Copy link
Member

rfc2822 commented Aug 29, 2023

Discussed in bitfireAT/davx5-ose#385

Originally posted by fwiep August 22, 2023
Hello,

Using DAVx5 v4.3.5.2 from F-Droid on several devices, both Android 12.1 (2x custom built LineageOS) and Android 13 (1x stock Samsung UI).

Since about one week, all contacts no longer have their birthdays set on the Android device. In the Nextcloud, all is well and all the dates are present and shown on screen.

I have tried to clear the Contacts-app cache, even installed an extra (official Google) Contacts app to compare the result. On all three devices, not a single birthday is shown. The Contact app allows me to add a birthday to the contact, but via DAVx5, no birthday gets synchronized.

When I edit, say the 'Notes' field of a contact in the Nextcloud, then sync through DAVx5, this modification shows up instantly.

How can I get the birthdays back into my Android contacts?

How should I debug this issue? I have collected a sync's verbose logfile, but no error is shown.

Thanks for your help,
FWieP

@rfc2822 rfc2822 transferred this issue from bitfireAT/davx5-ose Aug 29, 2023
@rfc2822 rfc2822 added the bug Something isn't working label Aug 29, 2023
@rfc2822
Copy link
Member Author

rfc2822 commented Aug 29, 2023

@ArnyminerZ Can you please have a look (reproduce with a test first)? I think EventBuilder.buildEvent should handle dates 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.

@ArnyminerZ
Copy link
Member

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])
    }
}

@devvv4ever
Copy link
Member

devvv4ever commented Nov 1, 2023

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>&quot;6d9b6a752c6858863a9018759b9dd5ae&quot;</d:getetag><card:address-data>BEGIN:VCARD&#13;
VERSION:4.0&#13;
PRODID:-//Sabre//Sabre VObject 4.5.3//EN&#13;
UID:LcjQnxjYhKYC9CZtYSgAnkDwrg6QDk-1345-0-0&#13;
N:Doe;John;;;&#13;
FN:John Doe&#13;
BDAY:20010415T000000+0200&#13;
ITEM1.ADR:;; ;;;;Nederland&#13;
ITEM1.X-ABLABEL:Home&#13;
CATEGORIES:_personen&#13;
GENDER:M&#13;
END:VCARD&#13;
</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

@rfc2822
Copy link
Member Author

rfc2822 commented Nov 1, 2023

Guess that's becauseVCardDateFormat.parse creates an OffsetDateTime, not a ZonedDateTime:

https://github.com/mangstadt/ez-vcard/blob/d4c9ab9fb11f4ed6d83c32bdaa2089a73043bd9b/src/main/java/ezvcard/util/VCardDateFormat.java#L185

We should

  • support OffsetDateTime in addition to (or if vCard doesn't support zoned date-times: instead of) ZonedDateTime,
  • have a test for it,
  • have a test that contains such a BDAY directly as raw string and sees whether it's converted correctly (to an OffsetDateTime) so that we can be sure that the whole conversion works in the future.

@fwiep
Copy link

fwiep commented Nov 22, 2023

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

@sunkup
Copy link
Member

sunkup commented Nov 22, 2023

@fwiep See #26 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
5 participants