Ensure event type visibility when importing ICS
This commit is contained in:
parent
4dcce80a7d
commit
d2b40d11e7
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue