session-specific notification badge
fix sk22#470
This commit is contained in:
parent
5395855775
commit
5a9a3eb140
3 changed files with 5 additions and 4 deletions
|
@ -85,7 +85,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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,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
|
||||||
|
|
Loading…
Add table
Reference in a new issue