From b59887d4e0966de4960ab83de4bba0789b0cc0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 14 Oct 2019 10:02:24 +0200 Subject: [PATCH] [APIv2/Mobidziennik] Change all messages list sync frequency. --- .../v2/mobidziennik/data/web/MobidziennikWebMessagesAll.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/web/MobidziennikWebMessagesAll.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/web/MobidziennikWebMessagesAll.kt index 2c246620..a9581acb 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/web/MobidziennikWebMessagesAll.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/mobidziennik/data/web/MobidziennikWebMessagesAll.kt @@ -5,6 +5,7 @@ package pl.szczodrzynski.edziennik.api.v2.mobidziennik.data.web import org.jsoup.Jsoup +import pl.szczodrzynski.edziennik.DAY import pl.szczodrzynski.edziennik.api.v2.mobidziennik.DataMobidziennik import pl.szczodrzynski.edziennik.api.v2.mobidziennik.ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL import pl.szczodrzynski.edziennik.api.v2.mobidziennik.ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_INBOX @@ -32,7 +33,7 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik, val listElement = doc.getElementsByClass("spis").first() if (listElement == null) { - data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, SYNC_ALWAYS) + data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7*DAY) onSuccess() return@webGet } @@ -82,7 +83,9 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik, data.metadataList.add(Metadata(profileId, Metadata.TYPE_MESSAGE, message.id, true, true, addedDate)) } - data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, SYNC_ALWAYS) + // sync every 7 days as we probably don't except more than + // 30 received messages during a week, without any normal sync + data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7*DAY) onSuccess() } }