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

Commit b08d3ddb authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Make PropertyFactory registration public; update okhttp/kotlin

parent 64cacb2b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4,14 +4,14 @@ object Libs {
    // We'll use 3.12 for now, but this branch won't receive feature updates anymore. Security
    // updates are limited to Dec 2020, so we'll have to update to 3.13 until then. On Android,
    // using 3.13 will raise the required SDK level to Android 5.
    const val okhttpVersion = "3.12.3"
    const val okhttpVersion = "3.12.5"

    // XmlPullParser library
    const val xpp3Version = "1.1.6"
}

plugins {
    kotlin("jvm") version "1.3.41"
    kotlin("jvm") version "1.3.50"

    id("com.github.kukuhyoniatmoko.buildconfigkotlin") version "1.0.5"
    id("org.jetbrains.dokka") version "0.9.18"

settings.gradle

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
+21 −5
Original line number Diff line number Diff line
@@ -17,17 +17,33 @@ object PropertyRegistry {

    init {
        Constants.log.info("Registering DAV property factories")
        for (factory in ServiceLoader.load(PropertyFactory::class.java)) {
            Constants.log.fine("Registering ${factory::class.java.name} for ${factory.getName()}")
            register(factory)
        }
        register(ServiceLoader.load(PropertyFactory::class.java))
    }


    private fun register(factory: PropertyFactory) {
    /**
     * Registers a property factory, so that objects for all WebDAV properties which are handled
     * by this factory can be created.
     *
     * @param factory property factory to be registered
     */
    fun register(factory: PropertyFactory) {
        Constants.log.fine("Registering ${factory::class.java.name} for ${factory.getName()}")
        factories[factory.getName()] = factory
    }

    /**
     * Registers some property factories, so that objects for all WebDAV properties which are handled
     * by these factories can be created.

     * @param factories property factories to be registered
     */
    fun register(factories: Iterable<PropertyFactory>) {
        factories.forEach {
            register(it)
        }
    }

    fun create(name: Property.Name, parser: XmlPullParser) =
            try {
                factories[name]?.create(parser)