mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 11:17:45 +00:00
new approach for batch notification
This commit is contained in:
@@ -207,7 +207,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
}
|
||||
startPollingIfNeeded();
|
||||
|
||||
OpenGroupManager.INSTANCE.markAllAsNotCaughtUp();
|
||||
OpenGroupManager.INSTANCE.setAllCaughtUp(false);
|
||||
OpenGroupManager.INSTANCE.startPolling();
|
||||
}
|
||||
|
||||
|
@@ -19,21 +19,7 @@ object OpenGroupManager {
|
||||
private var pollers = mutableMapOf<String, OpenGroupPollerV2>() // One for each server
|
||||
private var isPolling = false
|
||||
|
||||
val isAllCaughtUp: Boolean
|
||||
get() {
|
||||
pollers.values.forEach { poller ->
|
||||
if (!poller.isCaughtUp) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun markAllAsNotCaughtUp() {
|
||||
pollers.values.forEach { poller ->
|
||||
poller.isCaughtUp = false
|
||||
}
|
||||
}
|
||||
var isAllCaughtUp = false
|
||||
|
||||
fun startPolling() {
|
||||
if (isPolling) { return }
|
||||
|
@@ -56,6 +56,7 @@ import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.MediaMmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.loki.api.OpenGroupManager;
|
||||
import org.thoughtcrime.securesms.loki.protocol.SessionMetaProtocol;
|
||||
import org.thoughtcrime.securesms.loki.utilities.MentionUtilities;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
@@ -286,6 +287,9 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||
} finally {
|
||||
if (telcoCursor != null) telcoCursor.close();
|
||||
if (pushCursor != null) pushCursor.close();
|
||||
if (!OpenGroupManager.INSTANCE.isAllCaughtUp()) {
|
||||
OpenGroupManager.INSTANCE.setAllCaughtUp(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ public class OptimizedMessageNotifier implements MessageNotifier {
|
||||
@MainThread
|
||||
public OptimizedMessageNotifier(@NonNull MessageNotifier wrapped) {
|
||||
this.wrapped = wrapped;
|
||||
this.debouncer = new Debouncer(TimeUnit.SECONDS.toMillis(2));
|
||||
this.debouncer = new Debouncer(TimeUnit.SECONDS.toMillis(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user