mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
do not update remote CalDAV server at every refresh
This commit is contained in:
@@ -14,10 +14,10 @@ import com.simplemobiletools.calendar.pro.models.*
|
|||||||
import com.simplemobiletools.calendar.pro.objects.States.isUpdatingCalDAV
|
import com.simplemobiletools.calendar.pro.objects.States.isUpdatingCalDAV
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import java.util.*
|
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import org.joda.time.format.DateTimeFormat
|
import org.joda.time.format.DateTimeFormat
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
class CalDAVHelper(val context: Context) {
|
class CalDAVHelper(val context: Context) {
|
||||||
@@ -33,12 +33,14 @@ class CalDAVHelper(val context: Context) {
|
|||||||
val calDAVCalendars = getCalDAVCalendars(context.config.caldavSyncedCalendarIds, showToasts)
|
val calDAVCalendars = getCalDAVCalendars(context.config.caldavSyncedCalendarIds, showToasts)
|
||||||
for (calendar in calDAVCalendars) {
|
for (calendar in calDAVCalendars) {
|
||||||
val localEventType = eventsHelper.getEventTypeWithCalDAVCalendarId(calendar.id) ?: continue
|
val localEventType = eventsHelper.getEventTypeWithCalDAVCalendarId(calendar.id) ?: continue
|
||||||
localEventType.apply {
|
if (calendar.displayName != localEventType.title || calendar.color != localEventType.color) {
|
||||||
title = calendar.displayName
|
localEventType.apply {
|
||||||
caldavDisplayName = calendar.displayName
|
title = calendar.displayName
|
||||||
caldavEmail = calendar.accountName
|
caldavDisplayName = calendar.displayName
|
||||||
color = calendar.color
|
caldavEmail = calendar.accountName
|
||||||
eventsHelper.insertOrUpdateEventTypeSync(this)
|
color = calendar.color
|
||||||
|
eventsHelper.insertOrUpdateEventTypeSync(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchCalDAVCalendarEvents(calendar.id, localEventType.id!!, showToasts)
|
fetchCalDAVCalendarEvents(calendar.id, localEventType.id!!, showToasts)
|
||||||
@@ -105,7 +107,6 @@ class CalDAVHelper(val context: Context) {
|
|||||||
context.contentResolver.update(uri, values, null, null)
|
context.contentResolver.update(uri, values, null, null)
|
||||||
context.eventTypesDB.insertOrUpdate(eventType)
|
context.eventTypesDB.insertOrUpdate(eventType)
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
e.printStackTrace()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user