mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
update notification bar on entering a chat (fixes #725)
This commit is contained in:
@@ -193,12 +193,14 @@ public class MessageNotifier {
|
||||
return;
|
||||
}
|
||||
|
||||
removePendingNotifications(chatId);
|
||||
if (isVisible && signal) {
|
||||
sendInChatNotification(context, chatId);
|
||||
} else if (visibleChatId != NO_VISIBLE_CHAT_ID) {
|
||||
pendingNotifications.push(new Pair<>(chatId, signal));
|
||||
} else if (isVisible || visibleChatId == NO_VISIBLE_CHAT_ID) {
|
||||
updateNotification(context, false, 0);
|
||||
} else {
|
||||
updateNotification(context, signal, 0);
|
||||
//different chat is visible
|
||||
pendingNotifications.push(new Pair<>(chatId, signal));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,6 +340,15 @@ public class MessageNotifier {
|
||||
NotificationManagerCompat.from(context).notify(SUMMARY_NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
private static void removePendingNotifications(int chatId) {
|
||||
for (Pair<Integer, Boolean> pendingNotification : pendingNotifications) {
|
||||
if (pendingNotification.first() == chatId) {
|
||||
pendingNotifications.remove(pendingNotification);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendInChatNotification(Context context, int chatId) {
|
||||
if (!Prefs.isInChatNotifications(context) ||
|
||||
ServiceUtil.getAudioManager(context).getRingerMode() != AudioManager.RINGER_MODE_NORMAL)
|
||||
@@ -345,7 +356,7 @@ public class MessageNotifier {
|
||||
return;
|
||||
}
|
||||
|
||||
if( Prefs.isChatMuted(context, chatId) ) {
|
||||
if(Prefs.isChatMuted(context, chatId)) {
|
||||
Log.d(TAG, "chat muted");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user