remove: selectCurrentModal

This commit is contained in:
Sean Yesmunt 2018-04-23 14:02:06 -04:00
parent 60c2308511
commit c684f56dd8
5 changed files with 43 additions and 27 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
/static/daemon/lbrynet*
/static/locales
yarn-error.log
/build/daemon*

View file

@ -1,10 +1,11 @@
import { connect } from 'react-redux';
import { selectCurrentModal, selectDaemonVersionMatched } from 'redux/selectors/app';
import { selectDaemonVersionMatched } from 'redux/selectors/app';
import { selectNotification } from 'lbry-redux';
import { doCheckDaemonVersion } from 'redux/actions/app';
import SplashScreen from './view';
const select = state => ({
modal: selectCurrentModal(state),
notification: selectNotification(state),
daemonVersionMatched: selectDaemonVersionMatched(state),
});

View file

@ -8,7 +8,9 @@ import * as modals from 'constants/modal_types';
type Props = {
checkDaemonVersion: () => Promise<any>,
modal: string,
notification: ?{
id: string,
},
};
type State = {
@ -100,9 +102,11 @@ export class SplashScreen extends React.PureComponent<Props, State> {
}
render() {
const { modal } = this.props;
const { notification } = this.props;
const { message, details, isLagging, isRunning } = this.state;
const notificationId = notification && notification.id;
return (
<React.Fragment>
<LoadScreen message={message} details={details} isWarning={isLagging} />
@ -111,9 +115,9 @@ export class SplashScreen extends React.PureComponent<Props, State> {
in the modals won't work. */}
{isRunning && (
<React.Fragment>
{modal === modals.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
{modal === modals.UPGRADE && <ModalUpgrade />}
{modal === modals.DOWNLOADING && <ModalDownloading />}
{notificationId === modals.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
{notificationId === modals.UPGRADE && <ModalUpgrade />}
{notificationId === modals.DOWNLOADING && <ModalDownloading />}
</React.Fragment>
)}
</React.Fragment>

View file

@ -8,7 +8,6 @@ import {
selectIdentityVerifyErrorMessage,
} from 'redux/selectors/user';
import UserVerify from './view';
import { selectCurrentModal } from 'redux/selectors/app';
import { doNotify } from 'lbry-redux';
import { PHONE_COLLECTION } from 'constants/modal_types';
@ -19,7 +18,6 @@ const select = (state, props) => {
isPending: selectIdentityVerifyIsPending(state),
errorMessage: selectIdentityVerifyErrorMessage(state),
reward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
modal: selectCurrentModal(state),
};
};

View file

@ -9,6 +9,7 @@ import {
doBalanceSubscribe,
doFetchFileInfosAndPublishedClaims,
doNotify,
selectNotification,
} from 'lbry-redux';
import Native from 'native';
import { doFetchRewardedContent } from 'redux/actions/content';
@ -18,7 +19,6 @@ import { doAuthenticate } from 'redux/actions/user';
import { doPause } from 'redux/actions/media';
import { doCheckSubscriptions } from 'redux/actions/subscriptions';
import {
selectCurrentModal,
selectIsUpgradeSkipped,
selectUpdateUrl,
selectUpgradeDownloadItem,
@ -89,9 +89,11 @@ export function doDownloadUpgrade() {
dispatch({
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
});
dispatch(doNotify({
id: MODALS.DOWNLOADING,
}));
dispatch(
doNotify({
id: MODALS.DOWNLOADING,
})
);
};
}
@ -113,15 +115,19 @@ export function doDownloadUpgradeRequested() {
// electron-updater behavior
if (autoUpdateDeclined) {
// The user declined an update before, so show the "confirm" dialog
dispatch(doNotify({
id: MODALS.AUTO_UPDATE_CONFIRM
}));
dispatch(
doNotify({
id: MODALS.AUTO_UPDATE_CONFIRM,
})
);
} else {
// The user was never shown the original update dialog (e.g. because they were
// watching a video). So show the inital "update downloaded" dialog.
dispatch(doNotify({
id: MODALS.AUTO_UPDATE_DOWNLOADED
}));
dispatch(
doNotify({
id: MODALS.AUTO_UPDATE_DOWNLOADED,
})
);
}
} else {
// Old behavior for Linux
@ -136,9 +142,11 @@ export function doAutoUpdate() {
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
});
dispatch(doNotify({
id: MODALS.AUTO_UPDATE_DOWNLOADED
}));
dispatch(
doNotify({
id: MODALS.AUTO_UPDATE_DOWNLOADED,
})
);
};
}
@ -203,12 +211,14 @@ export function doCheckUpgradeAvailable() {
if (
upgradeAvailable &&
!selectCurrentModal(state) &&
!selectNotification(state) &&
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
) {
dispatch(doNotify({
id: MODALS.UPGRADE
}));
dispatch(
doNotify({
id: MODALS.UPGRADE,
})
);
}
};
@ -324,7 +334,9 @@ export function doChangeVolume(volume) {
export function doConditionalAuthNavigate(newSession) {
return (dispatch, getState) => {
const state = getState();
if (newSession || selectCurrentModal(state) !== 'email_collection') {
const notification = selectNotification(state);
if (newSession || (notification && notification.id !== 'email_collection')) {
dispatch(doAuthNavigate());
}
};