clear Google sync queue if google sync is turned off
This commit is contained in:
parent
20a5ef2a69
commit
8160443ac5
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue