diff --git a/app/src/page/file/view.js b/app/src/page/file/view.js index 4df31452..d5ee3487 100644 --- a/app/src/page/file/view.js +++ b/app/src/page/file/view.js @@ -14,8 +14,9 @@ import { } from 'react-native'; import Colors from '../../styles/colors'; import ChannelPage from '../channel'; -import FileItemMedia from '../../component/fileItemMedia'; import FileDownloadButton from '../../component/fileDownloadButton'; +import FileItemMedia from '../../component/fileItemMedia'; +import FilePrice from '../../component/filePrice'; import MediaPlayer from '../../component/mediaPlayer'; import UriBar from '../../component/uriBar'; import Video from 'react-native-video'; @@ -182,6 +183,7 @@ class FilePage extends React.PureComponent { } {isPlayable && !this.state.mediaLoaded && } {!completed && !canLoadMedia && } + {!fileInfo && } {canLoadMedia && } {canLoadMedia && 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) { - //dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri })); - console.log('Affirm purchase...'); + // display alert + const formattedCost = formatCredits(cost, 2); + const unit = cost === 1 ? 'credit' : 'credits'; + Alert.alert('Confirm purchase', + `This will purchase "${title}" for ${formattedCost} ${unit}`, + [ + { text: 'OK', onPress: () => dispatch(doLoadVideo(uri)) }, + { text: 'Cancel', style: 'cancel' } + ], + { cancelable: true }); } else { dispatch(doLoadVideo(uri)); } @@ -231,15 +244,18 @@ export function doPurchaseUri(uri, specificCostInfo) { if (cost > balance) { dispatch(doSetPlayingUri(null)); - //dispatch(doOpenModal(MODALS.INSUFFICIENT_CREDITS)); + dispatch(doNotify({ + message: 'Insufficient credits', + displayType: ['toast'] + })); Promise.resolve(); return; } - if (cost === 0/* || !makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state)*/) { + attemptPlay(cost); + /*if (cost === 0 || !makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state)) { attemptPlay(cost); - } - /*} else { + } else { const instantPurchaseMax = makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state); if (instantPurchaseMax.currency === 'LBC') { attemptPlay(cost, instantPurchaseMax.amount); diff --git a/app/src/styles/filePage.js b/app/src/styles/filePage.js index aa9c1aaa..9ae2c197 100644 --- a/app/src/styles/filePage.js +++ b/app/src/styles/filePage.js @@ -100,6 +100,22 @@ const filePageStyle = StyleSheet.create({ right: 0, bottom: 0 }, + filePriceContainer: { + backgroundColor: '#61fcd8', + justifyContent: 'center', + position: 'absolute', + right: 16, + top: 16, + width: 56, + height: 24, + borderRadius: 4 + }, + filePriceText: { + fontFamily: 'Metropolis-Bold', + fontSize: 12, + textAlign: 'center', + color: '#0c604b' + }, actions: { paddingLeft: 16, paddingRight: 16,