Skip to content

Commit

Permalink
Changed push notification from firebase to socket.io
Browse files Browse the repository at this point in the history
  • Loading branch information
NorouziM committed Oct 12, 2022
1 parent e40a5b6 commit 7fd6758
Show file tree
Hide file tree
Showing 7 changed files with 1,270 additions and 1,118 deletions.
218 changes: 109 additions & 109 deletions assets/notification.html

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,19 @@ ipcMain.on("print", (event, content, url, printOptions) => {
event.returnValue = "result";
});
});
ipcMain.on("orderReceived", (event, notification) => {
notifWindow.webContents.send("orderReceived", notification);
ipcMain.on("orderReceived", (event, order) => {
notifWindow.webContents.send("orderReceived", order);
notifWindow.moveTop();
notifWindow.show();
});
ipcMain.on("hideNotification", () => {
notifWindow.hide();
});

ipcMain.on("redirectOrder", (event, notification) => {
if (notification.click_action) {
let split = notification.click_action.split("/");
const orderId = split[split.length - 1];
mainWindow.webContents.send("redirectOrder", orderId);
ipcMain.on("redirectOrder", async (event, order) => {
if (order) {
await mainWindow.webContents.executeJavaScript(`localStorage.setItem("selectedSiteDomain", "${order.siteDomain}")`);
mainWindow.webContents.send("redirectOrder", order);
}
});
ipcMain.handle("request", async (_, axios_request, headers) => {
Expand Down
Loading

0 comments on commit 7fd6758

Please sign in to comment.