mirror of
https://github.com/etesync/android
synced 2025-04-05 01:06:03 +00:00
Request sync after encryption password change.
This is because we need the journals to be up to date with the newly added key, or otherwise there could be issues when editing them.
This commit is contained in:
parent
45ba7ad5b9
commit
b382b8515c
@ -0,0 +1,20 @@
|
||||
package com.etesync.syncadapter.syncadapter
|
||||
|
||||
import android.accounts.Account
|
||||
import android.content.ContentResolver
|
||||
import android.os.Bundle
|
||||
import android.provider.CalendarContract
|
||||
import at.bitfire.ical4android.TaskProvider
|
||||
import com.etesync.syncadapter.App
|
||||
|
||||
|
||||
fun requestSync(account: Account?) {
|
||||
val authorities = arrayOf(App.addressBooksAuthority, CalendarContract.AUTHORITY, TaskProvider.ProviderName.OpenTasks.authority)
|
||||
|
||||
for (authority in authorities) {
|
||||
val extras = Bundle()
|
||||
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true) // manual sync
|
||||
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true) // run immediately (don't queue)
|
||||
ContentResolver.requestSync(account, authority, extras)
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ import com.etesync.syncadapter.model.JournalEntity
|
||||
import com.etesync.syncadapter.model.ServiceEntity
|
||||
import com.etesync.syncadapter.resource.LocalAddressBook
|
||||
import com.etesync.syncadapter.resource.LocalCalendar
|
||||
import com.etesync.syncadapter.syncadapter.requestSync
|
||||
import com.etesync.syncadapter.ui.setup.SetupUserInfoFragment
|
||||
import com.etesync.syncadapter.utils.HintManager
|
||||
import com.etesync.syncadapter.utils.ShowcaseBuilder
|
||||
@ -440,17 +441,6 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
|
||||
companion object {
|
||||
val EXTRA_ACCOUNT = "account"
|
||||
private val HINT_VIEW_COLLECTION = "ViewCollection"
|
||||
|
||||
protected fun requestSync(account: Account?) {
|
||||
val authorities = arrayOf(App.addressBooksAuthority, CalendarContract.AUTHORITY, TaskProvider.ProviderName.OpenTasks.authority)
|
||||
|
||||
for (authority in authorities) {
|
||||
val extras = Bundle()
|
||||
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true) // manual sync
|
||||
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true) // run immediately (don't queue)
|
||||
ContentResolver.requestSync(account, authority, extras)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.etesync.syncadapter.R
|
||||
import com.etesync.syncadapter.journalmanager.Crypto
|
||||
import com.etesync.syncadapter.journalmanager.JournalManager
|
||||
import com.etesync.syncadapter.journalmanager.UserInfoManager
|
||||
import com.etesync.syncadapter.syncadapter.requestSync
|
||||
import okhttp3.HttpUrl
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
@ -131,6 +132,8 @@ open class ChangeEncryptionPasswordActivity : BaseActivity() {
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
this@ChangeEncryptionPasswordActivity.finish()
|
||||
}.show()
|
||||
|
||||
requestSync(account)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
uiThread {
|
||||
|
Loading…
Reference in New Issue
Block a user