Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function attemptPlay(instantPurchaseMax = null) {
// If you have a file_list entry, you have already purchased the file
if (!fileInfo && (!instantPurchaseMax || !instantPurchaseEnabled || cost > instantPurchaseMax)) {
dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
} else {
beginGetFile();
}
}
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
prepareEdit: (publishData, uri, fileInfo) => dispatch(doPrepareEdit(publishData, uri, fileInfo, fs)),
verifyPhone: () => dispatch(doOpenModal(MODALS.PHONE_COLLECTION)),
fetchUser: () => dispatch(doUserFetch()),
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
});
openModal: id => dispatch(doOpenModal(id)),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
return (dispatch, getState) => {
const state = getState();
const balance = selectBalance(state);
if (balance - amount <= 0) {
dispatch(doOpenModal(MODALS.INSUFFICIENT_CREDITS));
return;
}
dispatch({
type: ACTIONS.SEND_TRANSACTION_STARTED,
});
const successCallback = results => {
if (results === true) {
dispatch({
type: ACTIONS.SEND_TRANSACTION_COMPLETED,
});
dispatch(
doShowSnackBar({
message: __(`You sent ${amount} LBC`),
linkText: __('History'),
openModal: props => dispatch(doOpenModal(props)),
hideModal: props => dispatch(doHideModal(props)),
openMobileNavigation: () => dispatch(doOpenModal(MODALS.MOBILE_NAVIGATION)),
});
notifyUnlockWallet: shouldTryWithBlankPassword =>
dispatch(doOpenModal(MODALS.WALLET_UNLOCK, { shouldTryWithBlankPassword })),
hideModal: () => dispatch(doHideModal()),
rewards.setCallback('rewardApprovalRequired', () => {
app.store.dispatch(doOpenModal(MODALS.REWARD_APPROVAL_REQUIRED));
});