Skip to content

Commit

Permalink
Merge pull request #353 from CleverTap/WEB-3474
Browse files Browse the repository at this point in the history
Changes based on review
  • Loading branch information
ThisIsRaghavGupta authored Feb 6, 2025
2 parents bc4e1ff + c02b400 commit e541417
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions clevertap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clevertap.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clevertap.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/modules/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ export default class NotificationHandler extends Array {
let httpsIframePath
let apnsWebPushId
let apnsWebPushServiceUrl
const vapidSupportedAndMigrated = isSafari() && ('PushManager' in window) && StorageManager.getMetaProp(VAPID_MIGRATION_PROMPT_SHOWN) && this.#fcmPublicKey !== null

if (displayArgs.length === 1) {
if (isObject(displayArgs[0])) {
Expand Down Expand Up @@ -363,6 +362,8 @@ export default class NotificationHandler extends Array {
StorageManager.setMetaProp(VAPID_MIGRATION_PROMPT_SHOWN, true)
}

const vapidSupportedAndMigrated = isSafari() && ('PushManager' in window) && StorageManager.getMetaProp(VAPID_MIGRATION_PROMPT_SHOWN) && this.#fcmPublicKey !== null

// we check for the cookie in setUpChromeNotifications() the tokens may have changed

if (!isHTTP) {
Expand All @@ -372,7 +373,7 @@ export default class NotificationHandler extends Array {
return
}
// handle migrations from other services -> chrome notifications may have already been asked for before
if (Notification.permission === 'granted' && vapidSupportedAndMigrated) {
if (Notification.permission === 'granted' && (vapidSupportedAndMigrated || isChrome() || isFirefox())) {
// skip the dialog and register
this.setUpWebPushNotifications(subscriptionCallback, serviceWorkerPath, apnsWebPushId, apnsWebPushServiceUrl)
return
Expand Down

0 comments on commit e541417

Please sign in to comment.