properly store the events time zone at caldav sync

This commit is contained in:
tibbi 2019-12-10 18:46:07 +01:00
parent 36e168cdca
commit bac97b2d11
2 changed files with 4 additions and 2 deletions

View File

@ -253,6 +253,7 @@ class EventActivity : SimpleActivity() {
putSerializable(EVENT, mEvent)
putLong(START_TS, mEventStartDateTime.seconds())
putLong(END_TS, mEventEndDateTime.seconds())
putString(TIME_ZONE, mEvent.timeZone)
putInt(REMINDER_1_MINUTES, mReminder1Minutes)
putInt(REMINDER_2_MINUTES, mReminder2Minutes)
@ -284,6 +285,7 @@ class EventActivity : SimpleActivity() {
mEvent = getSerializable(EVENT) as Event
mEventStartDateTime = Formatter.getDateTimeFromTS(getLong(START_TS))
mEventEndDateTime = Formatter.getDateTimeFromTS(getLong(END_TS))
mEvent.timeZone = getString(TIME_ZONE) ?: TimeZone.getDefault().id
mReminder1Minutes = getInt(REMINDER_1_MINUTES)
mReminder2Minutes = getInt(REMINDER_2_MINUTES)
@ -967,7 +969,7 @@ class EventActivity : SimpleActivity() {
reminder3Type = mReminder3Type
repeatInterval = mRepeatInterval
importId = newImportId
timeZone = DateTimeZone.getDefault().id
timeZone = if (mEvent.timeZone.isEmpty()) TimeZone.getDefault().id else timeZone
flags = mEvent.flags.addBitIf(event_all_day.isChecked, FLAG_ALL_DAY)
repeatLimit = if (repeatInterval == 0) 0 else mRepeatLimit
repeatRule = mRepeatRule

View File

@ -412,7 +412,7 @@ class CalDAVHelper(val context: Context) {
put(CalendarContract.Events.DESCRIPTION, event.description)
put(CalendarContract.Events.DTSTART, event.startTS * 1000L)
put(CalendarContract.Events.ALL_DAY, if (event.getIsAllDay()) 1 else 0)
put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString())
put(CalendarContract.Events.EVENT_TIMEZONE, event.getTimeZoneString())
put(CalendarContract.Events.EVENT_LOCATION, event.location)
put(CalendarContract.Events.STATUS, CalendarContract.Events.STATUS_CONFIRMED)