session-specific notification badge

fix sk22#470
This commit is contained in:
sk 2023-03-21 10:03:31 +01:00
parent 797642b972
commit 58b000927a
3 changed files with 5 additions and 4 deletions

View File

@ -86,7 +86,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
} }
String accountID=account.getID(); String accountID=account.getID();
PushNotification pn=AccountSessionManager.getInstance().getAccount(accountID).getPushSubscriptionManager().decryptNotification(k, p, s); PushNotification pn=AccountSessionManager.getInstance().getAccount(accountID).getPushSubscriptionManager().decryptNotification(k, p, s);
E.post(new NotificationReceivedEvent(pn.notificationId+"")); E.post(new NotificationReceivedEvent(accountID, pn.notificationId+""));
new GetNotificationByID(pn.notificationId+"") new GetNotificationByID(pn.notificationId+"")
.setCallback(new Callback<>(){ .setCallback(new Callback<>(){
@Override @Override

View File

@ -1,8 +1,9 @@
package org.joinmastodon.android.events; package org.joinmastodon.android.events;
public class NotificationReceivedEvent { public class NotificationReceivedEvent {
public String id; public String account, id;
public NotificationReceivedEvent(String id) { public NotificationReceivedEvent(String account, String id) {
this.account = account;
this.id = id; this.id = id;
} }
} }

View File

@ -323,7 +323,7 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
@Subscribe @Subscribe
public void onNotificationReceived(NotificationReceivedEvent notificationReceivedEvent) { public void onNotificationReceived(NotificationReceivedEvent notificationReceivedEvent) {
setNotificationBadge(true); if (notificationReceivedEvent.account.equals(accountID)) setNotificationBadge(true);
} }
@Subscribe @Subscribe