mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 21:27:52 +00:00
implementation of polling limit on open groups
This commit is contained in:
@@ -22,6 +22,7 @@ class OpenGroupPollerV2(private val server: String, private val executorService:
|
||||
|
||||
companion object {
|
||||
private val pollInterval: Long = 4 * 1000
|
||||
const val maxInactivityPeriod = 14 * 24 * 60 * 60 * 1000
|
||||
}
|
||||
|
||||
fun startIfNeeded() {
|
||||
|
@@ -99,6 +99,11 @@ object TextSecurePreferences {
|
||||
|
||||
private const val GIF_GRID_LAYOUT = "pref_gif_grid_layout"
|
||||
|
||||
// region Limit open group polling
|
||||
|
||||
private const val LAST_TIME_SESSION_OPENED = "pref_last_time_session_open"
|
||||
private const val OPEN_GROUP_POLLING_LIMIT = "pref_Open_group_polling_limit"
|
||||
|
||||
// region FCM
|
||||
const val IS_USING_FCM = "pref_is_using_fcm"
|
||||
private const val FCM_TOKEN = "pref_fcm_token"
|
||||
@@ -771,5 +776,22 @@ object TextSecurePreferences {
|
||||
fun setHasSeenFileServerInstabilityNotification(context: Context) {
|
||||
setBooleanPreference(context, "has_seen_file_server_instability_notification", true)
|
||||
}
|
||||
|
||||
fun getLastTimeSessionOpened(context: Context): Long {
|
||||
return getLongPreference(context!!, LAST_TIME_SESSION_OPENED, 0)
|
||||
}
|
||||
|
||||
fun setLastTimeSessionOpened(context: Context) {
|
||||
setLongPreference(context, LAST_TIME_SESSION_OPENED, System.currentTimeMillis())
|
||||
}
|
||||
|
||||
fun isOpenGroupPollingLimit(context: Context): Boolean {
|
||||
return getBooleanPreference(context, OPEN_GROUP_POLLING_LIMIT, false)
|
||||
}
|
||||
|
||||
fun setOpenGroupPollingLimit(context: Context, limit: Boolean) {
|
||||
setBooleanPreference(context, OPEN_GROUP_POLLING_LIMIT, limit)
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
Reference in New Issue
Block a user