import { PlatformService } from "./PlatformService"; import { WebPlatformService } from "./platforms/WebPlatformService"; import { CapacitorPlatformService } from "./platforms/CapacitorPlatformService"; import { ElectronPlatformService } from "./platforms/ElectronPlatformService"; import { PyWebViewPlatformService } from "./platforms/PyWebViewPlatformService"; export class PlatformServiceFactory { private static instance: PlatformService | null = null; public static getInstance(): PlatformService { if (PlatformServiceFactory.instance) { return PlatformServiceFactory.instance; } const platform = process.env.VITE_PLATFORM || "web"; switch (platform) { case "capacitor": PlatformServiceFactory.instance = new CapacitorPlatformService(); break; case "electron": PlatformServiceFactory.instance = new ElectronPlatformService(); break; case "pywebview": PlatformServiceFactory.instance = new PyWebViewPlatformService(); break; case "web": default: PlatformServiceFactory.instance = new WebPlatformService(); break; } return PlatformServiceFactory.instance; } }