mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-18 03:57:47 +00:00
I'm not saying that the two commits in question were wrong or worse than what I'm offering. Anyway, I think what I'm offering brings: * Compliance with expectations i.e. the middleware doesn't compute the next state from the current state, the reducer does; * Clarity and/or simplicity i.e. there's no global variable (reqIndex), there's no need for the term "index" (a.k.a "reqIndex") in the redux store. * By renaming net-interceptor to network-activity feels like it's preparing the feature to implement a NetworkActivityIndicator React Component which will take on more of the knowledge about the specifics of what is the network activity redux state exactly, is it maintained by interception or some other mechanism, and abstracts it in the feature itself allowing outsiders to merely render a React Component.
75 lines
2.0 KiB
JavaScript
75 lines
2.0 KiB
JavaScript
/* @flow */
|
|
|
|
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import { ActivityIndicator, View } from 'react-native';
|
|
import { connect } from 'react-redux';
|
|
|
|
import AbstractBlankPage from './AbstractBlankPage';
|
|
import styles from './styles';
|
|
|
|
/**
|
|
* Mobile/React Native implementation of <tt>AbstractBlankPage</tt>. Since this
|
|
* is the <tt>Component</tt> rendered when there is no <tt>WelcomePage</tt>,
|
|
* it will show a progress indicator when there are ongoing network requests
|
|
* (notably, the loading of config.js before joining a conference). The use case
|
|
* which prompted the introduction of this <tt>Component</tt> is mobile where
|
|
* SDK users probably disable the <tt>WelcomePage</tt>.
|
|
*/
|
|
class BlankPage extends AbstractBlankPage {
|
|
/**
|
|
* <tt>BlankPage</tt> React <tt>Component</tt>'s prop types.
|
|
*
|
|
* @static
|
|
*/
|
|
static propTypes = {
|
|
...AbstractBlankPage.propTypes,
|
|
|
|
/**
|
|
* Indicates whether there is network activity i.e. ongoing network
|
|
* requests.
|
|
*
|
|
* @private
|
|
*/
|
|
_networkActivity: PropTypes.bool
|
|
};
|
|
|
|
/**
|
|
* Implements React's {@link Component#render()}.
|
|
*
|
|
* @inheritdoc
|
|
* @override
|
|
* @returns {ReactElement}
|
|
*/
|
|
render() {
|
|
return (
|
|
<View style = { styles.blankPage }>
|
|
<ActivityIndicator
|
|
animating = { this.props._networkActivity }
|
|
size = { 'large' } />
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Maps (parts of) the redux state to the React <tt>Component</tt> props of
|
|
* <tt>BlankPage</tt>.
|
|
*
|
|
* @param {Object} state - The redux state.
|
|
* @private
|
|
* @returns {{
|
|
* networkActivity: boolean
|
|
* }}
|
|
*/
|
|
function _mapStateToProps(state) {
|
|
const { requests } = state['features/network-activity'];
|
|
|
|
return {
|
|
_networkActivity:
|
|
Boolean(requests && (requests.length || requests.size))
|
|
};
|
|
}
|
|
|
|
export default connect(_mapStateToProps)(BlankPage);
|