update
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { PwaInstallService } from '@/core/services';
|
||||
import { Component, EventEmitter, inject, Output } from '@angular/core';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { finalize, forkJoin } from 'rxjs';
|
||||
import images from 'src/assets/images';
|
||||
import { PosInfoStore, PosProfileStore } from '../store';
|
||||
@@ -7,6 +9,7 @@ import { DeviceInfoStore } from '../store/device.store';
|
||||
@Component({
|
||||
selector: 'pos-splash',
|
||||
templateUrl: 'splash.component.html',
|
||||
imports: [ButtonDirective],
|
||||
})
|
||||
export class PosSplashComponent {
|
||||
@Output() onComplete = new EventEmitter<void>();
|
||||
@@ -14,8 +17,27 @@ export class PosSplashComponent {
|
||||
private readonly posProfileStore = inject(PosProfileStore);
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
private readonly deviceInfoStore = inject(DeviceInfoStore);
|
||||
private readonly pwaInstallService = inject(PwaInstallService);
|
||||
|
||||
logo = images.logo;
|
||||
requireInstall = false;
|
||||
// requireInstall = brandingConfig.enableInstallPrompt;
|
||||
pwaInstalled = this.pwaInstallService.isInstalled;
|
||||
canInstall = this.pwaInstallService.canInstall;
|
||||
private installPromptShown = false;
|
||||
|
||||
// constructor() {
|
||||
// effect(() => {
|
||||
// if (!this.requireInstall || this.pwaInstalled() || this.installPromptShown) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (this.canInstall()) {
|
||||
// this.installPromptShown = true;
|
||||
// this.pwaInstallService.openInstallConfirm();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
async ngOnInit() {
|
||||
const data = await this.deviceInfoStore.getData();
|
||||
@@ -25,9 +47,27 @@ export class PosSplashComponent {
|
||||
forkJoin([profileObs, infoObs])
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
this.onComplete.emit();
|
||||
if (!this.requireInstall || this.pwaInstalled()) {
|
||||
this.onComplete.emit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.canInstall()) {
|
||||
this.pwaInstallService.openInstallConfirm();
|
||||
this.installPromptShown = true;
|
||||
}
|
||||
}),
|
||||
)
|
||||
.subscribe(([profileResult, infoResult]) => {});
|
||||
}
|
||||
|
||||
installPwa() {
|
||||
this.pwaInstallService.openInstallConfirm();
|
||||
}
|
||||
|
||||
continueAfterInstall() {
|
||||
if (this.pwaInstalled()) {
|
||||
this.onComplete.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user