REVERT: "DEV: APIs to disable PWA badging and unsubscribe from user notifications (#14595)" (#14620)
This reverts commit e1d3175668.
This commit is contained in:
parent
2427ea6613
commit
69381663eb
@ -1,19 +1,12 @@
|
||||
// Updates the PWA badging if available
|
||||
|
||||
let defaultBadgingDisabled = false;
|
||||
export function disableDefaultBadging() {
|
||||
defaultBadgingDisabled = true;
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "badging",
|
||||
after: "message-bus",
|
||||
|
||||
initialize(container) {
|
||||
// must have the Badging API
|
||||
if (defaultBadgingDisabled || !navigator.setAppBadge) {
|
||||
if (!navigator.setAppBadge) {
|
||||
return;
|
||||
}
|
||||
} // must have the Badging API
|
||||
|
||||
const user = container.lookup("current-user:main");
|
||||
if (!user) {
|
||||
|
||||
@ -13,20 +13,11 @@ import {
|
||||
} from "discourse/lib/push-notifications";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
|
||||
let subscribeToNotifications = true;
|
||||
export function unsubscribeFromNotifications() {
|
||||
subscribeToNotifications = false;
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "subscribe-user-notifications",
|
||||
after: "message-bus",
|
||||
|
||||
initialize(container) {
|
||||
if (!subscribeToNotifications) {
|
||||
return;
|
||||
}
|
||||
|
||||
const user = container.lookup("current-user:main");
|
||||
const bus = container.lookup("message-bus:main");
|
||||
const appEvents = container.lookup("service:app-events");
|
||||
|
||||
@ -90,8 +90,6 @@ import {
|
||||
addSearchSuggestion,
|
||||
} from "discourse/widgets/search-menu-results";
|
||||
import { CUSTOM_USER_SEARCH_OPTIONS } from "select-kit/components/user-chooser";
|
||||
import { unsubscribeFromNotifications } from "discourse/initializers/subscribe-user-notifications";
|
||||
import { disableDefaultBadging } from "discourse/initializers/badging";
|
||||
import { downloadCalendar } from "discourse/lib/download-calendar";
|
||||
|
||||
// If you add any methods to the API ensure you bump up this number
|
||||
@ -1513,14 +1511,6 @@ class PluginApi {
|
||||
{ ignoreMissing: true }
|
||||
);
|
||||
}
|
||||
// Stops the subscribe-user-notifications initializer from listening to notifications
|
||||
unsubscribeFromNotifications() {
|
||||
unsubscribeFromNotifications();
|
||||
}
|
||||
// Stops the badging initializer from updating the PWA badge with the user's notification count
|
||||
disableDefaultBadging() {
|
||||
disableDefaultBadging();
|
||||
}
|
||||
|
||||
/**
|
||||
* Support for customizing the composer text. By providing a callback. Callbacks should
|
||||
|
||||
Reference in New Issue
Block a user