fix some glitches related to duplicating events

This commit is contained in:
tibbi 2018-11-18 17:03:44 +01:00
parent 7f36b62798
commit 7985112082
2 changed files with 7 additions and 3 deletions

View File

@ -95,10 +95,10 @@ class EventActivity : SimpleActivity() {
}
if (intent.getBooleanExtra(IS_DUPLICATE_INTENT, false)) {
mEvent.id = 0
}
mEvent.id = null
} else {
cancelNotification(mEvent.id!!)
}
} else {
mEvent = Event(null)
config.apply {

View File

@ -128,6 +128,10 @@ class EventsHelper(val context: Context) {
fun deleteEvent(id: Long, deleteFromCalDAV: Boolean) = deleteEvents(arrayListOf(id), deleteFromCalDAV)
fun deleteEvents(ids: MutableList<Long>, deleteFromCalDAV: Boolean) {
if (ids.isEmpty()) {
return
}
val eventsWithImportId = eventsDB.getEventsByIdsWithImportIds(ids)
eventsDB.deleteEvents(ids)