Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MKCALENDAR: send VTIMEZONE in calendar-timezone #1044

Merged
merged 22 commits into from
Oct 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Renamed timezoneDef to timezoneId
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
  • Loading branch information
ArnyminerZ committed Oct 2, 2024
commit 816bcb2e91ec5a2f88fb52982ed2c281f3aef9de
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class DavCollectionRepository @Inject constructor(
displayName = displayName,
description = description,
color = color,
timezoneDef = timeZoneId,
timezoneId = timeZoneId,
supportsVEVENT = supportVEVENT,
supportsVTODO = supportVTODO,
supportsVJOURNAL = supportVJOURNAL
Expand Down Expand Up @@ -291,7 +291,7 @@ class DavCollectionRepository @Inject constructor(
displayName: String?,
description: String?,
color: Int? = null,
timezoneDef: String? = null,
timezoneId: String? = null,
supportsVEVENT: Boolean = true,
supportsVTODO: Boolean = true,
supportsVJOURNAL: Boolean = true
Expand Down Expand Up @@ -347,15 +347,15 @@ class DavCollectionRepository @Inject constructor(
text(DavUtils.ARGBtoCalDAVColor(it))
}
}
timezoneDef?.let { timezoneId ->
timezoneId?.let { id ->
insertTag(CalendarTimezoneId.NAME) {
text(timezoneId)
text(id)
}
getVTimeZone(timezoneId)?.let {
getVTimeZone(id)?.let { vTimezone ->
insertTag(CalendarTimezone.NAME) {
text(
// spec requires "an iCalendar object with exactly one VTIMEZONE component"
Calendar(ComponentList(listOf(it))).toString()
Calendar(ComponentList(listOf(vTimezone))).toString()
)
}
}
Expand Down Expand Up @@ -391,8 +391,7 @@ class DavCollectionRepository @Inject constructor(
return writer.toString()
}

private fun getVTimeZone(tzId: String): VTimeZone? =
DateUtils.ical4jTimeZone(tzId)?.vTimeZone
private fun getVTimeZone(tzId: String): VTimeZone? = DateUtils.ical4jTimeZone(tzId)?.vTimeZone


/*** OBSERVERS ***/
Expand Down
Loading