From b17d4766d88288407ee0fa2db5eef170467ae8ba Mon Sep 17 00:00:00 2001 From: Chris-GW Date: Wed, 9 Nov 2022 20:27:27 +0100 Subject: [PATCH] fix regression #1847, only set Sync Manual flag at caldav syncing, when we showToasts to the user (swipe_refresh, MainMenu->refresh_caldav_calendars, ...). --- .../calendar/pro/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/calendar/pro/extensions/Context.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index 96d68f3d6..b16eaa9be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -134,7 +134,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { } swipe_refresh_layout.setOnRefreshListener { - refreshCalDAVCalendars(false) + refreshCalDAVCalendars(true) } checkIsViewIntent() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index 4d66f9426..c0e15a072 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -603,7 +603,10 @@ fun Context.refreshCalDAVCalendars(ids: String, showToasts: Boolean) { Bundle().apply { putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true) - putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true) + if (showToasts) { + // Assume this is a manual synchronisation when we showToasts to the user (swipe_refresh, MainMenu->refresh_caldav_calendars, ...) + putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true) + } accounts.forEach { ContentResolver.requestSync(it, uri.authority, this) }