| 5 | import type { PlatformAdapter, OpenDialogOptions, OpenDialogResult, RemoteConfigResult } from './types' |
| 6 | |
| 7 | export class ElectronPlatformAdapter implements PlatformAdapter { |
| 8 | getVersion(): Promise<string> { |
| 9 | return window.api.app.getVersion() |
| 10 | } |
| 11 | |
| 12 | fetchRemoteConfig(url: string): Promise<RemoteConfigResult> { |
| 13 | return window.api.app.fetchRemoteConfig(url) |
| 14 | } |
| 15 | |
| 16 | setThemeSource(theme: 'system' | 'light' | 'dark'): void { |
| 17 | window.api.setThemeSource(theme) |
| 18 | } |
| 19 | |
| 20 | getOpenAtLogin(): Promise<boolean> { |
| 21 | return window.api.app.getOpenAtLogin() |
| 22 | } |
| 23 | |
| 24 | setOpenAtLogin(enabled: boolean): Promise<{ success: boolean; error?: string }> { |
| 25 | return window.api.app.setOpenAtLogin(enabled) |
| 26 | } |
| 27 | |
| 28 | getAnalyticsEnabled(): Promise<boolean> { |
| 29 | return window.api.app.getAnalyticsEnabled() |
| 30 | } |
| 31 | |
| 32 | setAnalyticsEnabled(enabled: boolean): Promise<{ success: boolean }> { |
| 33 | return window.api.app.setAnalyticsEnabled(enabled) |
| 34 | } |
| 35 | |
| 36 | trackDailyActive(locale: string): Promise<void> { |
| 37 | return window.api.app.trackDailyActive(locale) |
| 38 | } |
| 39 | |
| 40 | showOpenDialog(options: OpenDialogOptions): Promise<OpenDialogResult> { |
| 41 | return window.api.dialog.showOpenDialog(options as Electron.OpenDialogOptions) |
| 42 | } |
| 43 | |
| 44 | copyImageToClipboard(dataUrl: string): Promise<{ success: boolean; error?: string }> { |
| 45 | return window.api.clipboard.copyImage(dataUrl) |
| 46 | } |
| 47 | |
| 48 | async checkUpdate(): Promise<void> { |
| 49 | window.api.app.checkUpdate() |
| 50 | } |
| 51 | |
| 52 | async performUpdate(): Promise<{ success: boolean; error?: string }> { |
| 53 | return { success: false, error: 'Use built-in updater' } |
| 54 | } |
| 55 | |
| 56 | relaunch(): Promise<void> { |
| 57 | return window.api.app.relaunch() |
| 58 | } |
| 59 | } |
nothing calls this directly
no outgoing calls
no test coverage detected