mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-29 16:31:33 +00:00
fix: error modal handling
This commit is contained in:
parent
9f45b368d4
commit
94fca29323
6 changed files with 16120 additions and 43 deletions
16086
package-lock.json
generated
Normal file
16086
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -129,7 +129,7 @@ export class ExpandableModal extends React.PureComponent<ModalProps, State> {
|
||||||
onClick={this.props.onConfirmed}
|
onClick={this.props.onConfirmed}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="link"
|
||||||
label={!this.state.expanded ? this.props.expandButtonLabel : this.props.hideButtonLabel}
|
label={!this.state.expanded ? this.props.expandButtonLabel : this.props.hideButtonLabel}
|
||||||
className="modal__button"
|
className="modal__button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import { selectCurrentModal, selectModalProps, selectModalsAllowed } from 'redux/selectors/app';
|
|
||||||
import {
|
import {
|
||||||
doNotify,
|
doNotify,
|
||||||
selectCostForCurrentPageUri,
|
selectCostForCurrentPageUri,
|
||||||
|
@ -17,8 +16,6 @@ import ModalRouter from './view';
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
balance: selectBalance(state),
|
balance: selectBalance(state),
|
||||||
showPageCost: selectCostForCurrentPageUri(state),
|
showPageCost: selectCostForCurrentPageUri(state),
|
||||||
modal: selectCurrentModal(state),
|
|
||||||
modalProps: selectModalProps(state),
|
|
||||||
page: selectCurrentPage(state),
|
page: selectCurrentPage(state),
|
||||||
isVerificationCandidate: selectUserIsVerificationCandidate(state),
|
isVerificationCandidate: selectUserIsVerificationCandidate(state),
|
||||||
isCreditIntroAcknowledged: makeSelectClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED)(state),
|
isCreditIntroAcknowledged: makeSelectClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED)(state),
|
||||||
|
@ -27,7 +24,6 @@ const select = state => ({
|
||||||
),
|
),
|
||||||
isWelcomeAcknowledged: makeSelectClientSetting(settings.NEW_USER_ACKNOWLEDGED)(state),
|
isWelcomeAcknowledged: makeSelectClientSetting(settings.NEW_USER_ACKNOWLEDGED)(state),
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
modalsAllowed: selectModalsAllowed(state),
|
|
||||||
notification: selectNotification(state),
|
notification: selectNotification(state),
|
||||||
notificationProps: selectNotificationProps(state),
|
notificationProps: selectNotificationProps(state),
|
||||||
});
|
});
|
||||||
|
|
|
@ -107,6 +107,11 @@ class ModalRouter extends React.PureComponent {
|
||||||
if (!notification) {
|
if (!notification) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (notification.error) {
|
||||||
|
return <ModalError {...notification} {...notificationProps} />;
|
||||||
|
}
|
||||||
|
|
||||||
switch (notification.id) {
|
switch (notification.id) {
|
||||||
case modals.UPGRADE:
|
case modals.UPGRADE:
|
||||||
return <ModalUpgrade {...notificationProps} />;
|
return <ModalUpgrade {...notificationProps} />;
|
||||||
|
|
|
@ -3,7 +3,13 @@ import isDev from 'electron-is-dev';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as MODALS from 'constants/modal_types';
|
import * as MODALS from 'constants/modal_types';
|
||||||
import { ipcRenderer, remote } from 'electron';
|
import { ipcRenderer, remote } from 'electron';
|
||||||
import { ACTIONS, Lbry, doBalanceSubscribe, doFetchFileInfosAndPublishedClaims } from 'lbry-redux';
|
import {
|
||||||
|
ACTIONS,
|
||||||
|
Lbry,
|
||||||
|
doBalanceSubscribe,
|
||||||
|
doFetchFileInfosAndPublishedClaims,
|
||||||
|
doNotify,
|
||||||
|
} from 'lbry-redux';
|
||||||
import Native from 'native';
|
import Native from 'native';
|
||||||
import { doFetchRewardedContent } from 'redux/actions/content';
|
import { doFetchRewardedContent } from 'redux/actions/content';
|
||||||
import { doFetchDaemonSettings } from 'redux/actions/settings';
|
import { doFetchDaemonSettings } from 'redux/actions/settings';
|
||||||
|
@ -83,12 +89,9 @@ export function doDownloadUpgrade() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch(doNotify({
|
||||||
type: ACTIONS.CREATE_NOTIFICATION,
|
id: MODALS.DOWNLOADING,
|
||||||
data: {
|
}));
|
||||||
modal: MODALS.DOWNLOADING,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,17 +113,15 @@ 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({
|
dispatch(doNotify({
|
||||||
type: ACTIONS.CREATE_NOTIFICATION,
|
id: MODALS.AUTO_UPDATE_CONFIRM
|
||||||
data: { modal: 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({
|
dispatch(doNotify({
|
||||||
type: ACTIONS.CREATE_NOTIFICATION,
|
id: MODALS.AUTO_UPDATE_DOWNLOADED
|
||||||
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
}));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Old behavior for Linux
|
// Old behavior for Linux
|
||||||
|
@ -135,10 +136,9 @@ export function doAutoUpdate() {
|
||||||
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch({
|
dispatch(doNotify({
|
||||||
type: ACTIONS.CREATE_NOTIFICATION,
|
id: MODALS.AUTO_UPDATE_DOWNLOADED
|
||||||
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
}));
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,12 +206,9 @@ export function doCheckUpgradeAvailable() {
|
||||||
!selectCurrentModal(state) &&
|
!selectCurrentModal(state) &&
|
||||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||||
) {
|
) {
|
||||||
dispatch({
|
dispatch(doNotify({
|
||||||
type: ACTIONS.CREATE_NOTIFICATION,
|
id: MODALS.UPGRADE
|
||||||
data: {
|
}));
|
||||||
modal: MODALS.UPGRADE,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -256,13 +253,12 @@ export function doCheckDaemonVersion() {
|
||||||
|
|
||||||
export function doAlertError(errorList) {
|
export function doAlertError(errorList) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch(
|
||||||
type: ACTIONS.CREATE_NOTIFICATION,
|
doNotify({
|
||||||
data: {
|
id: MODALS.ERROR,
|
||||||
modal: MODALS.ERROR,
|
error: errorList,
|
||||||
modalProps: { error: errorList },
|
})
|
||||||
},
|
);
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@ export const selectUpgradeFilename = createSelector(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectCurrentModal = createSelector(selectState, state => state.modal);
|
|
||||||
|
|
||||||
export const selectDownloadProgress = createSelector(selectState, state => state.downloadProgress);
|
export const selectDownloadProgress = createSelector(selectState, state => state.downloadProgress);
|
||||||
|
|
||||||
export const selectDownloadComplete = createSelector(
|
export const selectDownloadComplete = createSelector(
|
||||||
|
@ -66,10 +64,6 @@ export const selectAutoUpdateDeclined = createSelector(
|
||||||
state => state.autoUpdateDeclined
|
state => state.autoUpdateDeclined
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectModalsAllowed = createSelector(selectState, state => state.modalsAllowed);
|
|
||||||
|
|
||||||
export const selectModalProps = createSelector(selectState, state => state.modalProps);
|
|
||||||
|
|
||||||
export const selectDaemonVersionMatched = createSelector(
|
export const selectDaemonVersionMatched = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.daemonVersionMatched
|
state => state.daemonVersionMatched
|
||||||
|
|
Loading…
Add table
Reference in a new issue