mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Apply Prettier (#1202)
This commit is contained in:
@@ -1,54 +1,52 @@
|
||||
import {
|
||||
app,
|
||||
Menu,
|
||||
} from 'electron';
|
||||
import { app, Menu } from "electron";
|
||||
|
||||
import { Main } from '../main';
|
||||
import { Main } from "../main";
|
||||
|
||||
import { BaseMenu } from 'jslib-electron/baseMenu';
|
||||
import { BaseMenu } from "jslib-electron/baseMenu";
|
||||
|
||||
import { MenuUpdateRequest } from './menu.updater';
|
||||
import { Menubar } from './menubar';
|
||||
import { MenuUpdateRequest } from "./menu.updater";
|
||||
import { Menubar } from "./menubar";
|
||||
|
||||
const cloudWebVaultUrl: string = 'https://vault.bitwarden.com';
|
||||
const cloudWebVaultUrl: string = "https://vault.bitwarden.com";
|
||||
|
||||
export class MenuMain extends BaseMenu {
|
||||
constructor(private main: Main) {
|
||||
super(main.i18nService, main.windowMain);
|
||||
}
|
||||
constructor(private main: Main) {
|
||||
super(main.i18nService, main.windowMain);
|
||||
}
|
||||
|
||||
async init() {
|
||||
this.initContextMenu();
|
||||
await this.setMenu();
|
||||
}
|
||||
async init() {
|
||||
this.initContextMenu();
|
||||
await this.setMenu();
|
||||
}
|
||||
|
||||
async updateApplicationMenuState(updateRequest: MenuUpdateRequest) {
|
||||
await this.setMenu(updateRequest);
|
||||
}
|
||||
async updateApplicationMenuState(updateRequest: MenuUpdateRequest) {
|
||||
await this.setMenu(updateRequest);
|
||||
}
|
||||
|
||||
private async setMenu(updateRequest?: MenuUpdateRequest) {
|
||||
Menu.setApplicationMenu(new Menubar(
|
||||
this.main.i18nService,
|
||||
this.main.messagingService,
|
||||
this.main.updaterMain,
|
||||
this.windowMain,
|
||||
await this.getWebVaultUrl(),
|
||||
app.getVersion(),
|
||||
updateRequest,
|
||||
).menu);
|
||||
}
|
||||
private async setMenu(updateRequest?: MenuUpdateRequest) {
|
||||
Menu.setApplicationMenu(
|
||||
new Menubar(
|
||||
this.main.i18nService,
|
||||
this.main.messagingService,
|
||||
this.main.updaterMain,
|
||||
this.windowMain,
|
||||
await this.getWebVaultUrl(),
|
||||
app.getVersion(),
|
||||
updateRequest
|
||||
).menu
|
||||
);
|
||||
}
|
||||
|
||||
private async getWebVaultUrl() {
|
||||
let webVaultUrl = cloudWebVaultUrl;
|
||||
const urlsObj: any = await this.main.stateService.getEnvironmentUrls();
|
||||
if (urlsObj != null) {
|
||||
if (urlsObj.base != null) {
|
||||
webVaultUrl = urlsObj.base;
|
||||
} else if (urlsObj.webVault != null) {
|
||||
webVaultUrl = urlsObj.webVault;
|
||||
}
|
||||
}
|
||||
return webVaultUrl;
|
||||
private async getWebVaultUrl() {
|
||||
let webVaultUrl = cloudWebVaultUrl;
|
||||
const urlsObj: any = await this.main.stateService.getEnvironmentUrls();
|
||||
if (urlsObj != null) {
|
||||
if (urlsObj.base != null) {
|
||||
webVaultUrl = urlsObj.base;
|
||||
} else if (urlsObj.webVault != null) {
|
||||
webVaultUrl = urlsObj.webVault;
|
||||
}
|
||||
}
|
||||
|
||||
return webVaultUrl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user