feat: update PWA installation logic, enhance app versioning, and streamline environment configurations

This commit is contained in:
2026-05-11 20:26:02 +03:30
parent ff9bbad336
commit d513ea381e
8 changed files with 9 additions and 17 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
{ {
"$schema": "./node_modules/@angular/service-worker/config/schema.json", "$schema": "./node_modules/@angular/service-worker/config/schema.json",
"appData": { "appData": {
"appVersion": "0.0.3", "appVersion": "0.0.4",
"buildDate": "2026-05-11T13:52:49.314Z", "buildDate": "2026-05-11T16:11:59.783Z",
"buildNumber": 3 "buildNumber": 4
}, },
"assetGroups": [ "assetGroups": [
{ {
+1 -6
View File
@@ -20,9 +20,6 @@ export class PwaInstallService {
window.matchMedia('(display-mode: standalone)').matches || window.matchMedia('(display-mode: standalone)').matches ||
(window.navigator as any).standalone === true; (window.navigator as any).standalone === true;
console.log(window.matchMedia('(display-mode: standalone)').matches);
console.log(window.navigator);
this.isInstalled.set(standalone); this.isInstalled.set(standalone);
window.addEventListener('beforeinstallprompt', (event: any) => { window.addEventListener('beforeinstallprompt', (event: any) => {
@@ -30,7 +27,6 @@ export class PwaInstallService {
this.deferredInstallPrompt = event; this.deferredInstallPrompt = event;
this.canInstall.set(true); this.canInstall.set(true);
console.log(this.deferredInstallPrompt);
}); });
window.addEventListener('appinstalled', () => { window.addEventListener('appinstalled', () => {
@@ -45,8 +41,6 @@ export class PwaInstallService {
return; return;
} }
console.log('openInstallConfirm');
this.confirmationService.confirm({ this.confirmationService.confirm({
header: 'نصب اپلیکیشن', header: 'نصب اپلیکیشن',
message: 'برای ادامه می‌بایست نیازمندی‌های نرم‌افزار را نصب کنید', message: 'برای ادامه می‌بایست نیازمندی‌های نرم‌افزار را نصب کنید',
@@ -59,6 +53,7 @@ export class PwaInstallService {
this.deferredInstallPrompt.userChoice.finally(() => { this.deferredInstallPrompt.userChoice.finally(() => {
this.deferredInstallPrompt = null; this.deferredInstallPrompt = null;
this.canInstall.set(false); this.canInstall.set(false);
window.location.reload();
}); });
}, },
}); });
@@ -1,6 +1,7 @@
<div class="h-svh w-svw flex flex-col items-center justify-center"> <div class="h-svh w-svw flex flex-col items-center justify-center">
{{ requireInstall }} {{ requireInstall }}
{{ pwaInstalled() }} {{ pwaInstalled() }}
{{ canInstall() }}
<img [src]="logo" class="w-32 animate-pulse" /> <img [src]="logo" class="w-32 animate-pulse" />
@if (requireInstall && !pwaInstalled()) { @if (requireInstall && !pwaInstalled()) {
<div class="mt-6 flex flex-col items-center gap-3"> <div class="mt-6 flex flex-col items-center gap-3">
@@ -30,7 +30,7 @@ export class PosSplashComponent {
constructor() { constructor() {
effect(() => { effect(() => {
if (!this.requireInstall || this.pwaInstalled() || this.installPromptShown) { if (!this.requireInstall || this.pwaInstalled() || this.installPromptShown) {
this.getData(); // this.getData();
return; return;
} }
@@ -30,10 +30,8 @@
<router-outlet></router-outlet> <router-outlet></router-outlet>
} }
} @else { } @else {
@defer (when !isAuth()) {
<pos-pages-layout /> <pos-pages-layout />
} }
}
</div> </div>
} }
} }
@@ -138,8 +138,6 @@ export class AppLayout {
this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl)); this.layoutService.topbarCenterSlot$.subscribe((tpl) => (this.topBarCenterAction = tpl));
this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl)); this.layoutService.topbarEndSlot$.subscribe((tpl) => (this.topBarEndAction = tpl));
console.log(this.authService.currentAccount());
if (window.location.pathname === '/') { if (window.location.pathname === '/') {
if (!this.authService.currentAccount()) { if (!this.authService.currentAccount()) {
this.router.navigateByUrl('auth'); this.router.navigateByUrl('auth');
+1 -1
View File
@@ -1,7 +1,7 @@
// Development environment configuration // Development environment configuration
export const environment = { export const environment = {
production: false, production: false,
apiBaseUrl: 'https://psp-api.shift-am.ir:5002', apiBaseUrl: 'https://psp-api.shift-am.ir',
// apiBaseUrl: 'http://192.168.128.73:5002', // apiBaseUrl: 'http://192.168.128.73:5002',
host: 'localhost', host: 'localhost',
port: 5001, port: 5001,
+1 -1
View File
@@ -1,7 +1,7 @@
// TIS tenant environment configuration // TIS tenant environment configuration
export const environment = { export const environment = {
production: true, production: true,
apiBaseUrl: 'https://psp-api.shift-am.ir:5002', apiBaseUrl: 'https://psp-api.shift-am.ir',
// apiBaseUrl: 'http://192.168.128.73:5002', // apiBaseUrl: 'http://192.168.128.73:5002',
host: 'localhost', host: 'localhost',
port: 5000, port: 5000,