Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d9ddd48 authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Add ScheduleTag, update okhttp

parent d9a34bdc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@ import org.jetbrains.dokka.gradle.DokkaTask


object Libs {
object Libs {
    // okhttp HTTP library
    // okhttp HTTP library
    const val okhttpVersion = "4.6.0"
    const val okhttpVersion = "4.7.2"


    // XmlPullParser library
    // XmlPullParser library
    const val xpp3Version = "1.1.6"
    const val xpp3Version = "1.1.6"
+1 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ object PropertyRegistry {
            QuotaAvailableBytes.Factory(),
            QuotaAvailableBytes.Factory(),
            QuotaUsedBytes.Factory(),
            QuotaUsedBytes.Factory(),
            ResourceType.Factory(),
            ResourceType.Factory(),
            ScheduleTag.Factory(),
            Source.Factory(),
            Source.Factory(),
            SupportedAddressData.Factory(),
            SupportedAddressData.Factory(),
            SupportedCalendarComponentSet.Factory(),
            SupportedCalendarComponentSet.Factory(),
+45 −0
Original line number Original line Diff line number Diff line
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package at.bitfire.dav4jvm.property

import at.bitfire.dav4jvm.Property
import at.bitfire.dav4jvm.PropertyFactory
import at.bitfire.dav4jvm.QuotedStringUtils
import at.bitfire.dav4jvm.XmlUtils
import okhttp3.Response
import org.xmlpull.v1.XmlPullParser

class ScheduleTag(
        rawScheduleTag: String?
): Property {

    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_CALDAV, "schedule-tag")

        fun fromResponse(response: Response) =
                response.header("Schedule-Tag")?.let { ScheduleTag(it) }
    }

    /* Value:  opaque-tag
       opaque-tag = quoted-string
    */
    val scheduleTag: String? = rawScheduleTag?.let { QuotedStringUtils.decodeQuotedString(it) }

    override fun toString() = scheduleTag ?: "(null)"


    class Factory : PropertyFactory {

        override fun getName() = NAME

        override fun create(parser: XmlPullParser) =
                ScheduleTag(XmlUtils.readText(parser))

    }

}