WIP
This commit is contained in:
@@ -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 */
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ class EditorCtrl extends PureCtrl {
|
||||
this.prefKeyMarginResizers = PrefKeys.EditorResizersEnabled;
|
||||
}
|
||||
|
||||
onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
onAppLaunch() {
|
||||
super.onAppLaunch();
|
||||
this.streamItems();
|
||||
this.registerComponentHandler();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class FooterCtrl extends PureCtrl {
|
||||
});
|
||||
}
|
||||
|
||||
onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
onAppLaunch() {
|
||||
super.onAppLaunch();
|
||||
this.application.hasPasscode().then((value) => {
|
||||
this.setState({
|
||||
hasPasscode: value
|
||||
|
||||
@@ -78,8 +78,8 @@ class NotesCtrl extends PureCtrl {
|
||||
});
|
||||
}
|
||||
|
||||
onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
onAppLaunch() {
|
||||
super.onAppLaunch();
|
||||
this.streamNotesAndTags();
|
||||
this.reloadPreferences();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -60,14 +60,14 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
};
|
||||
this.syncStatus = this.application.getSyncStatus();
|
||||
}
|
||||
|
||||
|
||||
async onAppKeyChange() {
|
||||
super.onAppKeyChange();
|
||||
this.setState(await this.refreshedCredentialState());
|
||||
}
|
||||
|
||||
async onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
|
||||
async onAppLaunch() {
|
||||
super.onAppLaunch();
|
||||
this.setState(await this.refreshedCredentialState());
|
||||
this.loadHost();
|
||||
this.checkForSecurityUpdate();
|
||||
@@ -477,11 +477,11 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const func = this.state.formData.changingPasscode
|
||||
? this.application.changePasscode.bind(this.application)
|
||||
: this.application.setPasscode.bind(this.application);
|
||||
func(passcode, async () => {
|
||||
await this.setFormDataState({
|
||||
(this.state.formData.changingPasscode
|
||||
? this.application.changePasscode(passcode)
|
||||
: this.application.setPasscode(passcode)
|
||||
).then(() => {
|
||||
this.setFormDataState({
|
||||
passcode: null,
|
||||
confirmPasscode: null,
|
||||
showPasscodeForm: false
|
||||
|
||||
@@ -14,8 +14,8 @@ class PrivilegesManagementModalCtrl extends PureCtrl {
|
||||
this.application = application;
|
||||
}
|
||||
|
||||
onAppUnlock() {
|
||||
super.onAppUnlock();
|
||||
onAppLaunch() {
|
||||
super.onAppLaunch();
|
||||
this.hasPasscode = this.application.hasPasscode();
|
||||
this.hasAccount = !this.application.noAccount();
|
||||
this.reloadPrivileges();
|
||||
|
||||
@@ -16,7 +16,7 @@ export class NativeExtManager {
|
||||
this.extManagerId = 'org.standardnotes.extensions-manager';
|
||||
this.batchManagerId = 'org.standardnotes.batch-manager';
|
||||
|
||||
this.unsub = application.addSingleEventObserver(ApplicationEvents.Unlocked, () => {
|
||||
this.unsub = application.addSingleEventObserver(ApplicationEvents.Launched, () => {
|
||||
this.reload();
|
||||
this.streamChanges();
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ export class PreferencesManager {
|
||||
) {
|
||||
this.application = application;
|
||||
this.appState = appState;
|
||||
this.unsub = application.addSingleEventObserver(ApplicationEvents.Unlocked, () => {
|
||||
this.unsub = application.addSingleEventObserver(ApplicationEvents.Launched, () => {
|
||||
this.streamPreferences();
|
||||
this.loadSingleton();
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ export class AppState {
|
||||
this.unsubApp = this.application.addEventObserver(async (eventName) => {
|
||||
if (eventName === ApplicationEvents.Started) {
|
||||
this.locked = true;
|
||||
} else if (eventName === ApplicationEvents.Unlocked) {
|
||||
} else if (eventName === ApplicationEvents.Launched) {
|
||||
this.locked = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ export class WebDeviceInterface extends DeviceInterface {
|
||||
}
|
||||
|
||||
/** @keychian */
|
||||
async getRawKeychainValue() {
|
||||
async getKeychainValue() {
|
||||
const value = localStorage.getItem(KEYCHAIN_STORAGE_KEY);
|
||||
if(value) {
|
||||
return JSON.parse(value);
|
||||
|
||||
374
dist/javascripts/app.js
vendored
374
dist/javascripts/app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user