diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt index 3eed674f0..bd23a4a87 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt @@ -4,6 +4,7 @@ import android.content.Context import android.media.RingtoneManager import android.text.format.DateFormat import com.simplemobiletools.calendar.R +import com.simplemobiletools.calendar.extensions.googleSyncQueue import com.simplemobiletools.calendar.extensions.scheduleGoogleSync import com.simplemobiletools.commons.helpers.BaseConfig import java.util.* @@ -75,6 +76,9 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(GOOGLE_SYNC, false) set(googleSync) { context.scheduleGoogleSync(googleSync) + if (!googleSync) + context.googleSyncQueue.clearQueue() + prefs.edit().putBoolean(GOOGLE_SYNC, googleSync).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/GoogleSyncQueueDB.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/GoogleSyncQueueDB.kt index c3017de16..1a9aaa371 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/GoogleSyncQueueDB.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/GoogleSyncQueueDB.kt @@ -71,4 +71,8 @@ class GoogleSyncQueueDB private constructor(val context: Context) : SQLiteOpenHe val selection = "$COL_EVENT_ID = $eventId" mDb.delete(OPERATIONS_TABLE_NAME, selection, null) } + + fun clearQueue() { + mDb.delete(OPERATIONS_TABLE_NAME, null, null) + } }