WIP
This commit is contained in:
@@ -701,7 +701,7 @@ class EditorCtrl extends PureCtrl {
|
||||
this.saveTags({ strings: strings });
|
||||
}
|
||||
|
||||
saveTags({ strings } = {}) {
|
||||
async saveTags({ strings } = {}) {
|
||||
if (!strings && this.state.mutable.tagsString === this.state.note.tagsString()) {
|
||||
return;
|
||||
}
|
||||
@@ -732,7 +732,7 @@ class EditorCtrl extends PureCtrl {
|
||||
);
|
||||
if (!existingRelationship) {
|
||||
tags.push(
|
||||
this.application.findOrCreateTag({ title: tagString })
|
||||
await this.application.findOrCreateTag({ title: tagString })
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@ class LockScreenCtrl {
|
||||
this.addDestroyHandler();
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.puppet.focusInput = () => {
|
||||
this.passcodeInput.focus();
|
||||
};
|
||||
}
|
||||
|
||||
get passcodeInput() {
|
||||
return document.getElementById(
|
||||
ELEMENT_ID_PASSCODE_INPUT
|
||||
@@ -49,15 +55,7 @@ class LockScreenCtrl {
|
||||
return;
|
||||
}
|
||||
this.passcodeInput.blur();
|
||||
const success = await this.onValue()(this.formData.passcode);
|
||||
if(!success) {
|
||||
this.application.alertManager.alert({
|
||||
text: "Invalid passcode. Please try again.",
|
||||
onClose: () => {
|
||||
this.passcodeInput.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.onValue()(this.formData.passcode);
|
||||
}
|
||||
|
||||
forgotPasscode() {
|
||||
@@ -85,6 +83,7 @@ export class LockScreen {
|
||||
this.bindToController = true;
|
||||
this.scope = {
|
||||
onValue: '&',
|
||||
puppet: '='
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _ from 'lodash';
|
||||
import { Challenges } from 'snjs';
|
||||
import { Challenges, ChallengeResponse } from 'snjs';
|
||||
import { getPlatformString } from '@/utils';
|
||||
import template from '%/root.pug';
|
||||
import { AppStateEvents } from '@/state';
|
||||
@@ -46,20 +45,48 @@ class RootCtrl extends PureCtrl {
|
||||
this.loadApplication();
|
||||
this.addAppStateObserver();
|
||||
this.addDragDropHandlers();
|
||||
|
||||
|
||||
application.onReady(() => {
|
||||
this.handleAutoSignInFromParams();
|
||||
});
|
||||
|
||||
this.lockScreenPuppet = {
|
||||
focusInput: () => {}
|
||||
};
|
||||
}
|
||||
|
||||
async watchLockscreenValue() {
|
||||
return new Promise((resolve) => {
|
||||
const onLockscreenValue = (value) => {
|
||||
resolve(new ChallengeResponse({
|
||||
challenge: Challenges.LocalPasscode,
|
||||
value: value
|
||||
}));
|
||||
};
|
||||
this.setState({ onLockscreenValue });
|
||||
});
|
||||
}
|
||||
|
||||
async loadApplication() {
|
||||
await this.application.prepareForLaunch({
|
||||
callbacks: {
|
||||
authChallengeResponses: async (challenges) => {
|
||||
console.log("Needs challenge repsonses", challenges);
|
||||
requiresChallengeResponses: async (challenges) => {
|
||||
if (challenges.includes(Challenges.LocalPasscode)) {
|
||||
this.setState({ needsUnlock: true });
|
||||
}
|
||||
return this.watchLockscreenValue();
|
||||
},
|
||||
handleChallengeFailures: (responses) => {
|
||||
for(const response of responses) {
|
||||
if(response.challenge === Challenges.LocalPasscode) {
|
||||
this.application.alertManager.alert({
|
||||
text: "Invalid passcode. Please try again.",
|
||||
onClose: () => {
|
||||
this.lockScreenPuppet.focusInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onReady: async () => {
|
||||
await this.appState.setApplicationReady();
|
||||
|
||||
@@ -36,6 +36,10 @@ class TagsPanelCtrl extends PureCtrl {
|
||||
});
|
||||
this.selectTag(smartTags[0]);
|
||||
});
|
||||
|
||||
application.onSync(() => {
|
||||
this.reloadNoteCounts();
|
||||
});
|
||||
}
|
||||
|
||||
beginStreamingItems() {
|
||||
|
||||
Reference in New Issue
Block a user