Improve event handling + restarts
This commit is contained in:
@@ -2,11 +2,9 @@ import { isDesktopApplication, isNullOrUndefined } from '@/utils';
|
||||
import template from '%/directives/account-menu.pug';
|
||||
import { ProtectedActions } from 'snjs';
|
||||
import { PureCtrl } from '@Controllers';
|
||||
import { AppStateEvents } from '@/state';
|
||||
import {
|
||||
STRING_ACCOUNT_MENU_UNCHECK_MERGE,
|
||||
STRING_SIGN_OUT_CONFIRMATION,
|
||||
STRING_ERROR_DECRYPTING_IMPORT,
|
||||
STRING_E2E_ENABLED,
|
||||
STRING_LOCAL_ENC_ENABLED,
|
||||
STRING_ENC_NOT_ENABLED,
|
||||
@@ -51,6 +49,7 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
this.state = {
|
||||
appVersion: 'v' + (window.electronAppVersion || appVersion),
|
||||
passcodeAutoLockOptions: this.lockManager.getAutoLockIntervalOptions(),
|
||||
user: this.application.getUser(),
|
||||
formData: {
|
||||
mergeLocal: true,
|
||||
ephemeral: false,
|
||||
@@ -59,18 +58,22 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
},
|
||||
mutable: {}
|
||||
};
|
||||
application.onUnlock(async () => {
|
||||
this.setState(await this.refreshedCredentialState());
|
||||
this.loadHost();
|
||||
this.checkForSecurityUpdate();
|
||||
this.reloadAutoLockInterval();
|
||||
this.loadBackupsAvailability();
|
||||
});
|
||||
application.onCredentialChange(async () => {
|
||||
this.setState(await this.refreshedCredentialState());
|
||||
});
|
||||
this.syncStatus = this.application.getSyncStatus();
|
||||
}
|
||||
|
||||
async onAppKeyChange() {
|
||||
super.onAppKeyChange();
|
||||
this.setState(await this.refreshedCredentialState());
|
||||
}
|
||||
|
||||
async onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
this.setState(await this.refreshedCredentialState());
|
||||
this.loadHost();
|
||||
this.checkForSecurityUpdate();
|
||||
this.reloadAutoLockInterval();
|
||||
this.loadBackupsAvailability();
|
||||
}
|
||||
|
||||
async refreshedCredentialState() {
|
||||
return {
|
||||
@@ -81,6 +84,7 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
super.$onInit();
|
||||
this.initProps({
|
||||
closeFunction: this.closeFunction
|
||||
});
|
||||
@@ -88,7 +92,6 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
|
||||
close() {
|
||||
this.$timeout(() => {
|
||||
console.log(" : AccountMenuCtrl -> close -> timeout");
|
||||
this.props.closeFunction()();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class ActionsMenuCtrl extends PureCtrl {
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
super.$onInit();
|
||||
this.initProps({
|
||||
item: this.item
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ class EditorMenuCtrl extends PureCtrl {
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
super.$onInit();
|
||||
const editors = this.application.componentManager.componentsForArea('editor-editor')
|
||||
.sort((a, b) => {
|
||||
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
import template from '%/directives/privileges-management-modal.pug';
|
||||
import { PrivilegeCredentials } from 'snjs';
|
||||
import { PureCtrl } from '@Controllers';
|
||||
|
||||
class PrivilegesManagementModalCtrl {
|
||||
class PrivilegesManagementModalCtrl extends PureCtrl {
|
||||
/* @ngInject */
|
||||
constructor(
|
||||
$timeout,
|
||||
$element,
|
||||
application
|
||||
) {
|
||||
super(null, $timeout);
|
||||
this.$element = $element;
|
||||
this.$timeout = $timeout;
|
||||
this.application = application;
|
||||
application.onUnlock(() => {
|
||||
this.hasPasscode = application.hasPasscode();
|
||||
this.hasAccount = !application.noAccount();
|
||||
this.reloadPrivileges();
|
||||
});
|
||||
}
|
||||
|
||||
onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
this.hasPasscode = this.application.hasPasscode();
|
||||
this.hasAccount = !this.application.noAccount();
|
||||
this.reloadPrivileges();
|
||||
}
|
||||
|
||||
displayInfoForCredential(credential) {
|
||||
|
||||
Reference in New Issue
Block a user