File tree 2 files changed +9
-2
lines changed
app/src/main/kotlin/at/bitfire/davdroid
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ class AccountRepository @Inject constructor(
85
85
val defaultSyncInterval = settingsManager.getLong(Settings .DEFAULT_SYNC_INTERVAL )
86
86
87
87
// Configure CardDAV service
88
+ val addrBookAuthority = context.getString(R .string.address_books_authority)
88
89
if (config.cardDAV != null ) {
89
90
// insert CardDAV service
90
91
val id = insertService(accountName, Service .TYPE_CARDDAV , config.cardDAV)
@@ -94,6 +95,9 @@ class AccountRepository @Inject constructor(
94
95
95
96
// start CardDAV service detection (refresh collections)
96
97
RefreshCollectionsWorker .enqueue(context, id)
98
+
99
+ // set default sync interval for address books
100
+ accountSettings.setSyncInterval(addrBookAuthority, defaultSyncInterval)
97
101
}
98
102
99
103
// Configure CalDAV service
Original file line number Diff line number Diff line change @@ -217,11 +217,14 @@ class AccountSettings(
217
217
* @return sync interval in seconds; *[SYNC_INTERVAL_MANUALLY]* if manual sync; *null* if not set
218
218
*/
219
219
fun getSyncInterval (authority : String ): Long? {
220
- if (ContentResolver .getIsSyncable(account, authority) <= 0 )
220
+ val addrBookAuthority = context.getString(R .string.address_books_authority)
221
+
222
+ if (ContentResolver .getIsSyncable(account, authority) <= 0
223
+ && authority != addrBookAuthority)
221
224
return null
222
225
223
226
val key = when {
224
- authority == context.getString( R .string.address_books_authority) ->
227
+ authority == addrBookAuthority ->
225
228
KEY_SYNC_INTERVAL_ADDRESSBOOKS
226
229
authority == CalendarContract .AUTHORITY ->
227
230
KEY_SYNC_INTERVAL_CALENDARS
You can’t perform that action at this time.
0 commit comments