Skip to content

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

add new actions for navigation

ammarahm-ed372094314c68
diff --git a/apps/mobile/src/provider/actions.js b/apps/mobile/src/provider/actions.js
index 7956f2a9e..a95d80fa7 100644
--- a/apps/mobile/src/provider/actions.js
+++ b/apps/mobile/src/provider/actions.js
@@ -21,4 +21,10 @@ export const ACTIONS = {
ALL: 'all',
CLEAR_ALL: 'allClear',
SYNCING: 'syncing',
+ HEADER_STATE: 'headerState',
+ SEARCH_STATE: 'searchState',
+ CONTAINER_STATE: 'containerState',
+ CONTAINER_BOTTOM_BUTTON:'containerBottomButton',
+ HEADER_VERTICAL_MENU:'verticalMenu',
+ HEADER_TEXT_STATE:'headerTextState'
};
diff --git a/apps/mobile/src/provider/reducer.js b/apps/mobile/src/provider/reducer.js
index 4139bdc8a..036826862 100644
--- a/apps/mobile/src/provider/reducer.js
+++ b/apps/mobile/src/provider/reducer.js
@@ -4,6 +4,7 @@ import {sideMenuRef} from '../utils/refs';
import storage from '../utils/storage';
import {eSendEvent} from '../services/eventManager';
import {eCloseSideMenu, eOpenSideMenu} from '../services/events';
+import {act} from 'react-test-renderer';
export const reducer = (state, action) => {
switch (action.type) {
@@ -191,11 +192,105 @@ export const reducer = (state, action) => {
}
case ACTIONS.SEARCH_RESULTS: {
let results = action.results;
+
return {
...state,
searchResults: {...results},
};
}
+ case ACTIONS.HEADER_STATE: {
+ let header = action.state.ind
+ ? {
+ ...state.indHeaderState,
+ ...action.state,
+ }
+ : {
+ ...state.headerState,
+ ...action.state,
+ };
+ return action.state.ind
+ ? {
+ ...state,
+ indHeaderState: {...header},
+ }
+ : {
+ ...state,
+ headerState: header,
+ };
+ }
+ case ACTIONS.SEARCH_STATE: {
+ let stat = action.state.ind
+ ? {
+ ...state.indSearchState,
+ ...action.state,
+ }
+ : {
+ ...state.searchState,
+ ...action.state,
+ };
+
+ return action.state.ind
+ ? {
+ ...state,
+ indSearchState: stat,
+ }
+ : {
+ ...state,
+ searchState: stat,
+ };
+ }
+ case ACTIONS.CONTAINER_STATE: {
+ return {
+ ...state,
+ containerState: action.state,
+ };
+ }
+ case ACTIONS.HEADER_TEXT_STATE: {
+ let stat = action.state.ind
+ ? {
+ ...state.indHeaderTextState,
+ ...action.state,
+ }
+ : {
+ ...state.headerTextState,
+ ...action.state,
+ };
+ return action.state.ind
+ ? {
+ ...state,
+ indHeaderTextState: stat,
+ }
+ : {
+ ...state,
+ headerTextState: stat,
+ };
+ }
+ case ACTIONS.HEADER_VERTICAL_MENU: {
+ return {
+ ...state,
+ headerVerticalMenu: action.state,
+ };
+ }
+ case ACTIONS.CONTAINER_BOTTOM_BUTTON: {
+ let containerBottomButton = action.state.ind
+ ? {
+ ...state.indContainerBottomButton,
+ ...action.state,
+ }
+ : {
+ ...state.containerBottomButton,
+ ...action.state,
+ };
+ return action.state.ind
+ ? {
+ ...state,
+ indContainerBottomButton: containerBottomButton,
+ }
+ : {
+ ...state,
+ containerBottomButton: containerBottomButton,
+ };
+ }
default:
throw new Error('unknown action type');
}