Rocket.Chat.ReactNative/app/reducers/app.js

43 lines
683 B
JavaScript
Raw Normal View History

2020-04-15 17:39:54 +00:00
import { APP, APP_STATE } from '../actions/actionsTypes';
const initialState = {
root: null,
ready: false,
2020-04-15 17:39:54 +00:00
foreground: true,
background: false
};
export default function app(state = initialState, action) {
switch (action.type) {
2020-04-15 17:39:54 +00:00
case APP_STATE.FOREGROUND:
return {
...state,
foreground: true,
background: false
};
2020-04-15 17:39:54 +00:00
case APP_STATE.BACKGROUND:
return {
...state,
foreground: false,
background: true
};
case APP.START:
return {
...state,
root: action.root
};
case APP.INIT:
return {
...state,
2018-12-05 20:52:08 +00:00
ready: false
};
case APP.READY:
return {
...state,
2018-12-05 20:52:08 +00:00
ready: true
};
default:
return state;
}
}