Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

close note after adding it to vault or moving app to background

ammarahm-ed4edb98037f81
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.js
index f4bbc9c82..ed4d7c008 100644
--- a/apps/mobile/AppRootEvents.js
+++ b/apps/mobile/AppRootEvents.js
@@ -101,6 +101,9 @@ const onAppStateChanged = async (state) => {
await MMKV.removeItem('appState');
}
} else {
+ if (getNote().locked) {
+ eSendEvent(eClearEditor);
+ }
await storeAppState();
if (SettingsService.get().privacyScreen) {
enabled(true);
@@ -124,7 +127,6 @@ export const AppRootEvents = React.memo(
EV.subscribe(EVENTS.userSubscriptionUpdated, onAccountStatusChange);
EV.subscribe(EVENTS.noteRemoved, onNoteRemoved);
-
return () => {
EV.unsubscribe(EVENTS.appRefreshRequested, onSyncComplete);
EV.unsubscribe(EVENTS.databaseSyncRequested, partialSync);
@@ -144,7 +146,7 @@ export const AppRootEvents = React.memo(
const onNoteRemoved = async (id) => {
try {
- console.log("removing note");
+ console.log('removing note');
await db.notes.remove(id);
Navigation.setRoutesToUpdate([
Navigation.routeNames.Favorites,
@@ -329,7 +331,7 @@ export const AppRootEvents = React.memo(
setEmailVerifyMessage(dispatch);
return;
}
- console.log("RUNNING SYNC")
+ console.log('RUNNING SYNC');
await Sync.run();
} else {
await PremiumService.setPremiumStatus();
diff --git a/apps/mobile/src/components/VaultDialog/index.js b/apps/mobile/src/components/VaultDialog/index.js
index 3aa04223b..b6f277873 100644
--- a/apps/mobile/src/components/VaultDialog/index.js
+++ b/apps/mobile/src/components/VaultDialog/index.js
@@ -32,7 +32,7 @@ import {deleteItems} from '../../utils/functions';
import {tabBarRef} from '../../utils/Refs';
import {ph, SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils';
-import { getNote } from '../../views/Editor/Functions';
+import {getNote} from '../../views/Editor/Functions';
import {Button} from '../Button';
import BaseDialog from '../Dialog/base-dialog';
import DialogButtons from '../Dialog/dialog-buttons';
@@ -141,6 +141,7 @@ export class VaultDialog extends Component {
if (biometry) {
available = true;
}
+
this.setState({
note: data.item,
novault: data.novault,
@@ -321,15 +322,18 @@ export class VaultDialog extends Component {
type: 'error',
context: 'local',
});
+ console.log('returning from here');
return;
} else {
-
- db.vault.add(this.state.note.id).then((e) => {
- if (this.state.note.id === getNote().id) {
- eSendEvent(eClearEditor);
- }
- this.close();
+ await db.vault.add(this.state.note.id);
+ if (this.state.note.id === getNote().id) {
+ eSendEvent(eClearEditor);
+ }
+ this.close();
+ this.setState({
+ loading: false,
});
+
}
}
@@ -499,7 +503,7 @@ export class VaultDialog extends Component {
wrongPassword: true,
});
return;
- }
+ }
}
_revokeFingerprintAccess = async () => {
@@ -511,7 +515,6 @@ export class VaultDialog extends Component {
type: 'success',
context: 'local',
});
-
} catch (e) {
ToastEvent.show({
title: e.message,
@@ -564,7 +567,8 @@ export class VaultDialog extends Component {
if (!visible) return null;
return (
<BaseDialog
- onShow={() => {
+ onShow={async () => {
+ await sleep(300);
passInputRef.current?.focus();
}}
statusBarTranslucent={false}