snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
41
react/features/base/net-info/reducer.ts
Normal file
41
react/features/base/net-info/reducer.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
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';
|
||||
import { NetworkInfo } from './types';
|
||||
|
||||
const DEFAULT_STATE = {
|
||||
isOnline: true
|
||||
};
|
||||
|
||||
export interface INetInfoState {
|
||||
_cleanup?: Function;
|
||||
cellularGeneration?: NetInfoCellularGeneration;
|
||||
details?: NetworkInfo['details'];
|
||||
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;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user