mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-03-27 16:50:08 +01:00
delete the synced events from the device at disabling google sync
This commit is contained in:
parent
9357ab7bca
commit
f726e8c00e
@ -115,12 +115,15 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
private fun setupGoogleSync() {
|
private fun setupGoogleSync() {
|
||||||
settings_google_sync.isChecked = config.googleSync
|
settings_google_sync.isChecked = config.googleSync
|
||||||
settings_google_sync_holder.setOnClickListener {
|
settings_google_sync_holder.setOnClickListener {
|
||||||
if (!config.googleSync) {
|
if (config.googleSync) {
|
||||||
ConfirmationDialog(this, getString(R.string.google_sync_testing), positive = R.string.ok, negative = 0) {
|
ConfirmationDialog(this, getString(R.string.google_sync_disabling), positive = R.string.ok, negative = R.string.cancel) {
|
||||||
|
dbHelper.deleteGoogleSyncEvents()
|
||||||
toggleGoogleSync()
|
toggleGoogleSync()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toggleGoogleSync()
|
ConfirmationDialog(this, getString(R.string.google_sync_testing), positive = R.string.ok, negative = 0) {
|
||||||
|
toggleGoogleSync()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,6 +365,14 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
deleteEvents(childIds.toTypedArray())
|
deleteEvents(childIds.toTypedArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun deleteGoogleSyncEvents() {
|
||||||
|
val selection = "$COL_SOURCE = $SOURCE_GOOGLE_SYNC"
|
||||||
|
val cursor = getEventsCursor(selection)
|
||||||
|
val events = fillEvents(cursor)
|
||||||
|
val eventIDs = Array(events.size, { i -> (events[i].id.toString()) })
|
||||||
|
deleteEvents(eventIDs)
|
||||||
|
}
|
||||||
|
|
||||||
fun addEventRepeatException(parentEventId: Int, occurrenceTS: Int) {
|
fun addEventRepeatException(parentEventId: Int, occurrenceTS: Int) {
|
||||||
fillExceptionValues(parentEventId, occurrenceTS) {
|
fillExceptionValues(parentEventId, occurrenceTS) {
|
||||||
mDb.insert(EXCEPTIONS_TABLE_NAME, null, it)
|
mDb.insert(EXCEPTIONS_TABLE_NAME, null, it)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user