mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-11 18:54:21 +00:00
Refresh snode pool at least once a day
This commit is contained in:
parent
98d582cade
commit
cfb7ff5296
@ -29,7 +29,7 @@ class ClosedGroupPoller private constructor(private val context: Context, privat
|
|||||||
|
|
||||||
// region Settings
|
// region Settings
|
||||||
companion object {
|
companion object {
|
||||||
private val pollInterval: Long = 2 * 1000
|
private val pollInterval: Long = 4 * 1000
|
||||||
|
|
||||||
public lateinit var shared: ClosedGroupPoller
|
public lateinit var shared: ClosedGroupPoller
|
||||||
|
|
||||||
|
@ -6,9 +6,11 @@ import android.util.Log
|
|||||||
import org.thoughtcrime.securesms.database.Database
|
import org.thoughtcrime.securesms.database.Database
|
||||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
||||||
import org.thoughtcrime.securesms.loki.utilities.*
|
import org.thoughtcrime.securesms.loki.utilities.*
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||||
import org.whispersystems.signalservice.loki.api.Snode
|
import org.whispersystems.signalservice.loki.api.Snode
|
||||||
import org.whispersystems.signalservice.loki.database.LokiAPIDatabaseProtocol
|
import org.whispersystems.signalservice.loki.database.LokiAPIDatabaseProtocol
|
||||||
import org.whispersystems.signalservice.loki.protocol.shelved.multidevice.DeviceLink
|
import org.whispersystems.signalservice.loki.protocol.shelved.multidevice.DeviceLink
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), LokiAPIDatabaseProtocol {
|
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
|
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
|
// region Deprecated
|
||||||
override fun getDeviceLinks(publicKey: String): Set<DeviceLink> {
|
override fun getDeviceLinks(publicKey: String): Set<DeviceLink> {
|
||||||
return setOf()
|
return setOf()
|
||||||
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
|||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -1333,5 +1334,13 @@ public class TextSecurePreferences {
|
|||||||
public static void setHasSeenLightThemeIntroSheet(Context context) {
|
public static void setHasSeenLightThemeIntroSheet(Context context) {
|
||||||
setBooleanPreference(context, "has_seen_light_theme_intro_sheet", true);
|
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
|
// endregion
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user