Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
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.
 
 
 
 
 
 
jitsi-meet/react/features/base/net-info/reducer.ts

40 lines
1.1 KiB

import { NetInfoCellularGeneration, NetInfoStateType } from '@react-native-community/netinfo';
import ReducerRegistry from '../redux/ReducerRegistry';
import { assign } from '../redux/functions';
import { SET_NETWORK_INFO, _STORE_NETWORK_INFO_CLEANUP } from './actionTypes';
import { STORE_NAME } from './constants';
const DEFAULT_STATE = {
isOnline: true
};
export interface INetInfoState {
_cleanup?: Function;
cellularGeneration?: NetInfoCellularGeneration;
details?: Object;
isOnline?: boolean;
networkType?: NetInfoStateType;
}
/**
* The base/net-info feature's reducer.
*/
ReducerRegistry.register<INetInfoState>(STORE_NAME, (state = DEFAULT_STATE, action): INetInfoState => {
switch (action.type) {
case SET_NETWORK_INFO:
return assign(state, {
isOnline: action.isOnline,
networkType: action.networkType,
cellularGeneration: action.cellularGeneration,
details: action.details
});
case _STORE_NETWORK_INFO_CLEANUP:
return assign(state, {
_cleanup: action.cleanup
});
default:
return state;
}
});