1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

Apply Prettier (#581)

This commit is contained in:
Oscar Hinton
2021-12-16 13:36:21 +01:00
committed by GitHub
parent 8b2dfc6cdc
commit 193434461d
589 changed files with 46650 additions and 41924 deletions

View File

@@ -1,157 +1,166 @@
import * as child_process from 'child_process';
import * as child_process from "child_process";
import { DeviceType } from 'jslib-common/enums/deviceType';
import { ThemeType } from 'jslib-common/enums/themeType';
import { DeviceType } from "jslib-common/enums/deviceType";
import { ThemeType } from "jslib-common/enums/themeType";
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
// tslint:disable-next-line
const open = require('open');
const open = require("open");
export class CliPlatformUtilsService implements PlatformUtilsService {
identityClientId: string;
identityClientId: string;
private deviceCache: DeviceType = null;
private deviceCache: DeviceType = null;
constructor(identityClientId: string, private packageJson: any) {
this.identityClientId = identityClientId;
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;
}
}
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;
}
return this.deviceCache;
}
getDeviceString(): string {
const device = DeviceType[this.getDevice()].toLowerCase();
return device.replace("desktop", "");
}
getDeviceString(): string {
const device = DeviceType[this.getDevice()].toLowerCase();
return device.replace('desktop', '');
}
isFirefox() {
return false;
}
isFirefox() {
return false;
}
isChrome() {
return false;
}
isChrome() {
return false;
}
isEdge() {
return false;
}
isEdge() {
return false;
}
isOpera() {
return false;
}
isOpera() {
return false;
}
isVivaldi() {
return false;
}
isVivaldi() {
return false;
}
isSafari() {
return false;
}
isSafari() {
return false;
}
isIE() {
return false;
}
isIE() {
return false;
}
isMacAppStore() {
return false;
}
isMacAppStore() {
return false;
}
isViewOpen() {
return Promise.resolve(false);
}
isViewOpen() {
return Promise.resolve(false);
launchUri(uri: string, options?: any): void {
if (process.platform === "linux") {
child_process.spawnSync("xdg-open", [uri]);
} else {
open(uri);
}
}
launchUri(uri: string, options?: any): void {
if (process.platform === 'linux') {
child_process.spawnSync('xdg-open', [uri]);
} else {
open(uri);
}
}
saveFile(win: Window, blobData: any, blobOptions: any, fileName: string): void {
throw new Error("Not implemented.");
}
saveFile(win: Window, blobData: any, blobOptions: any, fileName: string): void {
throw new Error('Not implemented.');
}
getApplicationVersion(): Promise<string> {
return Promise.resolve(this.packageJson.version);
}
getApplicationVersion(): Promise<string> {
return Promise.resolve(this.packageJson.version);
}
getApplicationVersionSync(): string {
return this.packageJson.version;
}
getApplicationVersionSync(): string {
return this.packageJson.version;
}
supportsWebAuthn(win: Window) {
return false;
}
supportsWebAuthn(win: Window) {
return false;
}
supportsDuo(): boolean {
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.");
}
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.");
}
showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):
Promise<boolean> {
throw new Error('Not implemented.');
}
isDev(): boolean {
return process.env.BWCLI_ENV === "development";
}
isDev(): boolean {
return process.env.BWCLI_ENV === 'development';
}
isSelfHost(): boolean {
return false;
}
isSelfHost(): boolean {
return false;
}
copyToClipboard(text: string, options?: any): void {
throw new Error("Not implemented.");
}
copyToClipboard(text: string, options?: any): void {
throw new Error('Not implemented.');
}
readFromClipboard(options?: any): Promise<string> {
throw new Error("Not implemented.");
}
readFromClipboard(options?: any): Promise<string> {
throw new Error('Not implemented.');
}
supportsBiometric(): Promise<boolean> {
return Promise.resolve(false);
}
supportsBiometric(): Promise<boolean> {
return Promise.resolve(false);
}
authenticateBiometric(): Promise<boolean> {
return Promise.resolve(false);
}
authenticateBiometric(): Promise<boolean> {
return Promise.resolve(false);
}
getDefaultSystemTheme() {
return Promise.resolve(ThemeType.Light as ThemeType.Light | ThemeType.Dark);
}
getDefaultSystemTheme() {
return Promise.resolve(ThemeType.Light as ThemeType.Light | ThemeType.Dark);
}
onDefaultSystemThemeChange() {
/* noop */
}
onDefaultSystemThemeChange() {
/* noop */
}
getEffectiveTheme() {
return Promise.resolve(ThemeType.Light);
}
getEffectiveTheme() {
return Promise.resolve(ThemeType.Light);
}
supportsSecureStorage(): boolean {
return false;
}
supportsSecureStorage(): boolean {
return false;
}
}