diff --git a/apps/mobile/App.js b/apps/mobile/App.js index 91d63695d..d173516dd 100644 --- a/apps/mobile/App.js +++ b/apps/mobile/App.js @@ -28,6 +28,7 @@ import {db} from './src/utils/DB'; import {DDS} from './src/services/DeviceDetection'; import {MMKV} from './src/utils/mmkv'; import Backup from './src/services/Backup'; +import { setLoginMessage } from './src/services/Message'; let firstLoad = true; let note = null; @@ -160,6 +161,8 @@ const App = () => { if (user) { dispatch({type: Actions.USER, user: user}); await startSyncer(); + } else { + setLoginMessage(dispatch); } dispatch({type: Actions.ALL}); setInit(true); diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js index efa8b2d9b..709a337ba 100644 --- a/apps/mobile/src/components/SimpleList/index.js +++ b/apps/mobile/src/components/SimpleList/index.js @@ -325,7 +325,7 @@ const MessageCard = ({data}) => { : colors.accent, fontSize: SIZE.xxs, }}> - {messageBoardState.data.actionText} + {messageBoardState.actionText} diff --git a/apps/mobile/src/provider/Actions.js b/apps/mobile/src/provider/Actions.js index 3b0796185..312e96003 100644 --- a/apps/mobile/src/provider/Actions.js +++ b/apps/mobile/src/provider/Actions.js @@ -26,5 +26,6 @@ export const Actions = { CONTAINER_STATE: 'containerState', CONTAINER_BOTTOM_BUTTON:'containerBottomButton', HEADER_VERTICAL_MENU:'verticalMenu', - HEADER_TEXT_STATE:'headerTextState' + HEADER_TEXT_STATE:'headerTextState', + MESSAGE_BOARD_STATE:'messageBoardState' }; diff --git a/apps/mobile/src/provider/Reducer.js b/apps/mobile/src/provider/Reducer.js index c19f3bea9..2477340ec 100644 --- a/apps/mobile/src/provider/Reducer.js +++ b/apps/mobile/src/provider/Reducer.js @@ -241,6 +241,12 @@ export const reducer = (state, action) => { containerBottomButton: containerBottomButton, }; } + case Actions.MESSAGE_BOARD_STATE: { + return { + ...state, + messageBoardState:action.state + } + } default: throw new Error('unknown action type'); } diff --git a/apps/mobile/src/services/Message.js b/apps/mobile/src/services/Message.js new file mode 100644 index 000000000..74d3ba84f --- /dev/null +++ b/apps/mobile/src/services/Message.js @@ -0,0 +1,16 @@ +import { Actions } from "../provider/Actions"; +import { eOpenLoginDialog } from "../utils/Events"; +import { eSendEvent } from "./EventManager"; + +export function setLoginMessage(dispatch) { + dispatch({type:Actions.MESSAGE_BOARD_STATE,state:{ + visible:true, + message:'You are not logged in', + actionText:"Login to sync your notes", + onPress: () => { + eSendEvent(eOpenLoginDialog); + }, + data:{}, + icon:'account-outline' + }}); +} \ No newline at end of file