From a2a9a3e08c889e77fba0bbea97b98b4f738027ee Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 28 Aug 2020 16:46:14 +0300 Subject: [PATCH] Request sync after editing/removing a collection. --- .../syncadapter/ui/etebase/EditCollectionFragment.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt b/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt index 2647c5d1..5377704e 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt +++ b/app/src/main/java/com/etesync/syncadapter/ui/etebase/EditCollectionFragment.kt @@ -17,6 +17,7 @@ import com.etesync.syncadapter.CachedCollection import com.etesync.syncadapter.Constants import com.etesync.syncadapter.R import com.etesync.syncadapter.resource.LocalCalendar +import com.etesync.syncadapter.syncadapter.requestSync import com.etesync.syncadapter.ui.BaseActivity import org.apache.commons.lang3.StringUtils import org.jetbrains.anko.doAsync @@ -156,6 +157,10 @@ class EditCollectionFragment(private val cachedCollection: CachedCollection, pri val col = cachedCollection.col col.delete() uploadCollection(col) + val applicationContext = activity?.applicationContext + if (applicationContext != null) { + requestSync(applicationContext, model.value!!.account) + } activity?.finish() } catch (e: EtebaseException) { uiThread { @@ -206,6 +211,10 @@ class EditCollectionFragment(private val cachedCollection: CachedCollection, pri val col = cachedCollection.col col.meta = meta uploadCollection(col) + val applicationContext = activity?.applicationContext + if (applicationContext != null) { + requestSync(applicationContext, model.value!!.account) + } if (isCreating) { parentFragmentManager.commit { replace(R.id.fragment_container, ViewCollectionFragment())