|
|
@ -12,6 +12,7 @@ import org.session.libsession.utilities.recipients.Recipient;
|
|
|
|
import org.session.libsession.utilities.Debouncer;
|
|
|
|
import org.session.libsession.utilities.Debouncer;
|
|
|
|
import org.session.libsignal.utilities.ThreadUtils;
|
|
|
|
import org.session.libsignal.utilities.ThreadUtils;
|
|
|
|
import org.thoughtcrime.securesms.ApplicationContext;
|
|
|
|
import org.thoughtcrime.securesms.ApplicationContext;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.loki.api.OpenGroupManager;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
@ -42,18 +43,12 @@ public class OptimizedMessageNotifier implements MessageNotifier {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateNotification(@NonNull Context context) {
|
|
|
|
public void updateNotification(@NonNull Context context) {
|
|
|
|
Poller poller = ApplicationContext.getInstance(context).poller;
|
|
|
|
Poller poller = ApplicationContext.getInstance(context).poller;
|
|
|
|
// FIXME: Open group handling
|
|
|
|
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
if (poller != null) {
|
|
|
|
if (poller != null) {
|
|
|
|
isCaughtUp = isCaughtUp && poller.isCaughtUp();
|
|
|
|
isCaughtUp = isCaughtUp && poller.isCaughtUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Open group handling
|
|
|
|
isCaughtUp = isCaughtUp && OpenGroupManager.INSTANCE.isAllCaughtUp();
|
|
|
|
/*
|
|
|
|
|
|
|
|
if (publicChatManager != null) {
|
|
|
|
|
|
|
|
isCaughtUp = isCaughtUp && publicChatManager.areAllCaughtUp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isCaughtUp) {
|
|
|
|
if (isCaughtUp) {
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context));
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context));
|
|
|
@ -65,18 +60,12 @@ public class OptimizedMessageNotifier implements MessageNotifier {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateNotification(@NonNull Context context, long threadId) {
|
|
|
|
public void updateNotification(@NonNull Context context, long threadId) {
|
|
|
|
Poller lokiPoller = ApplicationContext.getInstance(context).poller;
|
|
|
|
Poller lokiPoller = ApplicationContext.getInstance(context).poller;
|
|
|
|
// FIXME: Open group handling
|
|
|
|
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
if (lokiPoller != null) {
|
|
|
|
if (lokiPoller != null) {
|
|
|
|
isCaughtUp = isCaughtUp && lokiPoller.isCaughtUp();
|
|
|
|
isCaughtUp = isCaughtUp && lokiPoller.isCaughtUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Open group handling
|
|
|
|
isCaughtUp = isCaughtUp && OpenGroupManager.INSTANCE.isAllCaughtUp();
|
|
|
|
/*
|
|
|
|
|
|
|
|
if (publicChatManager != null) {
|
|
|
|
|
|
|
|
isCaughtUp = isCaughtUp && publicChatManager.areAllCaughtUp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isCaughtUp) {
|
|
|
|
if (isCaughtUp) {
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context, threadId));
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context, threadId));
|
|
|
@ -88,18 +77,12 @@ public class OptimizedMessageNotifier implements MessageNotifier {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateNotification(@NonNull Context context, long threadId, boolean signal) {
|
|
|
|
public void updateNotification(@NonNull Context context, long threadId, boolean signal) {
|
|
|
|
Poller lokiPoller = ApplicationContext.getInstance(context).poller;
|
|
|
|
Poller lokiPoller = ApplicationContext.getInstance(context).poller;
|
|
|
|
// FIXME: Open group handling
|
|
|
|
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
if (lokiPoller != null) {
|
|
|
|
if (lokiPoller != null) {
|
|
|
|
isCaughtUp = isCaughtUp && lokiPoller.isCaughtUp();
|
|
|
|
isCaughtUp = isCaughtUp && lokiPoller.isCaughtUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Open group handling
|
|
|
|
isCaughtUp = isCaughtUp && OpenGroupManager.INSTANCE.isAllCaughtUp();
|
|
|
|
/*
|
|
|
|
|
|
|
|
if (publicChatManager != null) {
|
|
|
|
|
|
|
|
isCaughtUp = isCaughtUp && publicChatManager.areAllCaughtUp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isCaughtUp) {
|
|
|
|
if (isCaughtUp) {
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context, threadId, signal));
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context, threadId, signal));
|
|
|
@ -111,18 +94,12 @@ public class OptimizedMessageNotifier implements MessageNotifier {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateNotification(@androidx.annotation.NonNull Context context, boolean signal, int reminderCount) {
|
|
|
|
public void updateNotification(@androidx.annotation.NonNull Context context, boolean signal, int reminderCount) {
|
|
|
|
Poller lokiPoller = ApplicationContext.getInstance(context).poller;
|
|
|
|
Poller lokiPoller = ApplicationContext.getInstance(context).poller;
|
|
|
|
// FIXME: Open group handling
|
|
|
|
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
boolean isCaughtUp = true;
|
|
|
|
if (lokiPoller != null) {
|
|
|
|
if (lokiPoller != null) {
|
|
|
|
isCaughtUp = isCaughtUp && lokiPoller.isCaughtUp();
|
|
|
|
isCaughtUp = isCaughtUp && lokiPoller.isCaughtUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Open group handling
|
|
|
|
isCaughtUp = isCaughtUp && OpenGroupManager.INSTANCE.isAllCaughtUp();
|
|
|
|
/*
|
|
|
|
|
|
|
|
if (publicChatManager != null) {
|
|
|
|
|
|
|
|
isCaughtUp = isCaughtUp && publicChatManager.areAllCaughtUp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isCaughtUp) {
|
|
|
|
if (isCaughtUp) {
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context, signal, reminderCount));
|
|
|
|
performOnBackgroundThreadIfNeeded(() -> wrapped.updateNotification(context, signal, reminderCount));
|
|
|
|