diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt index 2b18fa473..cb9927108 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt @@ -149,16 +149,6 @@ class EventsHelper(val context: Context) { } } - private fun ensureEventTypeVisibility(event: Event, enableEventType: Boolean) { - if (enableEventType) { - val eventType = event.eventType.toString() - val displayEventTypes = config.displayEventTypes - if (!displayEventTypes.contains(eventType)) { - config.displayEventTypes = displayEventTypes.plus(eventType) - } - } - } - fun insertEvents(events: ArrayList, addToCalDAV: Boolean) { try { for (event in events) { @@ -168,7 +158,7 @@ class EventsHelper(val context: Context) { } event.id = eventsDB.insertOrUpdate(event) - + ensureEventTypeVisibility(event, true) context.scheduleNextEventReminder(event, false) if (addToCalDAV && event.source != SOURCE_SIMPLE_CALENDAR && event.source != SOURCE_IMPORTED_ICS && config.caldavSync) { context.calDAVHelper.insertCalDAVEvent(event) @@ -190,6 +180,16 @@ class EventsHelper(val context: Context) { callback?.invoke() } + private fun ensureEventTypeVisibility(event: Event, enableEventType: Boolean) { + if (enableEventType) { + val eventType = event.eventType.toString() + val displayEventTypes = config.displayEventTypes + if (!displayEventTypes.contains(eventType)) { + config.displayEventTypes = displayEventTypes.plus(eventType) + } + } + } + fun deleteAllEvents() { ensureBackgroundThread { val eventIds = eventsDB.getEventIds().toMutableList()