diff --git a/src/org/thoughtcrime/securesms/loki/api/ClosedGroupPoller.kt b/src/org/thoughtcrime/securesms/loki/api/ClosedGroupPoller.kt index 4f1a1d1930..fe21134ffd 100644 --- a/src/org/thoughtcrime/securesms/loki/api/ClosedGroupPoller.kt +++ b/src/org/thoughtcrime/securesms/loki/api/ClosedGroupPoller.kt @@ -29,7 +29,7 @@ class ClosedGroupPoller private constructor(private val context: Context, privat // region Settings companion object { - private val pollInterval: Long = 2 * 1000 + private val pollInterval: Long = 4 * 1000 public lateinit var shared: ClosedGroupPoller diff --git a/src/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt b/src/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt index fc7c0b44e8..0b7cb3228d 100644 --- a/src/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt +++ b/src/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt @@ -6,9 +6,11 @@ import android.util.Log import org.thoughtcrime.securesms.database.Database import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper import org.thoughtcrime.securesms.loki.utilities.* +import org.thoughtcrime.securesms.util.TextSecurePreferences import org.whispersystems.signalservice.loki.api.Snode import org.whispersystems.signalservice.loki.database.LokiAPIDatabaseProtocol import org.whispersystems.signalservice.loki.protocol.shelved.multidevice.DeviceLink +import java.util.* class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), LokiAPIDatabaseProtocol { @@ -375,6 +377,16 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database( return database.delete(openGroupProfilePictureTable, "$publicChatID = ?", arrayOf(index)) > 0 } + override fun getLastSnodePoolRefreshDate(): Date? { + val time = TextSecurePreferences.getLastSnodePoolRefreshDate(context) + if (time <= 0) { return null } + return Date(time) + } + + override fun setLastSnodePoolRefreshDate(date: Date) { + TextSecurePreferences.setLastSnodePoolRefreshDate(context, date) + } + // region Deprecated override fun getDeviceLinks(publicKey: String): Set { return setOf() diff --git a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java index f6bb42247f..4787b48cf8 100644 --- a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java +++ b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.security.SecureRandom; import java.util.Arrays; import java.util.Collections; +import java.util.Date; import java.util.HashSet; import java.util.Set; @@ -1333,5 +1334,13 @@ public class TextSecurePreferences { public static void setHasSeenLightThemeIntroSheet(Context context) { setBooleanPreference(context, "has_seen_light_theme_intro_sheet", true); } + + public static long getLastSnodePoolRefreshDate(Context context) { + return getLongPreference(context, "last_snode_pool_refresh_date", 0); + } + + public static void setLastSnodePoolRefreshDate(Context context, Date date) { + setLongPreference(context, "last_snode_pool_refresh_date", date.getTime()); + } // endregion }