fix(ios): prevent chat crash when Notifications API is unavailable on iPhones
- Guarded all Notification API usage to avoid ReferenceError on iOS Safari. - Set default permission to 'denied' when Notification is undefined. - Added early return in notification flow when Notifications API is unavailable. - Wrapped Notification.permission, requestPermission(), and new Notification(...) with typeof checks. - Updated SecureNotificationManager and app.jsx to degrade gracefully. - Verified build passes and chat loads correctly on iOS without notifications.
This commit is contained in:
6
dist/app.js
vendored
6
dist/app.js
vendored
@@ -296,8 +296,8 @@ var EnhancedConnectionSetup = ({
|
||||
if (!window.isSecureContext && window.location.protocol !== "https:" && window.location.hostname !== "localhost") {
|
||||
return;
|
||||
}
|
||||
const currentPermission = Notification.permission;
|
||||
if (currentPermission === "default") {
|
||||
const currentPermission = typeof Notification !== "undefined" && Notification ? Notification.permission : "denied";
|
||||
if (currentPermission === "default" && typeof Notification !== "undefined" && Notification) {
|
||||
const permission = await Notification.requestPermission();
|
||||
if (permission === "granted") {
|
||||
try {
|
||||
@@ -1678,7 +1678,7 @@ var EnhancedSecureP2PChat = () => {
|
||||
handleAnswerError,
|
||||
handleVerificationStateChange
|
||||
);
|
||||
if (Notification.permission === "granted" && window.NotificationIntegration && !notificationIntegrationRef.current) {
|
||||
if (typeof Notification !== "undefined" && Notification && Notification.permission === "granted" && window.NotificationIntegration && !notificationIntegrationRef.current) {
|
||||
try {
|
||||
const integration = new window.NotificationIntegration(webrtcManagerRef2.current);
|
||||
integration.init().then(() => {
|
||||
|
||||
4
dist/app.js.map
vendored
4
dist/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user