FIX: PWA badges were not updating (#15191)

That regressed in #7714, over two years ago. :P
This commit is contained in:
Jarek Radosz 2021-12-05 00:15:51 +01:00 committed by GitHub
parent 03f3d79388
commit d3912075b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,15 +13,12 @@ export default {
return;
} // must be logged in
this.notifications =
user.unread_notifications + user.unread_high_priority_notifications;
const appEvents = container.lookup("service:app-events");
appEvents.on("notifications:changed", () => {
const notifications =
user.unread_notifications + user.unread_high_priority_notifications;
container
.lookup("service:app-events")
.on("notifications:changed", this, "_updateBadge");
},
_updateBadge() {
navigator.setAppBadge(this.notifications);
navigator.setAppBadge(notifications);
});
},
};