Merge pull request #2053 from evan-goode/master

Don't set EXDATE on recurrence exceptions
This commit is contained in:
Tibor Kaputa
2023-05-18 14:41:22 +02:00
committed by GitHub
5 changed files with 16 additions and 12 deletions

View File

@@ -1356,7 +1356,7 @@ class EventActivity : SimpleActivity() {
EditRepeatingEventDialog(this) { EditRepeatingEventDialog(this) {
hideKeyboard() hideKeyboard()
when (it) { when (it) {
0 -> { EDIT_SELECTED_OCCURRENCE -> {
ensureBackgroundThread { ensureBackgroundThread {
eventsHelper.addEventRepetitionException(mEvent.id!!, mEventOccurrenceTS, true) eventsHelper.addEventRepetitionException(mEvent.id!!, mEventOccurrenceTS, true)
mEvent.apply { mEvent.apply {
@@ -1372,8 +1372,7 @@ class EventActivity : SimpleActivity() {
} }
} }
} }
EDIT_FUTURE_OCCURRENCES -> {
1 -> {
ensureBackgroundThread { ensureBackgroundThread {
eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS) eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS)
mEvent.apply { mEvent.apply {
@@ -1385,8 +1384,7 @@ class EventActivity : SimpleActivity() {
} }
} }
} }
EDIT_ALL_OCCURRENCES -> {
2 -> {
ensureBackgroundThread { ensureBackgroundThread {
eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS) eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS)
eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) { eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) {

View File

@@ -472,7 +472,7 @@ class TaskActivity : SimpleActivity() {
EditRepeatingEventDialog(this, isTask = true) { EditRepeatingEventDialog(this, isTask = true) {
hideKeyboard() hideKeyboard()
when (it) { when (it) {
0 -> { EDIT_SELECTED_OCCURRENCE -> {
ensureBackgroundThread { ensureBackgroundThread {
eventsHelper.addEventRepetitionException(mTask.id!!, mTaskOccurrenceTS, addToCalDAV = false) eventsHelper.addEventRepetitionException(mTask.id!!, mTaskOccurrenceTS, addToCalDAV = false)
mTask.apply { mTask.apply {
@@ -488,7 +488,7 @@ class TaskActivity : SimpleActivity() {
} }
} }
} }
1 -> { EDIT_FUTURE_OCCURRENCES -> {
ensureBackgroundThread { ensureBackgroundThread {
eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS) eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS)
mTask.apply { mTask.apply {
@@ -500,7 +500,7 @@ class TaskActivity : SimpleActivity() {
} }
} }
} }
2 -> { EDIT_ALL_OCCURRENCES -> {
ensureBackgroundThread { ensureBackgroundThread {
eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS) eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS)
eventsHelper.updateEvent(mTask, updateAtCalDAV = false, showToasts = true) { eventsHelper.updateEvent(mTask, updateAtCalDAV = false, showToasts = true) {

View File

@@ -4,6 +4,9 @@ import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.SimpleActivity import com.simplemobiletools.calendar.pro.activities.SimpleActivity
import com.simplemobiletools.calendar.pro.helpers.EDIT_ALL_OCCURRENCES
import com.simplemobiletools.calendar.pro.helpers.EDIT_FUTURE_OCCURRENCES
import com.simplemobiletools.calendar.pro.helpers.EDIT_SELECTED_OCCURRENCE
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.hideKeyboard
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
@@ -14,9 +17,9 @@ class EditRepeatingEventDialog(val activity: SimpleActivity, val isTask: Boolean
init { init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_edit_repeating_event, null) as ViewGroup).apply { val view = (activity.layoutInflater.inflate(R.layout.dialog_edit_repeating_event, null) as ViewGroup).apply {
edit_repeating_event_one_only.setOnClickListener { sendResult(0) } edit_repeating_event_one_only.setOnClickListener { sendResult(EDIT_SELECTED_OCCURRENCE) }
edit_repeating_event_this_and_future_occurences.setOnClickListener { sendResult(1) } edit_repeating_event_this_and_future_occurences.setOnClickListener { sendResult(EDIT_FUTURE_OCCURRENCES) }
edit_repeating_event_all_occurrences.setOnClickListener { sendResult(2) } edit_repeating_event_all_occurrences.setOnClickListener { sendResult(EDIT_ALL_OCCURRENCES) }
if (isTask) { if (isTask) {
edit_repeating_event_title.setText(R.string.task_is_repeatable) edit_repeating_event_title.setText(R.string.task_is_repeatable)

View File

@@ -502,7 +502,6 @@ class CalDAVHelper(val context: Context) {
put(Events.ORIGINAL_ID, event.getCalDAVEventId()) put(Events.ORIGINAL_ID, event.getCalDAVEventId())
put(Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString()) put(Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString())
put(Events.ORIGINAL_INSTANCE_TIME, occurrenceTS * 1000L) put(Events.ORIGINAL_INSTANCE_TIME, occurrenceTS * 1000L)
put(Events.EXDATE, Formatter.getDayCodeFromTS(occurrenceTS))
} }
} }

View File

@@ -232,6 +232,10 @@ const val DELETE_SELECTED_OCCURRENCE = 0
const val DELETE_FUTURE_OCCURRENCES = 1 const val DELETE_FUTURE_OCCURRENCES = 1
const val DELETE_ALL_OCCURRENCES = 2 const val DELETE_ALL_OCCURRENCES = 2
const val EDIT_SELECTED_OCCURRENCE = 0
const val EDIT_FUTURE_OCCURRENCES = 1
const val EDIT_ALL_OCCURRENCES = 2
const val REMINDER_NOTIFICATION = 0 const val REMINDER_NOTIFICATION = 0
const val REMINDER_EMAIL = 1 const val REMINDER_EMAIL = 1