mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-08 16:08:47 +01:00
Properly handle Update all occurrences
option
Closes https://github.com/SimpleMobileTools/Simple-Calendar/issues/981 The events were moved forward because the start and end timestamps from the repeating occurrence were saved instead of the original start and end times. The call to `eventsHelper.addEventRepeatLimit()` was removed because I believe it was added there by mistake and the changes were overwritten anyways due to the next call to `eventsHelper.updateEvent()`. Another reason to remove it is to avoid triggering a CalDAV update which may interfere with the event update.
This commit is contained in:
parent
dea55ca94c
commit
2d33c1f8f0
@ -1386,7 +1386,19 @@ class EventActivity : SimpleActivity() {
|
||||
}
|
||||
EDIT_ALL_OCCURRENCES -> {
|
||||
ensureBackgroundThread {
|
||||
eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS)
|
||||
// Shift the start and end times of the first (original) event based on the changes made
|
||||
val originalEvent = eventsDB.getEventWithId(mEvent.id!!) ?: return@ensureBackgroundThread
|
||||
val originalStartTS = originalEvent.startTS
|
||||
val originalEndTS = originalEvent.endTS
|
||||
val oldStartTS = mOriginalStartTS
|
||||
val oldEndTS = mOriginalEndTS
|
||||
|
||||
mEvent.apply {
|
||||
val startTSDelta = oldStartTS - startTS
|
||||
val endTSDelta = oldEndTS - endTS
|
||||
startTS = originalStartTS - startTSDelta
|
||||
endTS = originalEndTS - endTSDelta
|
||||
}
|
||||
eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) {
|
||||
finish()
|
||||
}
|
||||
|
@ -502,7 +502,16 @@ class TaskActivity : SimpleActivity() {
|
||||
}
|
||||
EDIT_ALL_OCCURRENCES -> {
|
||||
ensureBackgroundThread {
|
||||
eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS)
|
||||
// Shift the start and end times of the first (original) event based on the changes made
|
||||
val originalEvent = eventsDB.getTaskWithId(mTask.id!!) ?: return@ensureBackgroundThread
|
||||
val originalStartTS = originalEvent.startTS
|
||||
val oldStartTS = mOriginalStartTS
|
||||
|
||||
mTask.apply {
|
||||
val startTSDelta = oldStartTS - startTS
|
||||
startTS = originalStartTS - startTSDelta
|
||||
endTS = startTS
|
||||
}
|
||||
eventsHelper.updateEvent(mTask, updateAtCalDAV = false, showToasts = true) {
|
||||
finish()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user