|  |  | @ -124,12 +124,20 @@ public class MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |       return; |  |  |  |       return; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     updateNotification(context, masterSecret, false, 0); |  |  |  |     updateNotification(context, masterSecret, false, false, 0); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   public static void updateNotification(@NonNull  Context context, |  |  |  |   public static void updateNotification(@NonNull  Context context, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                         @Nullable MasterSecret masterSecret, |  |  |  |                                         @Nullable MasterSecret masterSecret, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                         long threadId) |  |  |  |                                         long threadId) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     updateNotification(context, masterSecret, false, threadId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   public static void updateNotification(@NonNull  Context context, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                         @Nullable MasterSecret masterSecret, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                         boolean   includePushDatabase, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                         long      threadId) | 
			
		
	
		
		
			
				
					
					|  |  |  |   { |  |  |  |   { | 
			
		
	
		
		
			
				
					
					|  |  |  |     Recipients recipients = DatabaseFactory.getThreadDatabase(context) |  |  |  |     Recipients recipients = DatabaseFactory.getThreadDatabase(context) | 
			
		
	
		
		
			
				
					
					|  |  |  |                                            .getRecipientsForThreadId(threadId); |  |  |  |                                            .getRecipientsForThreadId(threadId); | 
			
		
	
	
		
		
			
				
					|  |  | @ -140,19 +148,20 @@ public class MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |       return; |  |  |  |       return; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (visibleThread == threadId) { |  |  |  |     if (visibleThread == threadId) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       ThreadDatabase threads = DatabaseFactory.getThreadDatabase(context); |  |  |  |       ThreadDatabase threads = DatabaseFactory.getThreadDatabase(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |       threads.setRead(threadId); |  |  |  |       threads.setRead(threadId); | 
			
		
	
		
		
			
				
					
					|  |  |  |       sendInThreadNotification(context, threads.getRecipientsForThreadId(threadId)); |  |  |  |       sendInThreadNotification(context, threads.getRecipientsForThreadId(threadId)); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } else { |  |  |  |     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |       updateNotification(context, masterSecret, true, 0); |  |  |  |       updateNotification(context, masterSecret, true, includePushDatabase, 0); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   private static void updateNotification(@NonNull  Context context, |  |  |  |   private static void updateNotification(@NonNull  Context context, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                          @Nullable MasterSecret masterSecret, |  |  |  |                                          @Nullable MasterSecret masterSecret, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                          boolean signal, int reminderCount) |  |  |  |                                          boolean signal, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                          boolean includePushDatabase, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                          int     reminderCount) | 
			
		
	
		
		
			
				
					
					|  |  |  |   { |  |  |  |   { | 
			
		
	
		
		
			
				
					
					|  |  |  |     Cursor telcoCursor = null; |  |  |  |     Cursor telcoCursor = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |     Cursor pushCursor  = null; |  |  |  |     Cursor pushCursor  = null; | 
			
		
	
	
		
		
			
				
					|  |  | @ -173,7 +182,9 @@ public class MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       NotificationState notificationState = constructNotificationState(context, masterSecret, telcoCursor); |  |  |  |       NotificationState notificationState = constructNotificationState(context, masterSecret, telcoCursor); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       appendPushNotificationState(context, masterSecret, notificationState, pushCursor); |  |  |  |       if (includePushDatabase) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         appendPushNotificationState(context, notificationState, pushCursor); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (notificationState.hasMultipleThreads()) { |  |  |  |       if (notificationState.hasMultipleThreads()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         sendMultipleThreadNotification(context, masterSecret, notificationState, signal); |  |  |  |         sendMultipleThreadNotification(context, masterSecret, notificationState, signal); | 
			
		
	
	
		
		
			
				
					|  |  | @ -382,13 +393,10 @@ public class MessageNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   private static void appendPushNotificationState(@NonNull  Context context, |  |  |  |   private static void appendPushNotificationState(@NonNull Context context, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                                   @Nullable MasterSecret masterSecret, |  |  |  |                                                   @NonNull NotificationState notificationState, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                                   @NonNull  NotificationState notificationState, |  |  |  |                                                   @NonNull Cursor cursor) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                                   @NonNull  Cursor cursor) |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   { |  |  |  |   { | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (masterSecret != null) return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     PushDatabase.Reader reader = null; |  |  |  |     PushDatabase.Reader reader = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |     TextSecureEnvelope envelope; |  |  |  |     TextSecureEnvelope envelope; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |