Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jason5ng32 committed Oct 28, 2024
1 parent c1de9cd commit 481c4cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Binary file modified common/maxmind-db/GeoLite2-ASN.mmdb
Binary file not shown.
Binary file modified common/maxmind-db/GeoLite2-City.mmdb
Binary file not shown.
16 changes: 13 additions & 3 deletions frontend/components/widgets/PWA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const getBrowser = () => {
isOtherBrowser.value = !(androidChrome || desktopChrome || macSafari || iosSafari);
}
const popupCount = () => {
let currentCount = localStorage.getItem('pwaPopupCount') || 0;
currentCount = parseInt(currentCount, 10);
return currentCount;
}
const showPWA = () => {
const pwaInstall = document.getElementsByTagName('pwa-install')[0];
if (!pwaInstall) return;
Expand All @@ -43,6 +49,8 @@ const showPWA = () => {
if (!pwaInstall.isUnderStandaloneMode && pwaInstall.isInstallAvailable) {
pwaInstall.showDialog(true);
const totalPopupCount = popupCount() + 1;
localStorage.setItem('pwaPopupCount', totalPopupCount);
trackEvent('PWA', 'PWAPopup', 'Show');
pwaInstall.addEventListener('pwa-install-success-event', event => {
if (event.detail.message.includes('success')) {
Expand All @@ -54,9 +62,11 @@ const showPWA = () => {
onMounted(() => {
getBrowser();
setTimeout(() => {
showPWA();
}, 30000);
if (popupCount() < 2) {
setTimeout(() => {
showPWA();
}, 30000);
}
});
</script>

Expand Down

0 comments on commit 481c4cb

Please sign in to comment.