mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-16 21:30:39 -07:00
- Replaced direct Tauri API calls with a unified platform context across multiple components, enhancing code maintainability and readability. - Removed the deprecated tauri.ts file, consolidating platform-related logic into the new PlatformContext. - Updated components such as App, AudioPlayer, and ServerSettings to utilize the new platform context for lifecycle management and server interactions. - Improved platform detection and handling for audio playback and system audio capture functionalities. - Ensured consistent error handling and user feedback across the application when interacting with platform-specific features.
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import type { PlatformUpdater, UpdateStatus } from '@/platform/types';
|
|
|
|
class WebUpdater implements PlatformUpdater {
|
|
private status: UpdateStatus = {
|
|
checking: false,
|
|
available: false,
|
|
downloading: false,
|
|
installing: false,
|
|
readyToInstall: false,
|
|
};
|
|
|
|
private subscribers: Set<(status: UpdateStatus) => void> = new Set();
|
|
|
|
private notifySubscribers() {
|
|
this.subscribers.forEach((callback) => callback(this.status));
|
|
}
|
|
|
|
subscribe(callback: (status: UpdateStatus) => void): () => void {
|
|
this.subscribers.add(callback);
|
|
callback(this.status);
|
|
return () => {
|
|
this.subscribers.delete(callback);
|
|
};
|
|
}
|
|
|
|
getStatus(): UpdateStatus {
|
|
return { ...this.status };
|
|
}
|
|
|
|
async checkForUpdates(): Promise<void> {
|
|
// Web apps don't need client-side updates
|
|
// Updates are handled by redeploying the web app
|
|
}
|
|
|
|
async downloadAndInstall(): Promise<void> {
|
|
// No-op for web
|
|
}
|
|
|
|
async restartAndInstall(): Promise<void> {
|
|
// No-op for web
|
|
}
|
|
}
|
|
|
|
export const webUpdater = new WebUpdater();
|