move to new notificaion logic - UNTESTED
This commit is contained in:
parent
dffff47a9f
commit
eb4995da86
23 changed files with 52 additions and 68 deletions
|
@ -33,7 +33,7 @@ import {
|
||||||
ToastAndroid
|
ToastAndroid
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { doDeleteCompleteBlobs } from '../redux/actions/file';
|
import { doDeleteCompleteBlobs } from '../redux/actions/file';
|
||||||
import { SETTINGS, doHideNotification, doNotify, selectNotification } from 'lbry-redux';
|
import { SETTINGS, doHideNotification, doToast, selectToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doUserEmailVerify,
|
doUserEmailVerify,
|
||||||
doUserEmailVerifyFailure,
|
doUserEmailVerifyFailure,
|
||||||
|
@ -240,15 +240,15 @@ class AppWithNavigationState extends React.Component {
|
||||||
componentWillUpdate(nextProps) {
|
componentWillUpdate(nextProps) {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
const {
|
const {
|
||||||
notification,
|
toast,
|
||||||
emailToVerify,
|
emailToVerify,
|
||||||
emailVerifyPending,
|
emailVerifyPending,
|
||||||
emailVerifyErrorMessage,
|
emailVerifyErrorMessage,
|
||||||
user
|
user
|
||||||
} = nextProps;
|
} = nextProps;
|
||||||
|
|
||||||
if (notification) {
|
if (toast) {
|
||||||
const { displayType, message } = notification;
|
const { message } = toast;
|
||||||
let currentDisplayType;
|
let currentDisplayType;
|
||||||
if (displayType && displayType.length) {
|
if (displayType && displayType.length) {
|
||||||
for (let i = 0; i < displayType.length; i++) {
|
for (let i = 0; i < displayType.length; i++) {
|
||||||
|
@ -287,7 +287,7 @@ class AppWithNavigationState extends React.Component {
|
||||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||||
}
|
}
|
||||||
AsyncStorage.removeItem(Constants.KEY_SHOULD_VERIFY_EMAIL);
|
AsyncStorage.removeItem(Constants.KEY_SHOULD_VERIFY_EMAIL);
|
||||||
dispatch(doNotify({ message, displayType: ['toast'] }));
|
dispatch(doToast({ message }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -340,12 +340,11 @@ class AppWithNavigationState extends React.Component {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = 'Invalid Verification Token';
|
const message = 'Invalid Verification Token';
|
||||||
dispatch(doUserEmailVerifyFailure(message));
|
dispatch(doUserEmailVerifyFailure(message));
|
||||||
dispatch(doNotify({ message, displayType: ['toast'] }));
|
dispatch(doToast({ message }));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dispatch(doNotify({
|
dispatch(doToast({
|
||||||
message: 'Invalid Verification URI',
|
message: 'Invalid Verification URI',
|
||||||
displayType: ['toast'],
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -363,7 +362,7 @@ const mapStateToProps = state => ({
|
||||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||||
nav: state.nav,
|
nav: state.nav,
|
||||||
notification: selectNotification(state),
|
toast: selectToast(state),
|
||||||
emailToVerify: selectEmailToVerify(state),
|
emailToVerify: selectEmailToVerify(state),
|
||||||
emailVerifyPending: selectEmailVerifyIsPending(state),
|
emailVerifyPending: selectEmailVerifyIsPending(state),
|
||||||
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
|
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import Address from './view';
|
import Address from './view';
|
||||||
|
|
||||||
export default connect(null, {
|
export default connect(null, {
|
||||||
doNotify,
|
doToast,
|
||||||
})(Address);
|
})(Address);
|
||||||
|
|
|
@ -6,21 +6,20 @@ import walletStyle from '../../styles/wallet';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
address: string,
|
address: string,
|
||||||
doNotify: ({ message: string, displayType: Array<string> }) => void,
|
doToast: ({ message: string }) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class Address extends React.PureComponent<Props> {
|
export default class Address extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { address, doNotify, style } = this.props;
|
const { address, doToast, style } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[walletStyle.row, style]}>
|
<View style={[walletStyle.row, style]}>
|
||||||
<Text selectable={true} numberOfLines={1} style={walletStyle.address}>{address || ''}</Text>
|
<Text selectable={true} numberOfLines={1} style={walletStyle.address}>{address || ''}</Text>
|
||||||
<Button icon={'clipboard'} style={walletStyle.button} onPress={() => {
|
<Button icon={'clipboard'} style={walletStyle.button} onPress={() => {
|
||||||
Clipboard.setString(address);
|
Clipboard.setString(address);
|
||||||
doNotify({
|
doToast({
|
||||||
message: 'Address copied',
|
message: 'Address copied',
|
||||||
displayType: ['toast'],
|
|
||||||
});
|
});
|
||||||
}} />
|
}} />
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
selectEmailNewIsPending,
|
selectEmailNewIsPending,
|
||||||
selectEmailToVerify
|
selectEmailToVerify
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import EmailRewardSubcard from './view';
|
import EmailRewardSubcard from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -16,7 +16,7 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||||
notify: data => dispatch(doNotify(data))
|
notify: data => dispatch(doToast(data))
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(EmailRewardSubcard);
|
export default connect(select, perform)(EmailRewardSubcard);
|
||||||
|
|
|
@ -38,12 +38,11 @@ class EmailRewardSubcard extends React.PureComponent {
|
||||||
|
|
||||||
if (this.state.verifyStarted && !emailNewPending) {
|
if (this.state.verifyStarted && !emailNewPending) {
|
||||||
if (emailNewErrorMessage) {
|
if (emailNewErrorMessage) {
|
||||||
notify({ message: String(emailNewErrorMessage), displayType: ['toast']});
|
notify({ message: String(emailNewErrorMessage), isError: true });
|
||||||
this.setState({ verifyStarted: false });
|
this.setState({ verifyStarted: false });
|
||||||
} else {
|
} else {
|
||||||
notify({
|
notify({
|
||||||
message: 'Please follow the instructions in the email sent to your address to continue.',
|
message: 'Please follow the instructions in the email sent to your address to continue.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +64,6 @@ class EmailRewardSubcard extends React.PureComponent {
|
||||||
if (!email || email.trim().length === 0 || email.indexOf('@') === -1) {
|
if (!email || email.trim().length === 0 || email.indexOf('@') === -1) {
|
||||||
return notify({
|
return notify({
|
||||||
message: 'Please provide a valid email address to continue.',
|
message: 'Please provide a valid email address to continue.',
|
||||||
displayType: ['toast'],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import Link from './view';
|
import Link from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
notify: (data) => dispatch(doNotify(data))
|
notify: (data) => dispatch(doToast(data))
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, perform)(Link);
|
export default connect(null, perform)(Link);
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default class Link extends React.PureComponent {
|
||||||
Linking.openURL(href)
|
Linking.openURL(href)
|
||||||
.then(() => setTimeout(() => { this.setState({ tappedStyle: false }); }, 2000))
|
.then(() => setTimeout(() => { this.setState({ tappedStyle: false }); }, 2000))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
notify({ message: error, displayType: ['toast']})
|
notify({ message: error, isError: true })
|
||||||
this.setState({tappedStyle: false})
|
this.setState({tappedStyle: false})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doUserPhoneNew,
|
doUserPhoneNew,
|
||||||
doUserPhoneVerify,
|
doUserPhoneVerify,
|
||||||
|
@ -22,7 +22,7 @@ const select = state => ({
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
addUserPhone: (phone, country_code) => dispatch(doUserPhoneNew(phone, country_code)),
|
addUserPhone: (phone, country_code) => dispatch(doUserPhoneNew(phone, country_code)),
|
||||||
verifyPhone: (verificationCode) => dispatch(doUserPhoneVerify(verificationCode)),
|
verifyPhone: (verificationCode) => dispatch(doUserPhoneVerify(verificationCode)),
|
||||||
notify: data => dispatch(doNotify(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(PhoneNumberRewardSubcard);
|
export default connect(select, perform)(PhoneNumberRewardSubcard);
|
||||||
|
|
|
@ -70,17 +70,17 @@ class PhoneNumberRewardSubcard extends React.PureComponent {
|
||||||
|
|
||||||
if (!phoneNewIsPending && (phoneNewIsPending !== prevProps.phoneNewIsPending)) {
|
if (!phoneNewIsPending && (phoneNewIsPending !== prevProps.phoneNewIsPending)) {
|
||||||
if (phoneNewErrorMessage) {
|
if (phoneNewErrorMessage) {
|
||||||
notify({ message: String(phoneNewErrorMessage), displayType: ['toast'] });
|
notify({ message: String(phoneNewErrorMessage) });
|
||||||
} else {
|
} else {
|
||||||
this.setState({ newPhoneAdded: true });
|
this.setState({ newPhoneAdded: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!phoneVerifyIsPending && (phoneVerifyIsPending !== prevProps.phoneVerifyIsPending)) {
|
if (!phoneVerifyIsPending && (phoneVerifyIsPending !== prevProps.phoneVerifyIsPending)) {
|
||||||
if (phoneVerifyErrorMessage) {
|
if (phoneVerifyErrorMessage) {
|
||||||
notify({ message: String(phoneVerifyErrorMessage), displayType: ['toast'] });
|
notify({ message: String(phoneVerifyErrorMessage) });
|
||||||
this.setState({ codeVerifyStarted: false });
|
this.setState({ codeVerifyStarted: false });
|
||||||
} else {
|
} else {
|
||||||
notify({ message: 'Your phone number was successfully verified.', displayType: ['toast'] });
|
notify({ message: 'Your phone number was successfully verified.' });
|
||||||
this.setState({ codeVerifySuccessful: true });
|
this.setState({ codeVerifySuccessful: true });
|
||||||
if (onPhoneVerifySuccessful) {
|
if (onPhoneVerifySuccessful) {
|
||||||
onPhoneVerifySuccessful();
|
onPhoneVerifySuccessful();
|
||||||
|
@ -107,7 +107,6 @@ class PhoneNumberRewardSubcard extends React.PureComponent {
|
||||||
if (!NativeModules.UtilityModule) {
|
if (!NativeModules.UtilityModule) {
|
||||||
return notify({
|
return notify({
|
||||||
message: 'The required permission could not be obtained due to a missing module.',
|
message: 'The required permission could not be obtained due to a missing module.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +119,6 @@ class PhoneNumberRewardSubcard extends React.PureComponent {
|
||||||
if (!this.phoneInput.isValidNumber()) {
|
if (!this.phoneInput.isValidNumber()) {
|
||||||
return notify({
|
return notify({
|
||||||
message: 'Please provide a valid telephone number.',
|
message: 'Please provide a valid telephone number.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doClaimRewardType,
|
doClaimRewardType,
|
||||||
doClaimRewardClearError,
|
doClaimRewardClearError,
|
||||||
|
@ -23,7 +23,7 @@ const makeSelect = () => {
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
claimReward: reward => dispatch(doClaimRewardType(reward.reward_type, true)),
|
claimReward: reward => dispatch(doClaimRewardType(reward.reward_type, true)),
|
||||||
clearError: reward => dispatch(doClaimRewardClearError(reward)),
|
clearError: reward => dispatch(doClaimRewardClearError(reward)),
|
||||||
notify: data => dispatch(doNotify(data))
|
notify: data => dispatch(doToast(data))
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(RewardCard);
|
export default connect(makeSelect, perform)(RewardCard);
|
||||||
|
|
|
@ -30,10 +30,10 @@ class RewardCard extends React.PureComponent<Props> {
|
||||||
const { clearError, notify, reward } = this.props;
|
const { clearError, notify, reward } = this.props;
|
||||||
if (this.state.claimStarted && !isPending) {
|
if (this.state.claimStarted && !isPending) {
|
||||||
if (errorMessage && errorMessage.trim().length > 0) {
|
if (errorMessage && errorMessage.trim().length > 0) {
|
||||||
notify({ message: errorMessage, displayType: ['toast'] });
|
notify({ message: errorMessage });
|
||||||
clearError(reward);
|
clearError(reward);
|
||||||
} else {
|
} else {
|
||||||
notify({ message: 'Reward successfully claimed!', displayType: ['toast'] });
|
notify({ message: 'Reward successfully claimed!' });
|
||||||
}
|
}
|
||||||
this.setState({ claimStarted: false });
|
this.setState({ claimStarted: false });
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class RewardCard extends React.PureComponent<Props> {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!canClaim) {
|
if (!canClaim) {
|
||||||
notify({ message: 'Unfortunately, you are not eligible to claim this reward at this time.', displayType: ['toast'] });
|
notify({ message: 'Unfortunately, you are not eligible to claim this reward at this time.' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc';
|
import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc';
|
||||||
import RewardSummary from './view';
|
import RewardSummary from './view';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
fetchRewards: () => dispatch(doRewardList()),
|
fetchRewards: () => dispatch(doRewardList()),
|
||||||
notify: data => dispatch(doNotify(data))
|
notify: data => dispatch(doToast(data))
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(RewardSummary);
|
export default connect(select, perform)(RewardSummary);
|
||||||
|
|
|
@ -38,7 +38,6 @@ class RewardSummary extends React.Component {
|
||||||
this.setState({ dismissed: true });
|
this.setState({ dismissed: true });
|
||||||
this.props.notify({
|
this.props.notify({
|
||||||
message: 'You can always claim your rewards from the Rewards page.',
|
message: 'You can always claim your rewards from the Rewards page.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
doNotify,
|
doToast,
|
||||||
doSendDraftTransaction,
|
doSendDraftTransaction,
|
||||||
selectDraftTransaction,
|
selectDraftTransaction,
|
||||||
selectDraftTransactionError,
|
selectDraftTransactionError,
|
||||||
|
@ -10,7 +10,7 @@ import WalletSend from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
|
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
|
||||||
notify: (data) => dispatch(doNotify(data))
|
notify: (data) => dispatch(doToast(data))
|
||||||
});
|
});
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
|
|
@ -38,7 +38,6 @@ class WalletSend extends React.PureComponent<Props> {
|
||||||
if (address && !regexAddress.test(address)) {
|
if (address && !regexAddress.test(address)) {
|
||||||
notify({
|
notify({
|
||||||
message: 'The recipient address is not a valid LBRY address.',
|
message: 'The recipient address is not a valid LBRY address.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,6 @@ class WalletSend extends React.PureComponent<Props> {
|
||||||
if (amount > balance) {
|
if (amount > balance) {
|
||||||
notify({
|
notify({
|
||||||
message: 'Insufficient credits',
|
message: 'Insufficient credits',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +60,6 @@ class WalletSend extends React.PureComponent<Props> {
|
||||||
const { notify } = this.props;
|
const { notify } = this.props;
|
||||||
notify({
|
notify({
|
||||||
message: 'The recipient address is not a valid LBRY address.',
|
message: 'The recipient address is not a valid LBRY address.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
doFetchFileInfo,
|
doFetchFileInfo,
|
||||||
doFetchCostInfoForUri,
|
doFetchCostInfoForUri,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
doNotify,
|
doToast,
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
makeSelectCostInfoForUri,
|
makeSelectCostInfoForUri,
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
|
@ -38,7 +38,7 @@ const perform = dispatch => ({
|
||||||
},
|
},
|
||||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||||
notify: data => dispatch(doNotify(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -189,7 +189,6 @@ class FilePage extends React.PureComponent {
|
||||||
// after the file_set_status and file_delete operations, so let the user know
|
// after the file_set_status and file_delete operations, so let the user know
|
||||||
notify({
|
notify({
|
||||||
message: 'The download will stop momentarily. You do not need to wait to discover something else.',
|
message: 'The download will stop momentarily. You do not need to wait to discover something else.',
|
||||||
displayType: ['toast']
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doGenerateAuthToken,
|
doGenerateAuthToken,
|
||||||
doUserEmailNew,
|
doUserEmailNew,
|
||||||
|
@ -22,7 +22,7 @@ const select = (state) => ({
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||||
generateAuthToken: installationId => dispatch(doGenerateAuthToken(installationId)),
|
generateAuthToken: installationId => dispatch(doGenerateAuthToken(installationId)),
|
||||||
notify: data => dispatch(doNotify(data))
|
notify: data => dispatch(doToast(data))
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(FirstRun);
|
export default connect(select, perform)(FirstRun);
|
||||||
|
|
|
@ -61,7 +61,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||||
if (this.state.emailSubmitted && !emailNewPending) {
|
if (this.state.emailSubmitted && !emailNewPending) {
|
||||||
this.setState({ emailSubmitted: false });
|
this.setState({ emailSubmitted: false });
|
||||||
if (emailNewErrorMessage) {
|
if (emailNewErrorMessage) {
|
||||||
notify ({ message: String(emailNewErrorMessage), displayType: ['toast']});
|
notify ({ message: String(emailNewErrorMessage), isError: true });
|
||||||
} else {
|
} else {
|
||||||
// Request successful. Navigate to discover.
|
// Request successful. Navigate to discover.
|
||||||
this.closeFinalPage();
|
this.closeFinalPage();
|
||||||
|
@ -115,7 +115,6 @@ class FirstRunScreen extends React.PureComponent {
|
||||||
if (email.indexOf('@') === -1) {
|
if (email.indexOf('@') === -1) {
|
||||||
return notify({
|
return notify({
|
||||||
message: 'Please provide a valid email address to continue.',
|
message: 'Please provide a valid email address to continue.',
|
||||||
displayType: ['toast'],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
selectClaimedRewards,
|
selectClaimedRewards,
|
||||||
selectUser,
|
selectUser,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import RewardsPage from './view';
|
import RewardsPage from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -22,7 +22,7 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
fetchRewards: () => dispatch(doRewardList()),
|
fetchRewards: () => dispatch(doRewardList()),
|
||||||
notify: data => dispatch(doNotify(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(RewardsPage);
|
export default connect(select, perform)(RewardsPage);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doBalanceSubscribe, doBlackListedOutpointsSubscribe, doNotify } from 'lbry-redux';
|
import { doBalanceSubscribe, doBlackListedOutpointsSubscribe, doToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doAuthenticate,
|
doAuthenticate,
|
||||||
doFetchRewardedContent,
|
doFetchRewardedContent,
|
||||||
|
@ -23,7 +23,7 @@ const perform = dispatch => ({
|
||||||
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
||||||
deleteCompleteBlobs: () => dispatch(doDeleteCompleteBlobs()),
|
deleteCompleteBlobs: () => dispatch(doDeleteCompleteBlobs()),
|
||||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||||
notify: data => dispatch(doNotify(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||||
verifyUserEmail: (token, recaptcha) => dispatch(doUserEmailVerify(token, recaptcha)),
|
verifyUserEmail: (token, recaptcha) => dispatch(doUserEmailVerify(token, recaptcha)),
|
||||||
verifyUserEmailFailure: error => dispatch(doUserEmailVerifyFailure(error)),
|
verifyUserEmailFailure: error => dispatch(doUserEmailVerifyFailure(error)),
|
||||||
|
|
|
@ -102,12 +102,11 @@ class SplashScreen extends React.PureComponent {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = 'Invalid Verification Token';
|
const message = 'Invalid Verification Token';
|
||||||
verifyUserEmailFailure(message);
|
verifyUserEmailFailure(message);
|
||||||
notify({ message, displayType: ['toast'] });
|
notify({ message });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notify({
|
notify({
|
||||||
message: 'Invalid Verification URI',
|
message: 'Invalid Verification URI',
|
||||||
displayType: ['toast'],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
ACTIONS,
|
ACTIONS,
|
||||||
Lbry,
|
Lbry,
|
||||||
doNotify,
|
doToast,
|
||||||
formatCredits,
|
formatCredits,
|
||||||
selectBalance,
|
selectBalance,
|
||||||
makeSelectCostInfoForUri,
|
makeSelectCostInfoForUri,
|
||||||
|
@ -188,9 +188,8 @@ export function doLoadVideo(uri, failureCallback) {
|
||||||
data: { uri },
|
data: { uri },
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(doNotify({
|
dispatch(doToast({
|
||||||
message: `File timeout for uri ${uri}`,
|
message: `File timeout for uri ${uri}`,
|
||||||
displayType: ['toast']
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (failureCallback) {
|
if (failureCallback) {
|
||||||
|
@ -207,9 +206,8 @@ export function doLoadVideo(uri, failureCallback) {
|
||||||
data: { uri },
|
data: { uri },
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(doNotify({
|
dispatch(doToast({
|
||||||
message: `Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`,
|
message: `Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`,
|
||||||
displayType: ['toast']
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (failureCallback) {
|
if (failureCallback) {
|
||||||
|
@ -268,9 +266,8 @@ export function doPurchaseUri(uri, specificCostInfo, failureCallback) {
|
||||||
|
|
||||||
if (cost > balance) {
|
if (cost > balance) {
|
||||||
dispatch(doSetPlayingUri(null));
|
dispatch(doSetPlayingUri(null));
|
||||||
dispatch(doNotify({
|
dispatch(doToast({
|
||||||
message: 'Insufficient credits',
|
message: 'Insufficient credits',
|
||||||
displayType: ['toast']
|
|
||||||
}));
|
}));
|
||||||
if (failureCallback) {
|
if (failureCallback) {
|
||||||
failureCallback();
|
failureCallback();
|
||||||
|
|
Loading…
Reference in a new issue