Skip to content

Commit 9dfd8bc

Browse files
authored
fix(snackbar): fix issue for __package_version__ (#16)
1 parent daea0ce commit 9dfd8bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/service-worker-notify/src/lib/service-worker-notify.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const notifyLocalStorageKey = 'notify_new_version';
1919
* changelogPage: 'https://example.com/changelog'
2020
* });
2121
*/
22-
export function serviceWorkerNotifySnackbar(options: {lastNotifyVersion: string; changelogPage?: string}): void {
22+
export function serviceWorkerNotifySnackbar(options: {lastNotifyVersion: string; changelogPage?: string, currentVersion: string}): void {
2323
logger.logMethodArgs?.('serviceWorkerNotifyHandler', {options});
2424

2525
serviceWorkerSignal.subscribe(({event}) => {
@@ -51,7 +51,7 @@ export function serviceWorkerNotifySnackbar(options: {lastNotifyVersion: string;
5151
const lastLocalVersion = localStorage.getItem(notifyLocalStorageKey);
5252
if (lastLocalVersion !== null) {
5353
localStorage.removeItem(notifyLocalStorageKey);
54-
const message = `به نسخه ${l10n.replaceNumber(__package_version__.replace('-alpha', '-آلفا'))} خوش‌آمدید.`;
54+
const message = `به نسخه ${l10n.replaceNumber(options.currentVersion.replace('-alpha', '-آلفا'))} خوش‌آمدید.`;
5555

5656
/**
5757
* Handles the display of a snackbar notification based on the service worker event.
@@ -60,7 +60,7 @@ export function serviceWorkerNotifySnackbar(options: {lastNotifyVersion: string;
6060
* Otherwise, it shows a snackbar with a close button.
6161
*/
6262
if (
63-
(options.changelogPage != null && options.lastNotifyVersion === __package_version__) ||
63+
(options.changelogPage != null && options.lastNotifyVersion === options.currentVersion) ||
6464
lastLocalVersion === '' ||
6565
isVersionLarger(options.lastNotifyVersion, lastLocalVersion)
6666
) {

0 commit comments

Comments
 (0)