Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0115025b86 | ||
|
|
34fa24ffd0 | ||
|
|
9e8ba95fec | ||
|
|
d63253cc30 | ||
|
|
6ce143b145 | ||
|
|
c7ce7ea284 | ||
|
|
076122def4 | ||
|
|
625559528d |
No files matched your search
@@ -13,6 +13,7 @@ type Props = {
|
||||
id: string,
|
||||
reward_title: string,
|
||||
reward_amount: number,
|
||||
reward_range?: string,
|
||||
transaction_id: string,
|
||||
created_at: string,
|
||||
reward_description: string,
|
||||
@@ -55,6 +56,20 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
});
|
||||
};
|
||||
|
||||
getDisplayAmount = () => {
|
||||
const { reward } = this.props;
|
||||
if (reward) {
|
||||
if (reward.reward_range && reward.reward_range.includes('-')) {
|
||||
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
||||
} else if (reward.reward_amount > 0) {
|
||||
return reward.reward_amount;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown amount which normally shouldn't happen
|
||||
return '?';
|
||||
};
|
||||
|
||||
render() {
|
||||
const { canClaim, isPending, onClaimPress, reward } = this.props;
|
||||
const claimed = !!reward.transaction_id;
|
||||
@@ -101,7 +116,7 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
)}
|
||||
</View>
|
||||
<View style={rewardStyle.rightCol}>
|
||||
<Text style={rewardStyle.rewardAmount}>{reward.reward_amount}</Text>
|
||||
<Text style={rewardStyle.rewardAmount}>{this.getDisplayAmount()}</Text>
|
||||
<Text style={rewardStyle.rewardCurrency}>LBC</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
selectPurchaseUriErrorMessage,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
doClaimEligiblePurchaseRewards,
|
||||
doFetchCostInfoForUri,
|
||||
makeSelectCostInfoForUri,
|
||||
selectRewardContentClaimIds,
|
||||
@@ -72,6 +73,7 @@ const select = (state, props) => {
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||
},
|
||||
|
||||
@@ -478,6 +478,7 @@ class FilePage extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const { claimEligibleRewards } = this.props;
|
||||
const { nout, claim_id: claimId, txid } = claim;
|
||||
const outpoint = `${txid}:${nout}`;
|
||||
const params = {
|
||||
@@ -489,7 +490,9 @@ class FilePage extends React.PureComponent {
|
||||
params.time_to_start = timeToStart;
|
||||
}
|
||||
|
||||
Lbryio.call('file', 'view', params).catch(() => {});
|
||||
Lbryio.call('file', 'view', params)
|
||||
.then(() => claimEligibleRewards())
|
||||
.catch(() => {});
|
||||
this.setState({ fileViewLogged: true });
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ class PublishPage extends React.PureComponent {
|
||||
state = {
|
||||
canPublish: false,
|
||||
canUseCamera: false,
|
||||
documentPickerOpen: false,
|
||||
editMode: false,
|
||||
titleFocused: false,
|
||||
descriptionFocused: false,
|
||||
@@ -120,6 +121,7 @@ class PublishPage extends React.PureComponent {
|
||||
otherLicenseDescription: '',
|
||||
name: null,
|
||||
price: 0,
|
||||
currency: 'LBC',
|
||||
uri: null,
|
||||
tags: [],
|
||||
selectedChannel: null,
|
||||
@@ -137,6 +139,8 @@ class PublishPage extends React.PureComponent {
|
||||
// this.didFocusListener = navigation.addListener('didFocus', this.onComponentFocused);
|
||||
DeviceEventEmitter.addListener('onGalleryThumbnailChecked', this.handleGalleryThumbnailChecked);
|
||||
DeviceEventEmitter.addListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@@ -145,6 +149,8 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
DeviceEventEmitter.removeListener('onGalleryThumbnailChecked', this.handleGalleryThumbnailChecked);
|
||||
DeviceEventEmitter.removeListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked);
|
||||
DeviceEventEmitter.removeListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.removeListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
}
|
||||
|
||||
handleGalleryThumbnailChecked = evt => {
|
||||
@@ -236,6 +242,7 @@ class PublishPage extends React.PureComponent {
|
||||
licenseUrl,
|
||||
otherLicenseDescription,
|
||||
name,
|
||||
currency: fee && fee.currency ? fee.currency : 'LBC',
|
||||
price: fee && fee.amount ? fee.amount : 0,
|
||||
priceSet: fee && fee.amount > 0,
|
||||
tags: tags && tags.length > 0 ? tags : [],
|
||||
@@ -291,6 +298,7 @@ class PublishPage extends React.PureComponent {
|
||||
bid,
|
||||
channelName,
|
||||
currentMedia,
|
||||
currency,
|
||||
description,
|
||||
language,
|
||||
license,
|
||||
@@ -334,7 +342,7 @@ class PublishPage extends React.PureComponent {
|
||||
otherLicenseDescription,
|
||||
name: name || undefined,
|
||||
contentIsFree: !priceSet,
|
||||
fee: { currency: 'LBC', amount: price },
|
||||
fee: { currency, amount: price },
|
||||
uri: uri || undefined,
|
||||
channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName,
|
||||
isStillEditing: false,
|
||||
@@ -406,6 +414,7 @@ class PublishPage extends React.PureComponent {
|
||||
this.setState(
|
||||
{
|
||||
publishStarted: false,
|
||||
documentPickerOpen: false,
|
||||
editMode: false,
|
||||
|
||||
currentMedia: null,
|
||||
@@ -457,6 +466,36 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
handleUploadPressed = () => {
|
||||
if (this.state.documentPickerOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
documentPickerOpen: true,
|
||||
},
|
||||
() => {
|
||||
NativeModules.UtilityModule.openDocumentPicker('*/*');
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
onFilePicked = evt => {
|
||||
this.setState({ documentPickerOpen: false }, () => {
|
||||
const currentMedia = {
|
||||
id: -1,
|
||||
filePath: `file://${evt.path}`,
|
||||
duration: 0,
|
||||
};
|
||||
this.setCurrentMedia(currentMedia);
|
||||
});
|
||||
};
|
||||
|
||||
onPickerCanceled = () => {
|
||||
this.setState({ documentPickerOpen: false });
|
||||
};
|
||||
|
||||
handleCloseCameraPressed = () => {
|
||||
this.setState({ showCameraOverlay: false, videoRecordingMode: false });
|
||||
};
|
||||
@@ -655,6 +694,10 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
handleCurrencyValueChange = currency => {
|
||||
this.setState({ currency });
|
||||
};
|
||||
|
||||
handleDescriptionChange = description => {
|
||||
this.setState({ description });
|
||||
};
|
||||
@@ -727,12 +770,10 @@ class PublishPage extends React.PureComponent {
|
||||
<Icon name="camera" size={48} color={Colors.White} />
|
||||
<Text style={publishStyle.actionText}>Take a photo</Text>
|
||||
</TouchableOpacity>
|
||||
{false && (
|
||||
<TouchableOpacity style={publishStyle.upload} onPress={this.handleUploadPressed}>
|
||||
<Icon name="file-upload" size={48} color={Colors.White} />
|
||||
<Text style={publishStyle.actionText}>Upload a file</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
<TouchableOpacity style={publishStyle.upload} onPress={this.handleUploadPressed}>
|
||||
<Icon name="file-upload" size={48} color={Colors.White} />
|
||||
<Text style={publishStyle.actionText}>Upload a file</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
@@ -889,7 +930,16 @@ class PublishPage extends React.PureComponent {
|
||||
value={String(this.state.price)}
|
||||
onChangeText={this.handlePriceChange}
|
||||
/>
|
||||
<Text style={publishStyle.currency}>LBC</Text>
|
||||
<Picker
|
||||
style={publishStyle.currencyPicker}
|
||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||
selectedValue={this.state.currency}
|
||||
itemStyle={publishStyle.pickerItem}
|
||||
onValueChange={this.handleCurrencyValueChange}
|
||||
>
|
||||
<Picker.Item label={'LBC'} value={'LBC'} />
|
||||
<Picker.Item label={'USD'} value={'USD'} />
|
||||
</Picker>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -86,7 +86,7 @@ const publishStyle = StyleSheet.create({
|
||||
marginTop: 8,
|
||||
},
|
||||
photo: {
|
||||
height: 240,
|
||||
height: 120,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
@@ -366,6 +366,9 @@ const publishStyle = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
currencyPicker: {
|
||||
width: 100,
|
||||
},
|
||||
fullCentered: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
|
||||
Reference in new issue
Block a user