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
Show file tree
Hide file tree
Changes from 6 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import at.bitfire.dav4jvm.XmlUtils.insertTag
import at.bitfire.dav4jvm.property.caldav.CalendarColor
import at.bitfire.dav4jvm.property.caldav.CalendarDescription
import at.bitfire.dav4jvm.property.caldav.CalendarTimezone
import at.bitfire.dav4jvm.property.caldav.CalendarTimezoneId
import at.bitfire.dav4jvm.property.caldav.NS_CALDAV
import at.bitfire.dav4jvm.property.caldav.SupportedCalendarComponentSet
import at.bitfire.dav4jvm.property.carddav.AddressbookDescription
Expand All @@ -33,15 +34,18 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import dagger.multibindings.Multibinds
import java.io.StringWriter
import java.util.Collections
import java.util.UUID
import javax.inject.Inject
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runInterruptible
import kotlinx.coroutines.withContext
import net.fortuna.ical4j.model.Calendar
import net.fortuna.ical4j.model.Component
import net.fortuna.ical4j.model.ComponentList
import net.fortuna.ical4j.model.component.VTimeZone
import okhttp3.HttpUrl
import java.io.StringWriter
import java.util.Collections
import java.util.UUID
import javax.inject.Inject

/**
* Repository for managing collections.
Expand Down Expand Up @@ -147,7 +151,7 @@ class DavCollectionRepository @Inject constructor(
displayName = displayName,
description = description,
color = color,
timezone = timeZoneId?.let { getVTimeZone(it) },
timezone = timeZoneId?.let { getVTimeZone(it)?.toString() },
supportsVEVENT = supportVEVENT,
supportsVTODO = supportVTODO,
supportsVJOURNAL = supportVJOURNAL
Expand Down Expand Up @@ -343,9 +347,16 @@ class DavCollectionRepository @Inject constructor(
text(DavUtils.ARGBtoCalDAVColor(it))
}
}
timezoneDef?.let {
insertTag(CalendarTimezone.NAME) {
cdsect(it)
timezoneDef?.let { timezoneId ->
ArnyminerZ marked this conversation as resolved.
Show resolved Hide resolved
insertTag(CalendarTimezoneId.NAME) {
text(timezoneId)
}
getVTimeZone(timezoneId)?.let {
ArnyminerZ marked this conversation as resolved.
Show resolved Hide resolved
insertTag(CalendarTimezone.NAME) {
text(
Calendar(ComponentList(listOf(it))).toString()
ArnyminerZ marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
}

Expand Down Expand Up @@ -379,8 +390,8 @@ class DavCollectionRepository @Inject constructor(
return writer.toString()
}

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


/*** OBSERVERS ***/
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ androidx-test-rules = "1.6.1"
androidx-test-junit = "1.2.1"
androidx-work = "2.9.1"
bitfire-cert4android = "f1cc9b9ca3"
bitfire-dav4jvm = "c1bc143488"
bitfire-dav4jvm = "fbd95a5f5a"
bitfire-ical4android = "b75f33972a"
bitfire-vcard4android = "505848a85a"
compose-accompanist = "0.36.0"
Expand Down
Loading