Skip to content

Commit

Permalink
add: notification for users to go to Chrome Web Store
Browse files Browse the repository at this point in the history
  • Loading branch information
DaKingKong committed Jun 24, 2024
1 parent ade3fde commit 298639c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,32 @@ window.addEventListener('message', async (e) => {
platformName = platformInfo['platform-info'].platformName;
rcUserInfo = (await chrome.storage.local.get('rcUserInfo')).rcUserInfo;
if (data.loggedIn) {
try {
const versionRes = await axios.get(`${config.serverUrl}/serverVersionInfo`);
if (versionRes.data.version === '1.0.0') {
// notify users to update to latest version
const createdNotificationId = await chrome.notifications.create({
type: 'basic',
iconUrl: '/images/logo32.png',
title: `Please upgrade RingCentral CRM Extension to the latest version`,
message: "You are using a legacy version. Please go to chrome://extensions/ and click 'Update' to upgrade to the latest version.",
priority: 1,
buttons: [
{
title: 'Go to update',
}
]
});
chrome.notifications.onButtonClicked.addListener(
(notificationId, buttonIndex) => {
if (notificationId === createdNotificationId) {
window.open('https://chrome.google.com/webstore/detail/ringcentral-crm-extension/kkhkjhafgdlihndcbnebljipgkandkhh');
}
}
)
}
}
catch (e) { }
document.getElementById('rc-widget').style.zIndex = 0;
const { rcUnifiedCrmExtJwt } = await chrome.storage.local.get('rcUnifiedCrmExtJwt');
// Juuuuuust for Pipedrive
Expand Down Expand Up @@ -446,7 +472,7 @@ window.addEventListener('message', async (e) => {
if (singleCallLog[data.body.call.sessionId]?.matched || singleCallLog.find(c => c.sessionId == data.body.call.sessionId)?.matched) {
if (config.platforms[platformName].canOpenLogPage) {
for (const c of callMatchedContact) {
openLog({ platform: platformName, hostname: platformHostname, logId: singleCallLog[data.body.call.sessionId]?.logId ?? singleCallLog.find(c => c.sessionId == data.body.call.sessionId)?.logId , contactType: c.type });
openLog({ platform: platformName, hostname: platformHostname, logId: singleCallLog[data.body.call.sessionId]?.logId ?? singleCallLog.find(c => c.sessionId == data.body.call.sessionId)?.logId, contactType: c.type });
}
}
else {
Expand Down
1 change: 1 addition & 0 deletions src/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function openPopupWindow() {
await chrome.storage.local.set({
popupWindowId: popup.id,
});

return false;
}

Expand Down

0 comments on commit 298639c

Please sign in to comment.