Skip to content

Commit

Permalink
remove unnecessary optedOut check
Browse files Browse the repository at this point in the history
Since we no longer support the os.tc workaround there is no need to
check the the indexDb for user preferences. Native notification
permission status is checked later making this unnecessary as well from
normal HTTPS setups.
  • Loading branch information
jkasten2 committed Jul 26, 2023
1 parent b724a62 commit 04c97ae
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/shared/helpers/InitHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export default class InitHelper {
await OneSignalEvent.trigger(OneSignal.EVENTS.SDK_INITIALIZED);
}

// In-Addition to registering for push, this shows a native browser
// notification permission prompt, if needed.
public static async registerForPushNotifications(options: RegisterOptions = {}): Promise<void> {
if (options && options.modalPrompt) {
/* Show the HTTPS fullscreen modal permission message. */
Expand Down Expand Up @@ -146,15 +148,7 @@ export default class InitHelper {
return;
}

/*
* We don't want to resubscribe if the user is opted out, and we can't check on HTTP, because the promise will
* prevent the popup from opening.
*/
const subscription = await Database.getSubscription();
const isOptedOut = subscription.optedOut;
if (!isOptedOut) {
await SubscriptionHelper.registerForPush();
}
await SubscriptionHelper.registerForPush();
}

/**
Expand Down

0 comments on commit 04c97ae

Please sign in to comment.