Ensure event type visibility when importing ICS

This commit is contained in:
Naveen 2023-07-01 13:59:23 +05:30
parent 4dcce80a7d
commit d2b40d11e7
No known key found for this signature in database
GPG Key ID: 0E155DAD31671DA3
1 changed files with 11 additions and 11 deletions

View File

@ -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<Event>, 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()