You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 792B

123456789101112131415161718192021222324252627282930
  1. // @flow
  2. import { assign, ReducerRegistry } from '../redux';
  3. import { SET_NETWORK_INFO, _STORE_NETWORK_INFO_CLEANUP } from './actionTypes';
  4. import { STORE_NAME } from './constants';
  5. const DEFAULT_STATE = {
  6. isOnline: true
  7. };
  8. /**
  9. * The base/net-info feature's reducer.
  10. */
  11. ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
  12. switch (action.type) {
  13. case SET_NETWORK_INFO:
  14. return assign(state, {
  15. isOnline: action.isOnline,
  16. networkType: action.networkType,
  17. cellularGeneration: action.cellularGeneration,
  18. details: action.details
  19. });
  20. case _STORE_NETWORK_INFO_CLEANUP:
  21. return assign(state, {
  22. _cleanup: action.cleanup
  23. });
  24. default:
  25. return state;
  26. }
  27. });