133 lines
2.9 KiB
TypeScript
133 lines
2.9 KiB
TypeScript
|
|
||
|
import { DeviceType } from '../../enums/deviceType';
|
||
|
|
||
|
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
||
|
|
||
|
export class CliPlatformUtilsService implements PlatformUtilsService {
|
||
|
identityClientId: string;
|
||
|
|
||
|
private deviceCache: DeviceType = null;
|
||
|
|
||
|
constructor(identityClientId: string, private packageJson: any) {
|
||
|
this.identityClientId = identityClientId;
|
||
|
}
|
||
|
|
||
|
getDevice(): DeviceType {
|
||
|
if (!this.deviceCache) {
|
||
|
switch (process.platform) {
|
||
|
case 'win32':
|
||
|
this.deviceCache = DeviceType.WindowsDesktop;
|
||
|
break;
|
||
|
case 'darwin':
|
||
|
this.deviceCache = DeviceType.MacOsDesktop;
|
||
|
break;
|
||
|
case 'linux':
|
||
|
default:
|
||
|
this.deviceCache = DeviceType.LinuxDesktop;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return this.deviceCache;
|
||
|
}
|
||
|
|
||
|
getDeviceString(): string {
|
||
|
const device = DeviceType[this.getDevice()].toLowerCase();
|
||
|
return device.replace('desktop', '');
|
||
|
}
|
||
|
|
||
|
isFirefox() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isChrome() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isEdge() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isOpera() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isVivaldi() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isSafari() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isIE() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
isMacAppStore() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
analyticsId() {
|
||
|
return null as string;
|
||
|
}
|
||
|
|
||
|
isViewOpen() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
lockTimeout(): number {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
launchUri(uri: string, options?: any): void {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
|
||
|
saveFile(win: Window, blobData: any, blobOptions: any, fileName: string): void {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
|
||
|
getApplicationVersion(): string {
|
||
|
return this.packageJson.version;
|
||
|
}
|
||
|
|
||
|
supportsU2f(win: Window) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
supportsDuo(): boolean {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
showToast(type: 'error' | 'success' | 'warning' | 'info', title: string, text: string | string[],
|
||
|
options?: any): void {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
|
||
|
showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):
|
||
|
Promise<boolean> {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
|
||
|
eventTrack(action: string, label?: string, options?: any) {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
|
||
|
isDev(): boolean {
|
||
|
return process.env.BWCLI_ENV === 'development';
|
||
|
}
|
||
|
|
||
|
isSelfHost(): boolean {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
copyToClipboard(text: string, options?: any): void {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
|
||
|
readFromClipboard(options?: any): Promise<string> {
|
||
|
throw new Error('Not implemented.');
|
||
|
}
|
||
|
}
|