bitwarden-estensione-browser/src/main/menu.help.ts

224 lines
6.7 KiB
TypeScript
Raw Normal View History

[Account Switching] [Feature] Add the ability to maintain state for up to 5 accounts at once (#1079) * [refactor] Remove references to deprecated services * [feature] Implement account switching * [bug] Fix state handling for authentication dependent system menu items * [bug] Enable the account switcher to fucntion properly when switching to a locked accounts * [feature] Enable locking any account from the menu * [bug] Ensure the avatar instance used in the account switcher updates on account change * [style] Fix lint complaints * [bug] Ensure the logout command callback can handle any user in state * [style] Fix lint complaints * rollup * [style] Fix lint complaints * [bug] Don't clean up state until everything else is done on logout * [bug] Navigate to vault on a succesful account switch * [bug] Init the state service on start * [feature] Limit account switching to 5 account maximum * [bug] Resolve app lock state with 5 logged out accounts * [chore] Update account refrences to match recent jslib restructuring * [bug] Add missing awaits * [bug] Update app menu on logout * [bug] Hide the switcher if there are no authed accounts * [bug] Move authenticationStatus display information out of jslib * [bug] Remove unused active style from scss * [refactor] Rewrite the menu bar * [style] Fix lint complaints * [bug] Clean state of loggout out user after redirect * [bug] Redirect on logout if not explicity provided a userId that isn't active * [bug] Relocated several settings items to persistant storage * [bug] Correct account switcher styles on all themes * [chore] Include state migration service in services * [bug] Swap to next account on logout * [bug] Correct DI service * [bug] fix loginGuard deps in services.module * [chore] update jslib * [bug] Remove badly merged scss * [chore] update jslib * [review] Code review cleanup * [review] Code review cleanup Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-15 23:32:00 +01:00
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { IMenubarMenu } from './menubar';
import { shell } from 'electron';
import { isMacAppStore, isWindowsStore } from 'jslib-electron/utils';
import { MenuItemConstructorOptions } from 'electron';
export class HelpMenu implements IMenubarMenu {
readonly id: string = 'help';
get label(): string {
return this.localize('help');
}
get items(): MenuItemConstructorOptions[] {
return [
this.emailUs,
this.visitOurWebsite,
this.fileBugReport,
this.legal,
this.separator,
this.followUs,
this.separator,
this.goToWebVault,
this.separator,
this.getMobileApp,
this.getBrowserExtension,
];
}
private readonly _i18nService: I18nService;
private readonly _webVaultUrl: string;
constructor(
i18nService: I18nService,
webVaultUrl: string
) {
this._i18nService = i18nService;
this._webVaultUrl = webVaultUrl;
}
private get emailUs(): MenuItemConstructorOptions {
return {
id: 'emailUs',
label: this.localize('emailUs'),
click: () => shell.openExternal('mailTo:hello@bitwarden.com'),
};
}
private get visitOurWebsite(): MenuItemConstructorOptions {
return {
id: 'visitOurWebsite',
label: this.localize('visitOurWebsite'),
click: () => shell.openExternal('https://bitwarden.com/contact'),
};
}
private get fileBugReport(): MenuItemConstructorOptions {
return {
id: 'fileBugReport',
label: this.localize('fileBugReport'),
click: () => shell.openExternal('https://github.com/bitwarden/desktop/issues'),
};
}
private get legal(): MenuItemConstructorOptions {
return {
id: 'legal',
label: this.localize('legal'),
visible: !isMacAppStore(),
submenu: this.legalSubmenu,
};
}
private get legalSubmenu(): MenuItemConstructorOptions[] {
return [
{
id: 'termsOfService',
label: this.localize('termsOfService'),
click: () => shell.openExternal('https://bitwarden.com/terms/'),
},
{
id: 'privacyPolicy',
label: this.localize('privacyPolicy'),
click: () => shell.openExternal('https://bitwarden.com/privacy/'),
},
];
}
private get separator(): MenuItemConstructorOptions {
return { type: 'separator' };
}
private get followUs(): MenuItemConstructorOptions {
return {
id: 'followUs',
label: this.localize('followUs'),
submenu: this.followUsSubmenu,
};
}
private get followUsSubmenu(): MenuItemConstructorOptions[] {
return [
{
id: 'blog',
label: this.localize('blog'),
click: () => shell.openExternal('https://blog.bitwarden.com'),
},
{
id: 'twitter',
label: 'Twitter',
click: () => shell.openExternal('https://twitter.com/bitwarden'),
},
{
id: 'facebook',
label: 'Facebook',
click: () => shell.openExternal('https://www.facebook.com/bitwarden/'),
},
{
id: 'github',
label: 'GitHub',
click: () => shell.openExternal('https://github.com/bitwarden'),
},
];
}
private get goToWebVault(): MenuItemConstructorOptions {
return {
id: 'goToWebVault',
label: this.localize('goToWebVault'),
click: () => shell.openExternal(this._webVaultUrl),
};
}
private get getMobileApp(): MenuItemConstructorOptions {
return {
id: 'getMobileApp',
label: this.localize('getMobileApp'),
visible: !isWindowsStore(),
submenu: this.getMobileAppSubmenu,
};
}
private get getMobileAppSubmenu(): MenuItemConstructorOptions[] {
return [
{
id: 'iOS',
label: 'iOS',
click: () => {
shell.openExternal('https://itunes.apple.com/app/' +
'bitwarden-free-password-manager/id1137397744?mt=8');
},
},
{
id: 'android',
label: 'Android',
click: () => {
shell.openExternal('https://play.google.com/store/apps/' +
'details?id=com.x8bit.bitwarden');
},
},
];
}
private get getBrowserExtension(): MenuItemConstructorOptions {
return {
id: 'getBrowserExtension',
label: this.localize('getBrowserExtension'),
visible: !isWindowsStore(),
submenu: this.getBrowserExtensionSubmenu,
};
}
private get getBrowserExtensionSubmenu(): MenuItemConstructorOptions[] {
return [
{
id: 'chrome',
label: 'Chrome',
click: () => {
shell.openExternal('https://chrome.google.com/webstore/detail/' +
'bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb');
},
},
{
id: 'firefox',
label: 'Firefox',
click: () => {
shell.openExternal('https://addons.mozilla.org/firefox/addon/' +
'bitwarden-password-manager/');
},
},
{
id: 'firefox',
label: 'Opera',
click: () => {
shell.openExternal('https://addons.opera.com/extensions/details/' +
'bitwarden-free-password-manager/');
},
},
{
id: 'firefox',
label: 'Edge',
click: () => {
shell.openExternal('https://microsoftedge.microsoft.com/addons/' +
'detail/jbkfoedolllekgbhcbcoahefnbanhhlh');
},
},
{
id: 'safari',
label: 'Safari',
click: () => {
shell.openExternal('https://bitwarden.com/download/');
},
},
];
}
private localize(s: string) {
return this._i18nService.t(s);
}
}