@ukpc-lib/react 0.2.18 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,21 +27,17 @@ firebase.initializeApp(firebaseConfig);
27
27
  const messaging = firebase.messaging();
28
28
 
29
29
  //Handle incoming messages while the app is not in focus (i.e in the background, hidden behind other tabs, or completely closed).
30
+ const channel = new BroadcastChannel('my-channel');
30
31
  messaging.onBackgroundMessage(function(payload) {
31
32
  console.log('Received background message ', payload);
32
33
 
33
- const notificationTitle = payload.data.message;
34
+ const notificationTitle = payload.data.userName;
34
35
  const notificationOptions = {
35
- body: payload.data.context,
36
- icon: 'https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg'
36
+ body: `${payload.data.message} ${payload.data.context}`,
37
+ icon: 'https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg',
37
38
  };
38
39
 
39
40
  self.registration.showNotification(notificationTitle,
40
41
  notificationOptions);
41
- // console.log('Received background message ', payload);
42
-
43
- // Use BroadcastChannel to send the message to the background script
44
- // const channel = new BroadcastChannel('my-channel');
45
- // channel.postMessage({ notificationTitle: payload.notification.title, notificationOptions: { body: payload.notification.body } });
42
+ channel.postMessage({notificationTitle, notificationOptions});
46
43
  });
47
-
@@ -1,4 +1,5 @@
1
1
  export type firebaseProps = {
2
+ baseUrl: string;
2
3
  path: string;
3
4
  apiKey: string;
4
5
  authDomain: string;