Skip to content

Commit

Permalink
fix Safari on macOS native prompt with custom link
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jkasten2 committed Oct 18, 2023
1 parent b83a9d1 commit 31540b5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/shared/managers/CustomLinkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ export class CustomLinkManager {
}

private async handleClick(element: HTMLElement): Promise<void> {
const isPushEnabled =
await OneSignal.context.subscriptionManager.isPushNotificationsEnabled();
if (isPushEnabled) {
if (OneSignal.User.PushSubscription.optedIn) {
await OneSignal.User.PushSubscription.optOut();
await this.setTextFromPushStatus(element);
} else {
Expand Down

0 comments on commit 31540b5

Please sign in to comment.