This commit is contained in:
Mo Bitar
2020-02-12 17:47:00 -06:00
parent a364a9ec03
commit 2daef55827
14 changed files with 212 additions and 230 deletions

View File

@@ -60,18 +60,18 @@ export class PureCtrl {
this.onAppStart();
}
if (!this.appState.isLocked()) {
this.onAppUnlock();
this.onAppLaunch();
}
this.unsubApp = this.application.addEventObserver(async (eventName) => {
this.onAppEvent(eventName);
if (eventName === ApplicationEvents.Started) {
await this.resetState();
await this.onAppStart();
} else if (eventName === ApplicationEvents.Unlocked) {
await this.onAppUnlock();
} else if (eventName === ApplicationEvents.Launched) {
await this.onAppLaunch();
} else if (eventName === ApplicationEvents.CompletedSync) {
this.onAppSync();
} else if (eventName === ApplicationEvents.KeyStatusChange) {
} else if (eventName === ApplicationEvents.KeyStatusChanged) {
this.onAppKeyChange();
}
});
@@ -89,7 +89,7 @@ export class PureCtrl {
/** Optional override */
}
async onAppUnlock() {
async onAppLaunch() {
/** Optional override */
}

View File

@@ -88,8 +88,8 @@ class EditorCtrl extends PureCtrl {
this.prefKeyMarginResizers = PrefKeys.EditorResizersEnabled;
}
onAppUnlock() {
super.onAppUnlock();
onAppLaunch() {
super.onAppLaunch();
this.streamItems();
this.registerComponentHandler();
}

View File

@@ -48,8 +48,8 @@ class FooterCtrl extends PureCtrl {
});
}
onAppUnlock() {
super.onAppUnlock();
onAppLaunch() {
super.onAppLaunch();
this.application.hasPasscode().then((value) => {
this.setState({
hasPasscode: value

View File

@@ -78,8 +78,8 @@ class NotesCtrl extends PureCtrl {
});
}
onAppUnlock() {
super.onAppUnlock();
onAppLaunch() {
super.onAppLaunch();
this.streamNotesAndTags();
this.reloadPreferences();
}

View File

@@ -1,4 +1,4 @@
import { Challenges, ChallengeResponse, ApplicationEvents } from 'snjs';
import { Challenges, ChallengeResponse } from 'snjs';
import { getPlatformString } from '@/utils';
import template from '%/root.pug';
import { AppStateEvents } from '@/state';
@@ -46,12 +46,12 @@ class RootCtrl extends PureCtrl {
onAppStart() {
super.onAppStart();
this.setState({ ready: false });
this.setState({ ready: true });
}
onAppUnlock() {
super.onAppUnlock();
this.setState({ ready: true, needsUnlock: false });
onAppLaunch() {
super.onAppLaunch();
this.setState({ needsUnlock: false });
this.application.componentManager.setDesktopManager(this.desktopManager);
this.application.registerService(this.themeManager);
this.handleAutoSignInFromParams();

View File

@@ -34,8 +34,8 @@ class TagsPanelCtrl extends PureCtrl {
this.registerComponentHandler();
}
onAppUnlock() {
super.onAppUnlock();
onAppLaunch() {
super.onAppLaunch();
this.loadPreferences();
this.beginStreamingItems();
const smartTags = this.application.getSmartTags();