Skip to content

Commit

Permalink
[MIG] web_notify: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
baimont committed Feb 17, 2023
1 parent 5c33430 commit 7519689
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion web_notify/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "Web Notify",
"summary": """
Send notification messages to user""",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV," "AdaptiveCity," "Odoo Community Association (OCA)",
"development_status": "Production/Stable",
Expand Down
20 changes: 9 additions & 11 deletions web_notify/static/src/js/services/notification_services.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {browser} from "@web/core/browser/browser";
import {registry} from "@web/core/registry";

export const webNotificationService = {
dependencies: ["notification"],
dependencies: ["bus_service", "notification"],

start(env, {notification}) {
start(env, {bus_service, notification}) {
let webNotifTimeouts = {};
/**
* Displays the web notification on user's screen
Expand All @@ -28,17 +28,15 @@ export const webNotificationService = {
});
});
}
env.bus.on("WEB_CLIENT_READY", null, async () => {
const legacyEnv = owl.Component.env;
legacyEnv.services.bus_service.onNotification(this, (notifications) => {
for (const {payload, type} of notifications) {
if (type === "web.notify") {
displaywebNotification(payload);
}

bus_service.addEventListener("notification", ({detail: notifications}) => {
for (const {payload, type} of notifications) {
if (type === "web.notify") {
displaywebNotification(payload);
}
});
legacyEnv.services.bus_service.startPolling();
}
});
bus_service.start();
},
};

Expand Down

0 comments on commit 7519689

Please sign in to comment.