mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
remove: selectCurrentModal
This commit is contained in:
parent
60c2308511
commit
c684f56dd8
5 changed files with 43 additions and 27 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
/static/daemon/lbrynet*
|
/static/daemon/lbrynet*
|
||||||
/static/locales
|
/static/locales
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
/build/daemon*
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
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 { doCheckDaemonVersion } from 'redux/actions/app';
|
||||||
import SplashScreen from './view';
|
import SplashScreen from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
modal: selectCurrentModal(state),
|
notification: selectNotification(state),
|
||||||
daemonVersionMatched: selectDaemonVersionMatched(state),
|
daemonVersionMatched: selectDaemonVersionMatched(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@ import * as modals from 'constants/modal_types';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
checkDaemonVersion: () => Promise<any>,
|
checkDaemonVersion: () => Promise<any>,
|
||||||
modal: string,
|
notification: ?{
|
||||||
|
id: string,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -100,9 +102,11 @@ export class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { modal } = this.props;
|
const { notification } = this.props;
|
||||||
const { message, details, isLagging, isRunning } = this.state;
|
const { message, details, isLagging, isRunning } = this.state;
|
||||||
|
|
||||||
|
const notificationId = notification && notification.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<LoadScreen message={message} details={details} isWarning={isLagging} />
|
<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. */}
|
in the modals won't work. */}
|
||||||
{isRunning && (
|
{isRunning && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{modal === modals.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
|
{notificationId === modals.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
|
||||||
{modal === modals.UPGRADE && <ModalUpgrade />}
|
{notificationId === modals.UPGRADE && <ModalUpgrade />}
|
||||||
{modal === modals.DOWNLOADING && <ModalDownloading />}
|
{notificationId === modals.DOWNLOADING && <ModalDownloading />}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
selectIdentityVerifyErrorMessage,
|
selectIdentityVerifyErrorMessage,
|
||||||
} from 'redux/selectors/user';
|
} from 'redux/selectors/user';
|
||||||
import UserVerify from './view';
|
import UserVerify from './view';
|
||||||
import { selectCurrentModal } from 'redux/selectors/app';
|
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doNotify } from 'lbry-redux';
|
||||||
import { PHONE_COLLECTION } from 'constants/modal_types';
|
import { PHONE_COLLECTION } from 'constants/modal_types';
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ const select = (state, props) => {
|
||||||
isPending: selectIdentityVerifyIsPending(state),
|
isPending: selectIdentityVerifyIsPending(state),
|
||||||
errorMessage: selectIdentityVerifyErrorMessage(state),
|
errorMessage: selectIdentityVerifyErrorMessage(state),
|
||||||
reward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
|
reward: selectReward(state, { reward_type: rewards.TYPE_NEW_USER }),
|
||||||
modal: selectCurrentModal(state),
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
doBalanceSubscribe,
|
doBalanceSubscribe,
|
||||||
doFetchFileInfosAndPublishedClaims,
|
doFetchFileInfosAndPublishedClaims,
|
||||||
doNotify,
|
doNotify,
|
||||||
|
selectNotification,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import Native from 'native';
|
import Native from 'native';
|
||||||
import { doFetchRewardedContent } from 'redux/actions/content';
|
import { doFetchRewardedContent } from 'redux/actions/content';
|
||||||
|
@ -18,7 +19,6 @@ import { doAuthenticate } from 'redux/actions/user';
|
||||||
import { doPause } from 'redux/actions/media';
|
import { doPause } from 'redux/actions/media';
|
||||||
import { doCheckSubscriptions } from 'redux/actions/subscriptions';
|
import { doCheckSubscriptions } from 'redux/actions/subscriptions';
|
||||||
import {
|
import {
|
||||||
selectCurrentModal,
|
|
||||||
selectIsUpgradeSkipped,
|
selectIsUpgradeSkipped,
|
||||||
selectUpdateUrl,
|
selectUpdateUrl,
|
||||||
selectUpgradeDownloadItem,
|
selectUpgradeDownloadItem,
|
||||||
|
@ -89,9 +89,11 @@ export function doDownloadUpgrade() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||||
});
|
});
|
||||||
dispatch(doNotify({
|
dispatch(
|
||||||
id: MODALS.DOWNLOADING,
|
doNotify({
|
||||||
}));
|
id: MODALS.DOWNLOADING,
|
||||||
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,15 +115,19 @@ export function doDownloadUpgradeRequested() {
|
||||||
// electron-updater behavior
|
// electron-updater behavior
|
||||||
if (autoUpdateDeclined) {
|
if (autoUpdateDeclined) {
|
||||||
// The user declined an update before, so show the "confirm" dialog
|
// The user declined an update before, so show the "confirm" dialog
|
||||||
dispatch(doNotify({
|
dispatch(
|
||||||
id: MODALS.AUTO_UPDATE_CONFIRM
|
doNotify({
|
||||||
}));
|
id: MODALS.AUTO_UPDATE_CONFIRM,
|
||||||
|
})
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// The user was never shown the original update dialog (e.g. because they were
|
// The user was never shown the original update dialog (e.g. because they were
|
||||||
// watching a video). So show the inital "update downloaded" dialog.
|
// watching a video). So show the inital "update downloaded" dialog.
|
||||||
dispatch(doNotify({
|
dispatch(
|
||||||
id: MODALS.AUTO_UPDATE_DOWNLOADED
|
doNotify({
|
||||||
}));
|
id: MODALS.AUTO_UPDATE_DOWNLOADED,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Old behavior for Linux
|
// Old behavior for Linux
|
||||||
|
@ -136,9 +142,11 @@ export function doAutoUpdate() {
|
||||||
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(doNotify({
|
dispatch(
|
||||||
id: MODALS.AUTO_UPDATE_DOWNLOADED
|
doNotify({
|
||||||
}));
|
id: MODALS.AUTO_UPDATE_DOWNLOADED,
|
||||||
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,12 +211,14 @@ export function doCheckUpgradeAvailable() {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
upgradeAvailable &&
|
upgradeAvailable &&
|
||||||
!selectCurrentModal(state) &&
|
!selectNotification(state) &&
|
||||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||||
) {
|
) {
|
||||||
dispatch(doNotify({
|
dispatch(
|
||||||
id: MODALS.UPGRADE
|
doNotify({
|
||||||
}));
|
id: MODALS.UPGRADE,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -324,7 +334,9 @@ export function doChangeVolume(volume) {
|
||||||
export function doConditionalAuthNavigate(newSession) {
|
export function doConditionalAuthNavigate(newSession) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
if (newSession || selectCurrentModal(state) !== 'email_collection') {
|
const notification = selectNotification(state);
|
||||||
|
|
||||||
|
if (newSession || (notification && notification.id !== 'email_collection')) {
|
||||||
dispatch(doAuthNavigate());
|
dispatch(doAuthNavigate());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue