@@ -14,10 +14,10 @@ import com.simplemobiletools.calendar.pro.models.*
1414import com.simplemobiletools.calendar.pro.objects.States.isUpdatingCalDAV
1515import com.simplemobiletools.commons.extensions.*
1616import com.simplemobiletools.commons.helpers.*
17- import java.util.*
18- import kotlin.collections.ArrayList
1917import org.joda.time.DateTimeZone
2018import org.joda.time.format.DateTimeFormat
19+ import java.util.*
20+ import kotlin.collections.ArrayList
2121
2222@SuppressLint(" MissingPermission" )
2323class CalDAVHelper (val context : Context ) {
@@ -33,12 +33,14 @@ class CalDAVHelper(val context: Context) {
3333 val calDAVCalendars = getCalDAVCalendars(context.config.caldavSyncedCalendarIds, showToasts)
3434 for (calendar in calDAVCalendars) {
3535 val localEventType = eventsHelper.getEventTypeWithCalDAVCalendarId(calendar.id) ? : continue
36- localEventType.apply {
37- title = calendar.displayName
38- caldavDisplayName = calendar.displayName
39- caldavEmail = calendar.accountName
40- color = calendar.color
41- eventsHelper.insertOrUpdateEventTypeSync(this )
36+ if (calendar.displayName != localEventType.title || calendar.color != localEventType.color) {
37+ localEventType.apply {
38+ title = calendar.displayName
39+ caldavDisplayName = calendar.displayName
40+ caldavEmail = calendar.accountName
41+ color = calendar.color
42+ eventsHelper.insertOrUpdateEventTypeSync(this )
43+ }
4244 }
4345
4446 fetchCalDAVCalendarEvents(calendar.id, localEventType.id!! , showToasts)
@@ -105,7 +107,6 @@ class CalDAVHelper(val context: Context) {
105107 context.contentResolver.update(uri, values, null , null )
106108 context.eventTypesDB.insertOrUpdate(eventType)
107109 } catch (e: IllegalArgumentException ) {
108- e.printStackTrace()
109110 }
110111 }
111112
0 commit comments