Migrate Angular UI from portmaster-ui to desktop/angular. Update Earthfile to build libs, UI and tauri-builtin

This commit is contained in:
Patrick Pacher
2024-03-20 10:43:29 +01:00
parent 66381baa1a
commit 4b77945517
922 changed files with 84071 additions and 26 deletions

View File

@@ -0,0 +1,55 @@
import { BrowserIntegrationService } from "./browser";
import { AppInfo, ProcessInfo } from "./integration";
export class ElectronIntegrationService extends BrowserIntegrationService {
openExternal(pathOrUrl: string): Promise<void> {
if (!!window.app) {
return window.app.openExternal(pathOrUrl);
}
return Promise.reject('No electron API available')
}
getInstallDir(): Promise<string> {
if (!!window.app) {
return window.app.getInstallDir()
}
return Promise.reject('No electron API available')
}
getAppIcon(info: ProcessInfo): Promise<string> {
if (!!window.app) {
return window.app.getFileIcon(info.execPath)
}
return Promise.reject('No electron API available')
}
getAppInfo(_: ProcessInfo): Promise<AppInfo> {
return Promise.reject('Not supported in electron')
}
exitApp(): Promise<void> {
if (!!window.app) {
window.app.exitApp();
}
return Promise.resolve();
}
onExitRequest(cb: () => void): () => void {
let listener = (event: MessageEvent<any>) => {
if (event.data === 'on-app-close') {
cb();
}
}
window.addEventListener('message', listener);
return () => {
window.removeEventListener('message', listener)
}
}
}