forked from trent_larson/crowd-funder-for-time-pwa
feat: integrate PWA functionality with platform service architecture
- Add PWA methods to PlatformService interface (registerServiceWorker, isPWAEnabled) - Implement PWA logic in WebPlatformService with service worker registration - Add no-op PWA implementations for Capacitor and Electron platforms - Create PWAInstallPrompt component with custom install UI and event handling - Integrate PWA components into App.vue with platform-aware conditional rendering - Ensure PWA features only load on web platform via platform service pattern - Centralize PWA logic in platform service for consistent cross-platform behavior - Add comprehensive PWA documentation and installation flow support Platform service now handles all PWA operations including service worker registration, install prompts, and platform-specific feature detection.
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { logger } from "@/utils/logger";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
|
||||
interface BeforeInstallPromptEvent extends Event {
|
||||
prompt(): Promise<void>;
|
||||
@@ -67,11 +68,13 @@ interface BeforeInstallPromptEvent extends Event {
|
||||
|
||||
@Component({ name: "PWAInstallPrompt" })
|
||||
export default class PWAInstallPrompt extends Vue {
|
||||
$notify!: (notification: any, timeout?: number) => void;
|
||||
private showInstallPrompt = false;
|
||||
private deferredPrompt: BeforeInstallPromptEvent | null = null;
|
||||
private dismissed = false;
|
||||
|
||||
mounted() {
|
||||
if (!PlatformServiceFactory.getInstance().isPWAEnabled) return;
|
||||
this.setupInstallPrompt();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user