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

Unverified Commit 979123b9 authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Add option to select detected collections for synchronization automatically

parent 7367477e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import at.bitfire.davdroid.log.Logger
import at.bitfire.davdroid.model.*
import at.bitfire.davdroid.model.Collection
import at.bitfire.davdroid.settings.AccountSettings
import at.bitfire.davdroid.settings.Settings
import at.bitfire.davdroid.settings.SettingsManager
import at.bitfire.davdroid.ui.DebugInfoActivity
import at.bitfire.davdroid.ui.NotificationUtils
import okhttp3.HttpUrl
@@ -150,6 +152,9 @@ class DavService: IntentService("DavService") {
    }

    private fun refreshCollections(db: AppDatabase, serviceId: Long) {
        val settings = SettingsManager.getInstance(this)
        val syncAllCollections = settings.getBoolean(Settings.SYNC_ALL_COLLECTIONS)

        val homeSetDao = db.homeSetDao()
        val collectionDao = db.collectionDao()

@@ -313,6 +318,10 @@ class DavService: IntentService("DavService") {
                            info.serviceId = serviceId
                            info.refHomeSet = homeSet
                            info.confirmed = true

                            // whether new collections are selected for synchronization by default (controlled by managed setting)
                            info.sync = syncAllCollections

                            info.owner = response[Owner::class.java]?.href?.let { response.href.resolve(it) }
                            Logger.log.log(Level.FINE, "Found collection", info)

+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ class DefaultsProvider(

    override val booleanDefaults = mutableMapOf(
        Pair(Settings.DISTRUST_SYSTEM_CERTIFICATES, false),
        Pair(Settings.SYNC_ALL_COLLECTIONS, false)
    )

    override val intDefaults = mapOf(
+3 −0
Original line number Diff line number Diff line
@@ -36,4 +36,7 @@ object Settings {

    const val PREFERRED_TASKS_PROVIDER = "preferred_tasks_provider"

    /** whether detected collections are selected for synchronization for default */
    const val SYNC_ALL_COLLECTIONS = "sync_all_collections"
    
}