Perform doFetchModBlockedList in splash.
This commit is contained in:
parent
b92fb03856
commit
320e4e6bb7
5 changed files with 58 additions and 59 deletions
|
@ -30,7 +30,7 @@ import {
|
||||||
doSetActiveChannel,
|
doSetActiveChannel,
|
||||||
doSetIncognito,
|
doSetIncognito,
|
||||||
} from 'redux/actions/app';
|
} from 'redux/actions/app';
|
||||||
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
|
import { doFetchCommentModAmIList } from 'redux/actions/comments';
|
||||||
import App from './view';
|
import App from './view';
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
|
@ -67,7 +67,6 @@ const perform = (dispatch) => ({
|
||||||
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
||||||
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
||||||
setIncognito: () => dispatch(doSetIncognito()),
|
setIncognito: () => dispatch(doSetIncognito()),
|
||||||
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
|
|
||||||
resolveUris: (uris) => dispatch(doResolveUris(uris)),
|
resolveUris: (uris) => dispatch(doResolveUris(uris)),
|
||||||
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
|
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,7 +73,6 @@ type Props = {
|
||||||
subscriptions: Array<Subscription>,
|
subscriptions: Array<Subscription>,
|
||||||
setActiveChannelIfNotSet: () => void,
|
setActiveChannelIfNotSet: () => void,
|
||||||
setIncognito: (boolean) => void,
|
setIncognito: (boolean) => void,
|
||||||
fetchModBlockedList: () => void,
|
|
||||||
resolveUris: (Array<string>) => void,
|
resolveUris: (Array<string>) => void,
|
||||||
fetchModAmIList: () => void,
|
fetchModAmIList: () => void,
|
||||||
isUpdateModalDisplayed: boolean,
|
isUpdateModalDisplayed: boolean,
|
||||||
|
@ -108,7 +107,6 @@ function App(props: Props) {
|
||||||
activeChannelId,
|
activeChannelId,
|
||||||
setActiveChannelIfNotSet,
|
setActiveChannelIfNotSet,
|
||||||
setIncognito,
|
setIncognito,
|
||||||
fetchModBlockedList,
|
|
||||||
resolveUris,
|
resolveUris,
|
||||||
subscriptions,
|
subscriptions,
|
||||||
fetchModAmIList,
|
fetchModAmIList,
|
||||||
|
@ -233,7 +231,6 @@ function App(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasMyChannels) {
|
if (hasMyChannels) {
|
||||||
fetchModBlockedList();
|
|
||||||
fetchModAmIList();
|
fetchModAmIList();
|
||||||
}
|
}
|
||||||
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);
|
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as MODALS from 'constants/modal_types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectDaemonVersionMatched, selectModal, selectSplashAnimationEnabled } from 'redux/selectors/app';
|
import { selectDaemonVersionMatched, selectModal, selectSplashAnimationEnabled } from 'redux/selectors/app';
|
||||||
import { doCheckDaemonVersion, doOpenModal, doHideModal, doToggleSplashAnimation } from 'redux/actions/app';
|
import { doCheckDaemonVersion, doOpenModal, doHideModal, doToggleSplashAnimation } from 'redux/actions/app';
|
||||||
|
import { doFetchModBlockedList } from 'redux/actions/comments';
|
||||||
import { doClearDaemonSetting } from 'redux/actions/settings';
|
import { doClearDaemonSetting } from 'redux/actions/settings';
|
||||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||||
import { doToast } from 'redux/actions/notifications';
|
import { doToast } from 'redux/actions/notifications';
|
||||||
|
@ -21,6 +22,7 @@ const perform = (dispatch) => ({
|
||||||
toggleSplashAnimation: () => dispatch(doToggleSplashAnimation()),
|
toggleSplashAnimation: () => dispatch(doToggleSplashAnimation()),
|
||||||
clearWalletServers: () => dispatch(doClearDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS)),
|
clearWalletServers: () => dispatch(doClearDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS)),
|
||||||
doShowSnackBar: (message) => dispatch(doToast({ isError: true, message })),
|
doShowSnackBar: (message) => dispatch(doToast({ isError: true, message })),
|
||||||
|
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(SplashScreen);
|
export default connect(select, perform)(SplashScreen);
|
||||||
|
|
|
@ -31,6 +31,7 @@ type Props = {
|
||||||
toggleSplashAnimation: () => void,
|
toggleSplashAnimation: () => void,
|
||||||
clearWalletServers: () => void,
|
clearWalletServers: () => void,
|
||||||
doShowSnackBar: (string) => void,
|
doShowSnackBar: (string) => void,
|
||||||
|
fetchModBlockedList: () => Promise<any>,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -197,10 +198,14 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
this.setState({ launchWithIncompatibleDaemon: true }, () => this.continueAppLaunch());
|
this.setState({ launchWithIncompatibleDaemon: true }, () => this.continueAppLaunch());
|
||||||
}
|
}
|
||||||
|
|
||||||
continueAppLaunch() {
|
continueAppLaunch = async () => {
|
||||||
const { daemonVersionMatched, onReadyToLaunch } = this.props;
|
const { daemonVersionMatched, onReadyToLaunch } = this.props;
|
||||||
const { isRunning, launchWithIncompatibleDaemon } = this.state;
|
const { isRunning, launchWithIncompatibleDaemon } = this.state;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.props.fetchModBlockedList();
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
if (daemonVersionMatched) {
|
if (daemonVersionMatched) {
|
||||||
onReadyToLaunch();
|
onReadyToLaunch();
|
||||||
} else if (launchWithIncompatibleDaemon && isRunning) {
|
} else if (launchWithIncompatibleDaemon && isRunning) {
|
||||||
|
@ -209,7 +214,7 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
// If it isn't running, this function will be called after the daemon is started
|
// If it isn't running, this function will be called after the daemon is started
|
||||||
onReadyToLaunch();
|
onReadyToLaunch();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
timeout: ?TimeoutID;
|
timeout: ?TimeoutID;
|
||||||
|
|
||||||
|
|
|
@ -1186,11 +1186,7 @@ export function doFetchModBlockedList() {
|
||||||
const moderatorTimeoutMap = {};
|
const moderatorTimeoutMap = {};
|
||||||
|
|
||||||
const blockListsPerChannel = res.map((r) => r.value);
|
const blockListsPerChannel = res.map((r) => r.value);
|
||||||
blockListsPerChannel
|
blockListsPerChannel.forEach((channelBlockLists) => {
|
||||||
.sort((a, b) => {
|
|
||||||
return 1;
|
|
||||||
})
|
|
||||||
.forEach((channelBlockLists) => {
|
|
||||||
const storeList = (fetchedList, blockedList, timeoutMap, blockedByMap) => {
|
const storeList = (fetchedList, blockedList, timeoutMap, blockedByMap) => {
|
||||||
if (fetchedList) {
|
if (fetchedList) {
|
||||||
fetchedList.forEach((blockedChannel) => {
|
fetchedList.forEach((blockedChannel) => {
|
||||||
|
|
Loading…
Reference in a new issue