From 1f318d3b7e42be1c388950ebcfaee574ba8994f0 Mon Sep 17 00:00:00 2001 From: ibrahimmalhas <72560623+ibrahimmalhas@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:18:17 +0300 Subject: [PATCH 1/4] Update webpack.config.js added oneSignalRegistrationToken, since there was a missing key for the API body --- calling-web-push-notifications/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calling-web-push-notifications/webpack.config.js b/calling-web-push-notifications/webpack.config.js index 9fab7c5b..f663d678 100644 --- a/calling-web-push-notifications/webpack.config.js +++ b/calling-web-push-notifications/webpack.config.js @@ -31,7 +31,7 @@ const registerCommunicationUserForOneSignal = async (communicationUserToken) => }, data: JSON.stringify({ communicationUserId: communicationUserToken.user.communicationUserId, - oneSignalRegistrationToken, + oneSignalRegistrationToken: oneSignalRegistrationToken, oneSignalAppId: clientConfig.oneSignalAppId }) }).then((response) => { return response.data }); From c45b277b7da7a16011908bb162ca6252eb2084cc Mon Sep 17 00:00:00 2001 From: ibrahimmalhas <72560623+ibrahimmalhas@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:20:50 +0300 Subject: [PATCH 2/4] Update index.js adding fetch dependancy --- .../HandleIncomingCallEvent/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calling-web-push-notifications/IncomingCallListener_FunctionApp/HandleIncomingCallEvent/index.js b/calling-web-push-notifications/IncomingCallListener_FunctionApp/HandleIncomingCallEvent/index.js index 15889ad2..2d340931 100644 --- a/calling-web-push-notifications/IncomingCallListener_FunctionApp/HandleIncomingCallEvent/index.js +++ b/calling-web-push-notifications/IncomingCallListener_FunctionApp/HandleIncomingCallEvent/index.js @@ -1,5 +1,5 @@ const { getOneSignalRegistrationInfo } = require('../Shared/OneSignalRegistrationTokens.js'); - +const fetch = require("node-fetch"); // Your OneSignal app info const app1_oneSignalAppId = ''; const app1_oneSignalRestApiKey = 'Basic '; @@ -47,4 +47,4 @@ module.exports = async function (context, eventGridEvent) { context.error(e); throw e; } -}; \ No newline at end of file +}; From b755e791949d003b17b9d9b49e96bbaa7cfa343a Mon Sep 17 00:00:00 2001 From: ibrahimmalhas <72560623+ibrahimmalhas@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:23:21 +0300 Subject: [PATCH 3/4] Update package.json adding missing fetch depenecy --- calling-web-push-notifications/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/calling-web-push-notifications/package.json b/calling-web-push-notifications/package.json index 96ed410a..0ef12ac8 100644 --- a/calling-web-push-notifications/package.json +++ b/calling-web-push-notifications/package.json @@ -7,6 +7,7 @@ "@azure/communication-calling": "1.13.2-beta.1", "@azure/communication-common": "^2.2.0", "@azure/logger": "^1.0.2", + "node-fetch": "^2.7.0", "react-onesignal": "^2.0.4" }, "scripts": { From e668fca9c10cc274dc3e242263476b8a5d54cfc8 Mon Sep 17 00:00:00 2001 From: ibrahimmalhas <72560623+ibrahimmalhas@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:25:30 +0300 Subject: [PATCH 4/4] Update OneSignalRegistrationTokens.js fixing type error getOneSignalRegistrationInfo & setOneSignalRegistrationInfo instead of getOneSignalRegistrationToken & setOneSignalRegistrationToken --- .../Shared/OneSignalRegistrationTokens.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/calling-web-push-notifications/IncomingCallListener_FunctionApp/Shared/OneSignalRegistrationTokens.js b/calling-web-push-notifications/IncomingCallListener_FunctionApp/Shared/OneSignalRegistrationTokens.js index 461c3b3d..c49f9385 100644 --- a/calling-web-push-notifications/IncomingCallListener_FunctionApp/Shared/OneSignalRegistrationTokens.js +++ b/calling-web-push-notifications/IncomingCallListener_FunctionApp/Shared/OneSignalRegistrationTokens.js @@ -1,14 +1,14 @@ const oneSignalRegistrationTokens = new Map(); -function getOneSignalRegistrationToken(communicationUserId) { +function getOneSignalRegistrationInfo(communicationUserId) { return oneSignalRegistrationTokens.get(communicationUserId); } -function setOneSignalRegistrationToken(communicationUserId, token) { +function setOneSignalRegistrationInfo(communicationUserId, token) { oneSignalRegistrationTokens.set(communicationUserId, token); } module.exports = { getOneSignalRegistrationToken, setOneSignalRegistrationToken -}; \ No newline at end of file +};