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

Commit 96763195 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

fix not syncable authority requested for periodic sync issue

parent 81ffd969
Loading
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -543,8 +543,8 @@ class AccountSettings(
        }
    }

    fun initSync() {
        val authorities = listOf(
    private fun getPeriodicSyncEnableAuthorities() =
        listOf(
            context.getString(R.string.address_books_authority),
            CalendarContract.AUTHORITY,
            context.getString(R.string.task_authority),
@@ -553,7 +553,8 @@ class AccountSettings(
            TaskProvider.ProviderName.TasksOrg.authority
        )

        authorities.forEach {
    fun initSync() {
        getPeriodicSyncEnableAuthorities().forEach {
            enablePeriodicWorkManager(it)
        }
    }
@@ -563,6 +564,10 @@ class AccountSettings(
            return
        }

        if (authority !in getPeriodicSyncEnableAuthorities()) {
            return
        }

        val interval = getSyncInterval(authority) ?: getDefaultSyncInterval(authority)
        setSyncInterval(authority, interval)
    }