|  |  | @ -1,6 +1,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package org.thoughtcrime.securesms.notifications; |  |  |  | package org.thoughtcrime.securesms.notifications; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import android.content.Context; |  |  |  | import android.content.Context; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import android.os.Looper; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import androidx.annotation.MainThread; |  |  |  | import androidx.annotation.MainThread; | 
			
		
	
		
		
			
				
					
					|  |  |  | import androidx.annotation.NonNull; |  |  |  | import androidx.annotation.NonNull; | 
			
		
	
	
		
		
			
				
					|  |  | @ -13,6 +14,8 @@ import org.whispersystems.signalservice.loki.api.Poller; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.concurrent.TimeUnit; |  |  |  | import java.util.concurrent.TimeUnit; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import network.loki.messenger.BuildConfig; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | public class OptimizedMessageNotifier implements MessageNotifier { |  |  |  | public class OptimizedMessageNotifier implements MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |   private final MessageNotifier         wrapped; |  |  |  |   private final MessageNotifier         wrapped; | 
			
		
	
		
		
			
				
					
					|  |  |  |   private final Debouncer               debouncer; |  |  |  |   private final Debouncer               debouncer; | 
			
		
	
	
		
		
			
				
					|  |  | @ -39,9 +42,12 @@ public class OptimizedMessageNotifier implements MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @Override |  |  |  |   @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |   public void updateNotification(@NonNull Context context) { |  |  |  |   public void updateNotification(@NonNull Context context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (BuildConfig.DEBUG && Looper.myLooper() != Looper.getMainLooper()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       throw new AssertionError(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; |  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; | 
			
		
	
		
		
			
				
					
					|  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; |  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; | 
			
		
	
		
		
			
				
					
					|  |  |  |     Boolean isCaughtUp = false; |  |  |  |     boolean isCaughtUp = false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { |  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); |  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -55,9 +61,12 @@ public class OptimizedMessageNotifier implements MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @Override |  |  |  |   @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |   public void updateNotification(@NonNull Context context, long threadId) { |  |  |  |   public void updateNotification(@NonNull Context context, long threadId) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (BuildConfig.DEBUG && Looper.myLooper() != Looper.getMainLooper()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       throw new AssertionError(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; |  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; | 
			
		
	
		
		
			
				
					
					|  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; |  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; | 
			
		
	
		
		
			
				
					
					|  |  |  |     Boolean isCaughtUp = false; |  |  |  |     boolean isCaughtUp = false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { |  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); |  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -71,9 +80,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) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (BuildConfig.DEBUG && Looper.myLooper() != Looper.getMainLooper()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       throw new AssertionError(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; |  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; | 
			
		
	
		
		
			
				
					
					|  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; |  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; | 
			
		
	
		
		
			
				
					
					|  |  |  |     Boolean isCaughtUp = false; |  |  |  |     boolean isCaughtUp = false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { |  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); |  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -87,9 +99,12 @@ public class OptimizedMessageNotifier implements MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @Override |  |  |  |   @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |   public void updateNotification(@android.support.annotation.NonNull Context context, boolean signal, int reminderCount) { |  |  |  |   public void updateNotification(@android.support.annotation.NonNull Context context, boolean signal, int reminderCount) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (BuildConfig.DEBUG && Looper.myLooper() != Looper.getMainLooper()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       throw new AssertionError(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; |  |  |  |     Poller lokiPoller = ApplicationContext.getInstance(context).lokiPoller; | 
			
		
	
		
		
			
				
					
					|  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; |  |  |  |     LokiPublicChatManager lokiPublicChatManager = ApplicationContext.getInstance(context).lokiPublicChatManager; | 
			
		
	
		
		
			
				
					
					|  |  |  |     Boolean isCaughtUp = false; |  |  |  |     boolean isCaughtUp = false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { |  |  |  |     if (lokiPoller != null && lokiPublicChatManager != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); |  |  |  |       isCaughtUp = lokiPoller.isCaughtUp() && lokiPublicChatManager.areAllCaughtUp(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |