From 31540b5dd94fe2cd5499ca553ebe474fb62d2425 Mon Sep 17 00:00:00 2001 From: Josh Kasten Date: Wed, 18 Oct 2023 18:53:26 +0000 Subject: [PATCH] fix Safari on macOS native prompt with custom link macOS Safari requires a user gesture to show the native prompt, and doesn't allow disk I/O in the Promise. Switched to the opted in check to use optedIn since this uses a cached value which doesn't have this disk I/O issue. --- src/shared/managers/CustomLinkManager.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/shared/managers/CustomLinkManager.ts b/src/shared/managers/CustomLinkManager.ts index 245fde691..900e0e14f 100644 --- a/src/shared/managers/CustomLinkManager.ts +++ b/src/shared/managers/CustomLinkManager.ts @@ -146,9 +146,7 @@ export class CustomLinkManager { } private async handleClick(element: HTMLElement): Promise { - const isPushEnabled = - await OneSignal.context.subscriptionManager.isPushNotificationsEnabled(); - if (isPushEnabled) { + if (OneSignal.User.PushSubscription.optedIn) { await OneSignal.User.PushSubscription.optOut(); await this.setTextFromPushStatus(element); } else {