mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02: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:
@@ -1386,7 +1386,19 @@ class EventActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
EDIT_ALL_OCCURRENCES -> {
|
EDIT_ALL_OCCURRENCES -> {
|
||||||
ensureBackgroundThread {
|
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) {
|
eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
@@ -502,7 +502,16 @@ class TaskActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
EDIT_ALL_OCCURRENCES -> {
|
EDIT_ALL_OCCURRENCES -> {
|
||||||
ensureBackgroundThread {
|
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) {
|
eventsHelper.updateEvent(mTask, updateAtCalDAV = false, showToasts = true) {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user