forked from jsnbuchanan/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:
15
src/App.vue
15
src/App.vue
@@ -2,7 +2,7 @@
|
||||
<router-view />
|
||||
|
||||
<!-- PWA Install Prompt -->
|
||||
<PWAInstallPrompt />
|
||||
<PWAInstallPrompt v-if="isPWAEnabled" />
|
||||
|
||||
<!-- Messages in the upper-right - https://github.com/emmanuelsw/notiwind -->
|
||||
<NotificationGroup group="alert">
|
||||
@@ -338,6 +338,7 @@ import { NotificationIface } from "./constants/app";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { logger } from "./utils/logger";
|
||||
import PWAInstallPrompt from "@/components/PWAInstallPrompt.vue";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
|
||||
interface Settings {
|
||||
notifyingNewActivityTime?: string;
|
||||
@@ -355,6 +356,18 @@ export default class App extends Vue {
|
||||
|
||||
stopAsking = false;
|
||||
|
||||
get isPWAEnabled() {
|
||||
return PlatformServiceFactory.getInstance().isPWAEnabled;
|
||||
}
|
||||
|
||||
mounted() {
|
||||
// Register service worker only if PWA is enabled
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
if (platformService.isPWAEnabled && platformService.registerServiceWorker) {
|
||||
platformService.registerServiceWorker();
|
||||
}
|
||||
}
|
||||
|
||||
// created() {
|
||||
// logger.log(
|
||||
// "Component created: Reactivity set up.",
|
||||
|
||||
Reference in New Issue
Block a user