offer uploading local events to Google at activating sync
This commit is contained in:
parent
0d7653787c
commit
d1dd1f0142
16 changed files with 35 additions and 17 deletions
|
@ -26,6 +26,7 @@ import com.simplemobiletools.calendar.dialogs.SnoozePickerDialog
|
|||
import com.simplemobiletools.calendar.extensions.*
|
||||
import com.simplemobiletools.calendar.helpers.*
|
||||
import com.simplemobiletools.calendar.interfaces.GoogleSyncListener
|
||||
import com.simplemobiletools.calendar.models.Event
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
|
@ -357,10 +358,14 @@ class SettingsActivity : SimpleActivity() {
|
|||
getGoogleSyncService().colors().get().execute() // just checking if we have the permission for fetching user data
|
||||
storeCalendarData()
|
||||
config.googleSync = true
|
||||
FetchGoogleEventsTask(applicationContext, googleSyncListener).execute()
|
||||
runOnUiThread {
|
||||
settings_google_sync.isChecked = true
|
||||
val eventsToExport = dbHelper.getEventsToExport(true)
|
||||
if (eventsToExport.isNotEmpty()) {
|
||||
offerEventsUpload(eventsToExport)
|
||||
}
|
||||
}
|
||||
FetchGoogleEventsTask(applicationContext, googleSyncListener).execute()
|
||||
} catch (e: Exception) {
|
||||
if (e is UserRecoverableAuthIOException) {
|
||||
startActivityForResult(e.intent, REQUEST_AUTHORIZATION)
|
||||
|
@ -396,12 +401,25 @@ class SettingsActivity : SimpleActivity() {
|
|||
config.googleDefaultReminders = reminderMinutes.joinToString(",")
|
||||
}
|
||||
|
||||
val googleSyncListener = object : GoogleSyncListener {
|
||||
private val googleSyncListener = object : GoogleSyncListener {
|
||||
override fun syncCompleted() {
|
||||
toast(R.string.events_imported_successfully)
|
||||
}
|
||||
}
|
||||
|
||||
private fun offerEventsUpload(eventsToExport: ArrayList<Event>) {
|
||||
ConfirmationDialog(this, messageId = R.string.google_sync_existing) {
|
||||
Thread({
|
||||
eventsToExport.forEach {
|
||||
try {
|
||||
GoogleSyncHandler().tryInsertToGoogle(this, it)
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">A sincronização Google ainda não está terminada. Reporte os erros encontrados para hello@simplemobiletools.com. Obrigado!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google synchronizácia je v testovacej prevádzke, buďte opatrní pri spoliehaní sa na ňu. Nahlásenie akýchkoľvek ohlasov na hello@simplemobiletools.com je vítané. Vďaka!</string>
|
||||
<string name="google_sync_existing">Odoslať lokálne vytvorené udalosti do oblakov?</string>
|
||||
<string name="google_sync_existing">Nahrať momentálne existujúce udalosti Googlu?</string>
|
||||
<string name="google_sync_disabling">Vypnutie Google synchonizácie odstráni všetky synchronizované udalosti zo zariadenia, no v oblakoch ostanú nedotknuté.</string>
|
||||
<string name="google_sync_error_insert">Chyba pri nahrávaní udalosti na Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Chyba pri úprave udalosti na Googli: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
|
||||
<!-- Google sync -->
|
||||
<string name="google_sync_testing">Google sync is in a testing mode, please be cautions when relying on it. Reporting any feedback at hello@simplemobiletools.com would be appreciated. Thanks!</string>
|
||||
<string name="google_sync_existing">Send locally created events to the cloud?</string>
|
||||
<string name="google_sync_existing">Upload currently existing events to Google?</string>
|
||||
<string name="google_sync_disabling">Disabling Google sync will delete all synced events from your device, while leaving them intact in the cloud.</string>
|
||||
<string name="google_sync_error_insert">Error uploading event to Google: %1$s</string>
|
||||
<string name="google_sync_error_update">Error updating event at Google: %1$s</string>
|
||||
|
|
Loading…
Reference in a new issue