mac app store fixes

This commit is contained in:
Kyle Spearrin 2018-02-27 22:15:52 -05:00
parent d2338b4817
commit 270328d5b3
4 changed files with 88 additions and 86 deletions

View File

@ -42,8 +42,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="primary" appBlurClick (click)="manage()" <button type="button" class="primary" appBlurClick (click)="manage()" *ngIf="isPremium">
*ngIf="isPremium && showManageMembership">
<b>{{'premiumManage' | i18n}}</b> <b>{{'premiumManage' | i18n}}</b>
</button> </button>
<button type="button" class="primary" appBlurClick (click)="purchase()" *ngIf="!isPremium"> <button type="button" class="primary" appBlurClick (click)="purchase()" *ngIf="!isPremium">

View File

@ -19,7 +19,6 @@ import { TokenService } from 'jslib/abstractions/token.service';
}) })
export class PremiumComponent implements OnInit { export class PremiumComponent implements OnInit {
isPremium: boolean = false; isPremium: boolean = false;
showManageMembership: boolean = false;
price: string = '$10'; price: string = '$10';
refreshPromise: Promise<any>; refreshPromise: Promise<any>;
@ -29,7 +28,6 @@ export class PremiumComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
this.isPremium = this.tokenService.getPremium(); this.isPremium = this.tokenService.getPremium();
this.showManageMembership = !this.platformUtilsService.isMacAppStore();
} }
async refresh() { async refresh() {

View File

@ -153,6 +153,90 @@ export class MenuMain {
} }
private initApplicationMenu() { private initApplicationMenu() {
const accountSubmenu: MenuItemConstructorOptions[] = [
{
label: this.main.i18nService.t('changeMasterPass'),
id: 'changeMasterPass',
click: async () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('changeMasterPass'),
message: this.main.i18nService.t('changeMasterPass'),
detail: this.main.i18nService.t('changeMasterPasswordConfirmation'),
buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
await this.openWebVault();
}
},
},
{
label: this.main.i18nService.t('changeEmail'),
id: 'changeEmail',
click: async () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('changeEmail'),
message: this.main.i18nService.t('changeEmail'),
detail: this.main.i18nService.t('changeEmailConfirmation'),
buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
await this.openWebVault();
}
},
},
{
label: this.main.i18nService.t('twoStepLogin'),
id: 'twoStepLogin',
click: async () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('twoStepLogin'),
message: this.main.i18nService.t('twoStepLogin'),
detail: this.main.i18nService.t('twoStepLoginConfirmation'),
buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
await this.openWebVault();
}
},
},
{ type: 'separator' },
{
label: this.main.i18nService.t('logOut'),
id: 'logOut',
click: () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('logOut'),
message: this.main.i18nService.t('logOut'),
detail: this.main.i18nService.t('logOutConfirmation'),
buttons: [this.main.i18nService.t('logOut'), this.main.i18nService.t('cancel')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
this.main.messagingService.send('logout');
}
},
},
];
if (!isMacAppStore()) {
accountSubmenu.unshift({
label: this.main.i18nService.t('premiumMembership'),
click: () => this.main.messagingService.send('openPremium'),
id: 'premiumMembership',
});
}
const template: MenuItemConstructorOptions[] = [ const template: MenuItemConstructorOptions[] = [
{ {
label: this.main.i18nService.t('file'), label: this.main.i18nService.t('file'),
@ -290,86 +374,7 @@ export class MenuMain {
}, },
{ {
label: this.main.i18nService.t('account'), label: this.main.i18nService.t('account'),
submenu: [ submenu: accountSubmenu,
{
label: this.main.i18nService.t('premiumMembership'),
click: () => this.main.messagingService.send('openPremium'),
id: 'premiumMembership',
},
{
label: this.main.i18nService.t('changeMasterPass'),
id: 'changeMasterPass',
click: async () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('changeMasterPass'),
message: this.main.i18nService.t('changeMasterPass'),
detail: this.main.i18nService.t('changeMasterPasswordConfirmation'),
buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
await this.openWebVault();
}
},
},
{
label: this.main.i18nService.t('changeEmail'),
id: 'changeEmail',
click: async () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('changeEmail'),
message: this.main.i18nService.t('changeEmail'),
detail: this.main.i18nService.t('changeEmailConfirmation'),
buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
await this.openWebVault();
}
},
},
{
label: this.main.i18nService.t('twoStepLogin'),
id: 'twoStepLogin',
click: async () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('twoStepLogin'),
message: this.main.i18nService.t('twoStepLogin'),
detail: this.main.i18nService.t('twoStepLoginConfirmation'),
buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
await this.openWebVault();
}
},
},
{ type: 'separator' },
{
label: this.main.i18nService.t('logOut'),
id: 'logOut',
click: () => {
const result = dialog.showMessageBox(this.main.windowMain.win, {
title: this.main.i18nService.t('logOut'),
message: this.main.i18nService.t('logOut'),
detail: this.main.i18nService.t('logOutConfirmation'),
buttons: [this.main.i18nService.t('logOut'), this.main.i18nService.t('cancel')],
cancelId: 1,
defaultId: 0,
noLink: true,
});
if (result === 0) {
this.main.messagingService.send('logout');
}
},
},
],
}, },
{ {
label: this.main.i18nService.t('window'), label: this.main.i18nService.t('window'),
@ -561,7 +566,7 @@ export class MenuMain {
template[template.length - 2].submenu = [ template[template.length - 2].submenu = [
{ {
label: this.main.i18nService.t('close'), label: this.main.i18nService.t('close'),
role: 'quit', role: isMacAppStore() ? 'quit' : 'close',
}, },
{ {
label: this.main.i18nService.t('minimize'), label: this.main.i18nService.t('minimize'),

View File

@ -50,7 +50,7 @@ export class WindowMain {
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar // On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q // to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') { if (process.platform !== 'darwin' || isMacAppStore()) {
app.quit(); app.quit();
} }
}); });