v0.3.1 - New features for sync adapter use cases (SOURCE_ID, Data IS_READ_ONLY, CALLER_IS_SYNC_ADAPTER), bug fixes, improvements, and some breaking changes
There's a LOT of new useful stuff here for folks interested in using this library for sync adapter use cases! Thanks to @marrale for starting these discussions (which led to the addition of a bunch of useful new stuff);
- https://github.com/vestrel00/contacts-android/discussions/299#discussioncomment-6867208
- https://github.com/vestrel00/contacts-android/discussions/301#discussioncomment-6952055
I was not planning for these features to be added to the library but I do see value in them, especially for folks needing to implement a sync adapter.
Apart from that, there is also a handful of bug fixes, improvements, and tiny bit of breaking changes (with migration guide).
π‘ New features
- Add support for
ContactsContract.RawContacts.SOURCE_ID#300, documentation - Add support for
ContactsContract.Groups.SOURCE_ID#303, documentation - Add extensions for getting all data kinds of a Contact or RawContact as a list #312, documentation
- Support setting
ContactsContract.DataColumns.IS_READ_ONLYwhen inserting anyNewDataEntity(e.g. name, email, phone, etc) #306, documentation - Add extensions for checking the value of
ContactsContract.DataColumns.IS_READ_ONLYfor anyExistingDataEntity#307, documentation - Support setting
ContactsContract.CALLER_IS_SYNCADAPTERin all CRUD APIs #308, documentation
π Bug fixes
- ExistingContactEntity.setPhotoDirect fails when there is no previous photo #289
- Potential ArrayIndexOutOfBoundsException when querying contacts (and Fields.Event.Date is included) #291
- Query APIs do not return local contacts in Xiaomi devices when passing null to accounts functions #296
AccountsQueryAPI returns Accounts with no sync adapters for Contacts #298ProfileUpdateAPI fails when Contact is provided but not RawContact(s) #302GroupsUpdateAPI allows updating read-only groups, which results in a falsely successful operation #305- Extension
fun Activity.selectPhoto()in PhotoPicker.kt does not work in APIs 30 and up #314
π οΈ Improvements
- Update documentation for
contacts.ui.util.requestToBeTheDefaultDialerAppto include additional instructions for API 33 (Tiramisu) and higher #315 - Allow updating and deleting read-only groups when
ContactsContract.CALLER_IS_SYNCADAPTERis set to true #309
π£ Breaking changes
- Remove the
associatedWithandassociatedWithRawContactIdsfunctions from theAccountsQueryAPI andprofilefrom theAccountsAPI #297 - Group
mutableCopyfunction should not return null even if readOnly is true in order to support usages by sync adapters #304 - Rename
readOnlyproperty ofGroupEntitytoisReadOnlyandReadOnlyofGroupsFieldstoGroupIsReadOnly#310 NewCustomDataEntityimplementations now require additional propertyisReadOnly#311- Custom data integrations now require
callerIsSyncAdapter: Booleanparameter #313
π§ Migrating from 0.3.0 -> 0.3.1
Remove the associatedWith and associatedWithRawContactIds functions from the AccountsQuery API and profile from the Accounts API #297
PREVIOUSLY, the AccountsQuery API provided functions to filter Accounts based on RawContacts via the associatedWith and associatedWithRawContactIds functions.
NOW, those API functions have been removed. Reasons for removal are stated in #297
Additionally, the profile function of the Accounts API have been removed because the sole reason it existed was for use with associatedWith and associatedWithRawContactIds functions of the AccountsQuery API.
If you need to get the Account of a RawContact based on just an ID, use the RawContactsQuery API instead.
ποΈ Read the new documentation for the full guide!
Group mutableCopy function should not return null even if readOnly is true in order to support usages by sync adapters #304
PREVIOUSLY, the Group.mutableCopy() function may return null if the group is read-only.
NOW, it will no longer return null even if the group is read-only.
ποΈ Read the new documentation for the full guide!
Rename readOnly property of GroupEntity to isReadOnly and ReadOnly of GroupsFields to GroupIsReadOnly #310
Rename the following usages;
GroupEntity.readOnly->GroupEntity.isReadOnlyGroupsFields.ReadOnly->GroupsFields.GroupIsReadOnly
NewCustomDataEntity implementations now require additional property isReadOnly #311
If you have an implementation of NewCustomDataEntity, you will have to implement a new property which you should set to false by default.
override var isReadOnly: Boolean = false
ποΈ Read the new documentation for more info about this new property!
Custom data integrations now require callerIsSyncAdapter: Boolean parameter #313
Add callerIsSyncAdapter: Boolean as the first parameter to your AbstractCustomDataOperation.Factory.create functions and AbstractCustomDataOperation constructors.
ποΈ Full Changelog
https://github.com/vestrel00/contacts-android/compare/0.3.0...0.3.1
π£οΈ Discuss this release
Head on over to the v0.3.1 Release Checklist and leave a comment and/or some reactions π π