fix: instant purchase on 0.1 or less LBC fee

fixes: https://github.com/lbryio/lbry-desktop/issues/2797
This commit is contained in:
Thomas Zarebczan 2019-08-28 22:07:41 -04:00 committed by Sean Yesmunt
parent cfdfad4234
commit ec12b1bb69

View file

@ -210,9 +210,9 @@ export function doPlayUri(uri: string, skipCostCheck: boolean = false, saveFileO
dispatch(doPurchaseUriWrapper(uri, cost, saveFile));
}
function attemptPlay(instantPurchaseMax = null) {
function attemptPlay(instantPurchaseEnabled = false, instantPurchaseMax = null) {
// If you have a file_list entry, you have already purchased the file
if (!fileInfo && (!instantPurchaseMax || cost > instantPurchaseMax)) {
if (!fileInfo && (!instantPurchaseMax || !instantPurchaseEnabled || cost > instantPurchaseMax)) {
dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
} else {
beginGetFile();
@ -230,7 +230,7 @@ export function doPlayUri(uri: string, skipCostCheck: boolean = false, saveFileO
}
if (instantPurchaseEnabled || instantPurchaseMax.currency === 'LBC') {
attemptPlay(instantPurchaseMax.amount);
attemptPlay(instantPurchaseEnabled, instantPurchaseMax.amount);
} else {
// Need to convert currency of instant purchase maximum before trying to play
Lbryapi.getExchangeRates().then(({ LBC_USD }) => {