Commit fcee1f26 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge branch '5455-master-duplicate_labels' into 'master'

AccountManager: synchronize creating groups and finding them

See merge request !46
parents cf776605 748b900c
Pipeline #192225 passed with stage
in 8 minutes and 9 seconds
......@@ -310,8 +310,12 @@ class DavService: android.app.Service() {
// remember usable collections
if ((service.type == Service.TYPE_CARDDAV && info.type == Collection.TYPE_ADDRESSBOOK) ||
(service.type == Service.TYPE_CALDAV && arrayOf(Collection.TYPE_CALENDAR, Collection.TYPE_WEBCAL).contains(info.type)))
collections[response.href] = info
(service.type == Service.TYPE_CALDAV && arrayOf(Collection.TYPE_CALENDAR, Collection.TYPE_WEBCAL).contains(info.type))) {
// Ignore "recently contacted" accounts since it is buggy and causes error 501
if (!info.url.toString().contains(AccountSettings.CONTACTS_APP_INTERACTION)) {
collections[response.href] = info
}
}
}
} catch(e: HttpException) {
if (e.code in arrayOf(403, 404, 410))
......
......@@ -367,6 +367,7 @@ class LocalAddressBook(
* @return id of the group with given title
* @throws RemoteException on content provider errors
*/
@Synchronized
fun findOrCreateGroup(title: String): Long {
provider!!.query(syncAdapterURI(Groups.CONTENT_URI), arrayOf(Groups._ID),
"${Groups.TITLE}=?", arrayOf(title), null)?.use { cursor ->
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment