Commit 2980f558 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Set 5 minutes period for Google Accounts DAV syncs

We keep facing errors with Google Accounts mail, calendar,
contacts and tasks. This commit helps being less agressive on
Google servers which could potentially limit the sync requests.
parent fcee1f26
Pipeline #192014 passed with stage
in 3 minutes and 14 seconds
......@@ -199,6 +199,11 @@ class AccountDetailsFragment : Fragment() {
val name = MutableLiveData<String>()
val nameError = MutableLiveData<String>()
companion object {
const val GOOGLE_ACCOUNT_TYPE = "e.foundation.webdav.google"
const val GOOGLE_ACCOUNT_DEFAULT_SYNC_PERIOD_IN_S = 5 * 60L
}
fun createAccount(
activity: Activity,
name: String,
......@@ -333,9 +338,10 @@ class AccountDetailsFragment : Fragment() {
context.startService(refreshIntent)
// contact sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_address_books.xml
val syncInterval = provideSyncInterval(accountType, Constants.DEFAULT_CALENDAR_SYNC_INTERVAL)
accountSettings.setSyncInterval(
context.getString(R.string.address_books_authority),
Constants.DEFAULT_CALENDAR_SYNC_INTERVAL
syncInterval
)
} else
ContentResolver.setIsSyncable(
......@@ -361,9 +367,10 @@ class AccountDetailsFragment : Fragment() {
context.startService(refreshIntent)
// calendar sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_calendars.xml
val syncInterval = provideSyncInterval(accountType, Constants.DEFAULT_CALENDAR_SYNC_INTERVAL)
accountSettings.setSyncInterval(
CalendarContract.AUTHORITY,
Constants.DEFAULT_CALENDAR_SYNC_INTERVAL
syncInterval
)
// enable task sync if OpenTasks is installed
......@@ -374,9 +381,10 @@ class AccountDetailsFragment : Fragment() {
TaskProvider.ProviderName.OpenTasks.authority,
1
)
val syncInterval = provideSyncInterval(accountType, Constants.DEFAULT_CALENDAR_SYNC_INTERVAL)
accountSettings.setSyncInterval(
TaskProvider.ProviderName.OpenTasks.authority,
Constants.DEFAULT_CALENDAR_SYNC_INTERVAL
syncInterval
)
}
} else {
......@@ -398,6 +406,13 @@ class AccountDetailsFragment : Fragment() {
return result
}
private fun provideSyncInterval(type: String, fallback: Long): Long {
if (type == GOOGLE_ACCOUNT_TYPE) {
return GOOGLE_ACCOUNT_DEFAULT_SYNC_PERIOD_IN_S
}
return fallback
}
private fun insertService(
db: AppDatabase,
accountName: String,
......
......@@ -152,6 +152,8 @@
<string name="settings_sync_interval_tasks">مدة مزامنة المهام</string>
<string-array name="settings_sync_interval_names">
<item>يدوياً فقط</item>
<item>كل 2 دقيقة</item>
<item>كل 5 دقيقة</item>
<item>كل 15 دقيقة</item>
<item>كل 30 دقيقة</item>
<item>كل ساعة</item>
......@@ -253,4 +255,4 @@
<string name="google_account_name">جوجل</string>
<string name="account_title_google_address_book">دليل عناوين جوجل</string>
<string name="account_title_eelo_address_book">دليل العناوين</string>
</resources>
\ No newline at end of file
</resources>
......@@ -138,6 +138,8 @@
<string name="settings_sync_interval_tasks">Период за синхронизиране на задачи</string>
<string-array name="settings_sync_interval_names">
<item>Само изрично</item>
<item>Всеки 2 минути</item>
<item>Всеки 5 минути</item>
<item>Всеки 15 минути</item>
<item>На половин час</item>
<item>Всеки час</item>
......@@ -256,4 +258,4 @@
<string name="google_account_name">Google</string>
<string name="account_name">WebDAV</string>
<string name="google_alert_title">ВНИМАНИЕ</string>
</resources>
\ No newline at end of file
</resources>
......@@ -85,6 +85,8 @@
<string name="settings_sync_summary_manually">Només a mà</string>
<string-array name="settings_sync_interval_names">
<item>Només a mà</item>
<item>Cada 2 minuts</item>
<item>Cada 5 minuts</item>
<item>Cada 15 minuts</item>
<item>Cada 30 minuts</item>
<item>Cada hora</item>
......
......@@ -158,6 +158,7 @@
<string-array name="settings_sync_interval_names">
<item>Kun manuelt</item>
<item>Hvert andet minut</item>
<item>Hvert 5. minut</item>
<item>Hvert 15. minut</item>
<item>Hver halve time</item>
<item>Hver time</item>
......
......@@ -163,6 +163,7 @@
<string-array name="settings_sync_interval_names">
<item>Nur manuell</item>
<item>alle 2 Minuten</item>
<item>alle 5 Minuten</item>
<item>Alle 15 Minuten</item>
<item>Alle 30 Minuten</item>
<item>Jede Stunde</item>
......@@ -325,4 +326,4 @@
\n
\nBemerkung: Du kannst diesen Schritt auch überspringen, und ein Konto später unter den Einstellungen hinzufügen. Falls du auf Schwierigkeiten triffst, kontaktiere bitte den Kundendienst.</string>
<string name="sign_in">Anmelden</string>
</resources>
\ No newline at end of file
</resources>
......@@ -157,6 +157,8 @@
<string name="settings_sync_interval_tasks">Μεσοδιάστημα συγχρονισμού εργασιών</string>
<string-array name="settings_sync_interval_names">
<item>Μόνο χειροκίνητα</item>
<item>Κάθε 2 λεπτά</item>
<item>Κάθε 5 λεπτά</item>
<item>Κάθε 15 λεπτά</item>
<item>Κάθε 30 λεπτά</item>
<item>Κάθε ώρα</item>
......
......@@ -158,6 +158,8 @@
<string name="settings_sync_interval_tasks">Intervalo de sincronizacion de Tasks</string>
<string-array name="settings_sync_interval_names">
<item>Solo manualmente</item>
<item>Cada 2 minutos</item>
<item>Cada 5 minutos</item>
<item>Cada 15 minutos</item>
<item>Cada 30 minutos</item>
<item>Cada hora</item>
......@@ -289,4 +291,4 @@
<string name="google_alert_message">/e/ reportará un dispositivo falso a Google para proteger su privacidad.
\nPuedes revisar cuáles en \"Tus dispositivos\" de Google después de iniciar sesión.</string>
<string name="google_alert_title">ADVERTENCIA</string>
</resources>
\ No newline at end of file
</resources>
......@@ -156,6 +156,8 @@
<string name="settings_sync_interval_tasks">تسک همگام سازی شد. </string>
<string-array name="settings_sync_interval_names">
<item>فقط به صورت دستی</item>
<item>هر 2 دقیقه</item>
<item>هر 5 دقیقه</item>
<item>هر 15 دقیقه</item>
<item>هر 30 دقیقه</item>
<item>هر ساعت</item>
......
......@@ -160,6 +160,7 @@
<string-array name="settings_sync_interval_names">
<item>Manuellement</item>
<item>Toutes les 2 minutes</item>
<item>Toutes les 5 minutes</item>
<item>Tous les quarts d\'heure</item>
<item>Toutes les demi-heures</item>
<item>Toutes les heures</item>
......@@ -290,4 +291,4 @@
<string name="google_account_type">e.foundation.webdav.google</string>
<string name="google_account_name">Google</string>
<string name="account_name">WebDAV</string>
</resources>
\ No newline at end of file
</resources>
......@@ -159,6 +159,8 @@
<string name="settings_sync_interval_tasks">Intervalo sincr. de tarefas</string>
<string-array name="settings_sync_interval_names">
<item>Só manual</item>
<item>Cada 2 minutos</item>
<item>Cada 5 minutos</item>
<item>Cada 15 minutos</item>
<item>Cada 30 minutos</item>
<item>Cada hora</item>
......@@ -289,4 +291,4 @@
<string name="eelo_account_name">/e/</string>
<string name="google_account_type">e.foundation.webdav.google</string>
<string name="google_account_name">Google</string>
</resources>
\ No newline at end of file
</resources>
......@@ -159,6 +159,7 @@
<string-array name="settings_sync_interval_names">
<item>Solo manualmente</item>
<item>Ogni 2 minuti</item>
<item>Ogni 5 minuti</item>
<item>Ogni 15 minuti</item>
<item>Ogni 30 minuti</item>
<item>Ogni ora</item>
......@@ -290,4 +291,4 @@
<string name="google_account_type">e.foundation.webdav.google</string>
<string name="google_account_name">Google</string>
<string name="account_name">WebDAV</string>
</resources>
\ No newline at end of file
</resources>
......@@ -158,6 +158,7 @@
<string-array name="settings_sync_interval_names">
<item>手動のみ</item>
<item>2 分ごと</item>
<item>5 分ごと</item>
<item>15 分ごと</item>
<item>30 分ごと</item>
<item>1 時間ごと</item>
......
......@@ -151,6 +151,7 @@
<string-array name="settings_sync_interval_names">
<item>Bare manuelt</item>
<item>Hvert 2 minutter</item>
<item>Hvert 5 minutter</item>
<item>Hvert kvarter</item>
<item>Hver halvtime</item>
<item>Hver time</item>
......
......@@ -158,6 +158,8 @@
<string name="settings_sync_interval_tasks">Taak synchronisatie interval</string>
<string-array name="settings_sync_interval_names">
<item> Enkel handmatig </item>
<item> Iedere 2 minuten </item>
<item> Iedere 5 minuten </item>
<item> Iedere 15 minuten </item>
<item> Iedere 30 minuten</item>
<item>Ieder uur</item>
......@@ -320,4 +322,4 @@
\nProbeer het a.u.b. later opnieuw.
\n
\nOpmerking: je kan deze stap ook overslaan en later een account toevoegen in de Instellingen. Contacteer support in geval van problemen.</string>
</resources>
\ No newline at end of file
</resources>
......@@ -161,6 +161,7 @@
<string-array name="settings_sync_interval_names">
<item>Tylko ręcznie</item>
<item>Co 2 minuty</item>
<item>Co 5 minuty</item>
<item>Co 15 minut</item>
<item>Co 30 minut</item>
<item>Co godzinę</item>
......
......@@ -161,6 +161,7 @@
<string-array name="settings_sync_interval_names">
<item>Apenas manualmente</item>
<item>A cada 2 minutos</item>
<item>A cada 5 minutos</item>
<item>A cada 15 minutos</item>
<item>A cada 30 minutos</item>
<item>A cada hora</item>
......
......@@ -163,6 +163,7 @@
<string-array name="settings_sync_interval_names">
<item>Только вручную</item>
<item>Каждые 2 минуты</item>
<item>Каждые 5 минуты</item>
<item>Каждые 15 минут</item>
<item>Каждые 30 минут</item>
<item>Каждый час</item>
......@@ -297,4 +298,4 @@
<string name="login_eelo_server_uri_title">Использовать конкретный сервер</string>
<string name="login_server_uri_error">Требуется действительный URL адрес сервера</string>
<string name="login_server_uri">URL сервера (https://server_url)</string>
</resources>
\ No newline at end of file
</resources>
......@@ -156,6 +156,8 @@
<string name="settings_sync_interval_tasks">Synchr. interval pre úlohy</string>
<string-array name="settings_sync_interval_names">
<item>Iba manuálne</item>
<item>Každých 2 minút</item>
<item>Každých 5 minút</item>
<item>Každých 15 minút</item>
<item>Každých 30 minút</item>
<item>Každú hodinu</item>
......
......@@ -156,6 +156,8 @@
<string name="settings_sync_interval_tasks">Naloge interval sinhronizacij</string>
<string-array name="settings_sync_interval_names">
<item>Samo ročno</item>
<item>Vsakih 2 minut</item>
<item>Vsakih 5 minut</item>
<item>Vsakih 15 minut</item>
<item>Vsakih 30 minut</item>
<item>Vsako uro</item>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment