Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/exception ios mweb notification #3367

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/react-sdk/src/hooks/useAwayNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,29 @@ export const useAwayNotifications = () => {
const requestPermission = useCallback(async () => {
// Headless check for beam
if (!('Notification' in window) || navigator.webdriver) {
console.debug('Request Permsissions : Notifications not supported or headless browser');
console.debug('Request Permissions : Notifications not supported or headless browser');
// Notifications not supported
return;
}
if (Notification?.permission === 'granted' || Notification?.permission === 'denied') {
return;
}
const unsubscribe = vanillaStore.subscribe(async role => {
if (role && role !== '__internal_recorder') {
await Notification.requestPermission();
unsubscribe?.();
try {
if (role && role !== '__internal_recorder') {
await Notification.requestPermission();
unsubscribe?.();
}
} catch (e) {
console.log('Error in requestPermission : ', e);
}
}, selectLocalPeerRoleName);
}, [vanillaStore]);

const showNotification = useCallback((title: string, options?: NotificationOptions) => {
// Notifications not supported
if (!('Notification' in window)) {
console.debug('Show Notifications: Notifications not supported or headless browser');
console.debug('Show Notifications : Notifications not supported or headless browser');
return;
}
if (
Expand Down