Abstract electron settings properly to avoid boilerplate-hell (#8798)
* Remove unused method `BasePlatform::screenCaptureErrorString` * Improve platform typescripting * Remove redundant awaits * Abstract electron settings properly to avoid boilerplate-hell * i18n * Fix stray semi-colons * Fix setting level order for Platform settings
This commit is contained in:
parent
9b8b1d193e
commit
ba2ce5ecba
9 changed files with 122 additions and 220 deletions
|
@ -46,6 +46,17 @@ export enum UpdateCheckStatus {
|
|||
Ready = "READY",
|
||||
}
|
||||
|
||||
export interface UpdateStatus {
|
||||
/**
|
||||
* The current phase of the manual update check.
|
||||
*/
|
||||
status: UpdateCheckStatus;
|
||||
/**
|
||||
* Detail string relating to the current status, typically for error details.
|
||||
*/
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
const UPDATE_DEFER_KEY = "mx_defer_update";
|
||||
|
||||
/**
|
||||
|
@ -225,79 +236,21 @@ export default abstract class BasePlatform {
|
|||
*/
|
||||
public abstract getAppVersion(): Promise<string>;
|
||||
|
||||
/*
|
||||
* If it's not expected that capturing the screen will work
|
||||
* with getUserMedia, return a string explaining why not.
|
||||
* Otherwise, return null.
|
||||
*/
|
||||
public screenCaptureErrorString(): string {
|
||||
return "Not implemented";
|
||||
}
|
||||
|
||||
/**
|
||||
* Restarts the application, without necessarily reloading
|
||||
* any application code
|
||||
*/
|
||||
public abstract reload(): void;
|
||||
|
||||
public supportsAutoLaunch(): boolean {
|
||||
public supportsSetting(settingName?: string): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
// XXX: Surely this should be a setting like any other?
|
||||
public async getAutoLaunchEnabled(): Promise<boolean> {
|
||||
return false;
|
||||
public getSettingValue(settingName: string): Promise<any> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public async setAutoLaunchEnabled(enabled: boolean): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
public supportsWarnBeforeExit(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async shouldWarnBeforeExit(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async setWarnBeforeExit(enabled: boolean): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
public supportsAutoHideMenuBar(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async getAutoHideMenuBarEnabled(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async setAutoHideMenuBarEnabled(enabled: boolean): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
public supportsMinimizeToTray(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async getMinimizeToTrayEnabled(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async setMinimizeToTrayEnabled(enabled: boolean): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
public supportsTogglingHardwareAcceleration(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async getHardwareAccelerationEnabled(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
public async setHardwareAccelerationEnabled(enabled: boolean): Promise<void> {
|
||||
public setSettingValue(settingName: string, value: any): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue