A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
improve login flow
ammarahm-edacc2d6b940de
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex 641e1c9a6..a66e4aa6f 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -46,7 +46,7 @@ const App = () => {db.init().then(async () => {let user = await db.user.get();dispatch({type: ACTIONS.USER, user: user});-+ dispatch({type: ACTIONS.ALL});setInit(true);});});diff --git a/apps/mobile/src/components/VaultDialog/index.js b/apps/mobile/src/components/VaultDialog/index.jsindex 8db358ae1..a2cf62c0b 100644--- a/apps/mobile/src/components/VaultDialog/index.js+++ b/apps/mobile/src/components/VaultDialog/index.js@@ -338,9 +338,7 @@ export class VaultDialog extends Component {style={{padding: pv - 5,borderWidth: 1.5,- borderColor: this.state.wrongPassword- ? colors.errorText- : colors.nav,+ borderColor: wrongPassword ? colors.errorText : colors.nav,paddingHorizontal: ph,borderRadius: 5,marginTop: 10,diff --git a/apps/mobile/src/provider/actions.js b/apps/mobile/src/provider/actions.jsindex 31f046fb2..a97e4a71d 100644--- a/apps/mobile/src/provider/actions.js+++ b/apps/mobile/src/provider/actions.js@@ -18,4 +18,5 @@ export const ACTIONS = {CURRENT_SCREEN: 'currentScreen',SETTINGS: 'getSettings',SELECT_ALL: 'selectAll',+ ALL: 'all',};diff --git a/apps/mobile/src/provider/reducer.js b/apps/mobile/src/provider/reducer.jsindex 4b7f88cfc..ea1a85b56 100644--- a/apps/mobile/src/provider/reducer.js+++ b/apps/mobile/src/provider/reducer.js@@ -4,6 +4,24 @@ import {sideMenuRef} from '../utils/refs';export const reducer = (state, action) => {switch (action.type) {+ case ACTIONS.ALL: {+ let notes = db.notes.pinned;+ let notebooks = db.notebooks.pinned;+ return {+ ...state,+ notes: db.notes.group(),+ user: action.user,+ notebooks: db.notebooks.all,+ trash: db.trash.all,+ pinned: {+ notes,+ notebooks,+ },+ tags: db.tags.all,+ favorites: db.notes.favorites,+ colorNotes: db.colors.all,+ };+ }case ACTIONS.NOTES:let notes;if (action.sort) {diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.jsindex 9239af8bd..a4911c385 100644--- a/apps/mobile/src/views/Login/index.js+++ b/apps/mobile/src/views/Login/index.js@@ -14,7 +14,7 @@ import {opacity, pv, SIZE, WEIGHT} from '../../common/common';import {Header} from '../../components/header';import {useTracked} from '../../provider';import {eSendEvent} from '../../services/eventManager';-import {eCloseSideMenu} from '../../services/events';+import {eCloseSideMenu, refreshNotesPage} from '../../services/events';import * as Animatable from 'react-native-animatable';import {validateEmail,@@ -86,7 +86,7 @@ export const Login = ({navigation}) => {console.log(e, 'ERROR');setTimeout(() => {- ToastEvent.show('Network error, failed to login', 'error');+ ToastEvent.show(e.message, 'error');setLoggingIn(false);}, 500);@@ -100,12 +100,14 @@ export const Login = ({navigation}) => {user = await db.user.get();console.log('user', user);dispatch({type: ACTIONS.USER, user: user});- ToastEvent.show(`Logged in as ${'ammarahmed'}`, 'success');+ ToastEvent.show(`Logged in as ${user.username}`, 'success');navigation.goBack();+ await db.sync();+ eSendEvent(refreshNotesPage);+ dispatch({type: ACTIONS.ALL});} catch (e) {console.log(e, 'getUSer');-- ToastEvent.show(`Login Failed`, 'error');+ ToastEvent.show(e.message, 'error');}console.log(user);