From 7766a8df79a42210ec10e9beaae4971f57ed1c96 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Tue, 14 Jan 2025 23:07:05 -0800 Subject: [PATCH] fixed push notifications on web app --- .../web/src/context/useAppContext.hook.ts | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/app/client/web/src/context/useAppContext.hook.ts b/app/client/web/src/context/useAppContext.hook.ts index 781adf75..5ca7ef63 100644 --- a/app/client/web/src/context/useAppContext.hook.ts +++ b/app/client/web/src/context/useAppContext.hook.ts @@ -6,6 +6,16 @@ import { StagingFiles } from '../StagingFiles' const databag = new DatabagSDK({ tagBatch: 32, topicBatch: 32, articleTypes: [], channelTypes: ['sealed', 'superbasic'] }, new WebCrypto(), new StagingFiles()) +const notifications = [ + { event: 'contact.addCard', messageTitle: 'New Contact Request' }, + { event: 'contact.updateCard', messageTitle: 'Contact Update' }, + { event: 'content.addChannel.superbasic', messageTitle: 'New Topic' }, + { event: 'content.addChannel.sealed', messageTitle: 'New Topic' }, + { event: 'content.addChannelTopic.superbasic', messageTitle: 'New Topic Message' }, + { event: 'content.addChannelTopic.sealed', messageTitle: 'New Topic Message' }, + { event: 'ring', messageTitle: 'Incoming Call' }, + ]; + export function useAppContext() { const sdk = useRef(databag) const [state, setState] = useState({ @@ -36,9 +46,9 @@ export function useAppContext() { topicBatch: 16, tagBatch: 16, channelTypes: ['test'], - pushType: 'fcm', - deviceToken: 'aabbcc', - notifications: [{ event: 'msg', messageTitle: 'msgd' }], + pushType: '', + deviceToken: '', + notifications: notifications, deviceId: '0011', version: '0.0.1', appName: 'databag', @@ -57,9 +67,9 @@ export function useAppContext() { topicBatch: 16, tagBatch: 16, channelTypes: ['test'], - pushType: 'fcm', - deviceToken: 'aabbcc', - notifications: [{ event: 'msg', messageTitle: 'msgd' }], + pushType: '', + deviceToken: '', + notifications: notifications, deviceId: '0011', version: '0.0.1', appName: 'databag', @@ -72,9 +82,9 @@ export function useAppContext() { topicBatch: 16, tagBatch: 16, channelTypes: ['test'], - pushType: 'fcm', - deviceToken: 'aabbcc', - notifications: [{ event: 'msg', messageTitle: 'msgd' }], + pushType: '', + deviceToken: '', + notifications: notifications, deviceId: '0011', version: '0.0.1', appName: 'databag',