Skip to content

Commit

Permalink
Fixed bell icon not rendering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitniyerclevertap committed Feb 26, 2025
1 parent efe2ff9 commit ffa4a6b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 34 deletions.
26 changes: 11 additions & 15 deletions clevertap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12333,8 +12333,6 @@
}

push() {
console.log('StorageManager.readFromLSorCookie(ACCOUNT_ID)', StorageManager.readFromLSorCookie(ACCOUNT_ID));

if (StorageManager.readFromLSorCookie(ACCOUNT_ID)) {
/*
To handle a potential race condition, two flags are stored in Local Storage:
Expand Down Expand Up @@ -12975,34 +12973,32 @@
fcmPublicKey = notificationValues.fcmPublicKey;
};
const processWebPushConfig = (webPushConfig, logger, request) => {
const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {};
StorageManager.saveToLSorCookie(WEBPUSH_CONFIG_RECEIVED, true);

const updatePushConfig = () => {
$ct.pushConfig = webPushConfig;
StorageManager.saveToLSorCookie(WEBPUSH_CONFIG, webPushConfig);
StorageManager.saveToLSorCookie(WEBPUSH_CONFIG_RECEIVED, true);
};

updatePushConfig();

if (webPushConfig.isPreview) {
updatePushConfig();
enablePush({
logger,
request
});
} else if (JSON.stringify(_pushConfig) !== JSON.stringify(webPushConfig)) {
updatePushConfig();

try {
const isNotificationPushCalled = StorageManager.readFromLSorCookie(NOTIFICATION_PUSH_METHOD_DEFERRED);
}

if (isNotificationPushCalled) {
processSoftPrompt();
}
} catch (error) {
logger.error('Failed to process web push config:', error); // Fallback: Attempt to process soft prompt anyway
try {
const isNotificationPushCalled = StorageManager.readFromLSorCookie(NOTIFICATION_PUSH_METHOD_DEFERRED);

if (isNotificationPushCalled) {
processSoftPrompt();
}
} catch (error) {
logger.error('Failed to process web push config:', error); // Fallback: Attempt to process soft prompt anyway

processSoftPrompt();
}
};
const processSoftPrompt = () => {
Expand Down
2 changes: 1 addition & 1 deletion clevertap.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions clevertap.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/modules/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default class NotificationHandler extends Array {
}

push (...displayArgs) {
console.log('StorageManager.readFromLSorCookie(ACCOUNT_ID)', StorageManager.readFromLSorCookie(ACCOUNT_ID))
if (StorageManager.readFromLSorCookie(ACCOUNT_ID)) {
/*
To handle a potential race condition, two flags are stored in Local Storage:
Expand Down
24 changes: 10 additions & 14 deletions src/modules/webPushPrompt/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,24 @@ export const setNotificationHandlerValues = (notificationValues = {}) => {
}

export const processWebPushConfig = (webPushConfig, logger, request) => {
const _pushConfig = StorageManager.readFromLSorCookie(WEBPUSH_CONFIG) || {}
StorageManager.saveToLSorCookie(WEBPUSH_CONFIG_RECEIVED, true)
const updatePushConfig = () => {
$ct.pushConfig = webPushConfig
StorageManager.saveToLSorCookie(WEBPUSH_CONFIG, webPushConfig)
StorageManager.saveToLSorCookie(WEBPUSH_CONFIG_RECEIVED, true)
}

updatePushConfig()
if (webPushConfig.isPreview) {
updatePushConfig()
enablePush({ logger, request })
} else if (JSON.stringify(_pushConfig) !== JSON.stringify(webPushConfig)) {
updatePushConfig()
try {
const isNotificationPushCalled = StorageManager.readFromLSorCookie(NOTIFICATION_PUSH_METHOD_DEFERRED)
if (isNotificationPushCalled) {
processSoftPrompt()
}
} catch (error) {
logger.error('Failed to process web push config:', error)
// Fallback: Attempt to process soft prompt anyway
}
try {
const isNotificationPushCalled = StorageManager.readFromLSorCookie(NOTIFICATION_PUSH_METHOD_DEFERRED)
if (isNotificationPushCalled) {
processSoftPrompt()
}
} catch (error) {
logger.error('Failed to process web push config:', error)
// Fallback: Attempt to process soft prompt anyway
processSoftPrompt()
}
}

Expand Down

0 comments on commit ffa4a6b

Please sign in to comment.