add share button (#55)

* add share button
* remove extra slash
* change beta.lbry.tv -> lbry.tv
This commit is contained in:
Akinwale Ariwodola 2019-10-15 08:31:03 +01:00 committed by GitHub
parent 342e022594
commit b258654d60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 6 deletions

View file

@ -508,6 +508,20 @@ class FilePage extends React.PureComponent {
this.setState({ fileViewLogged: true });
};
// TODO: Move this to lbry-redux
formatLbryUrlForWeb = url => {
return url.replace('lbry://', '/').replace(/#/g, ':');
};
handleSharePress = () => {
const { claim, notify } = this.props;
if (claim) {
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
const url = 'https://lbry.tv' + this.formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
NativeModules.UtilityModule.shareUrl(url);
}
};
handleSendTip = () => {
const { claim, balance, navigation, notify, sendTip } = this.props;
const { uri } = navigation.state.params;
@ -933,6 +947,22 @@ class FilePage extends React.PureComponent {
</View>
</View>
</TouchableWithoutFeedback>
<View style={filePageStyle.largeButtonsRow}>
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
<Icon name={'share-alt'} size={24} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Share</Text>
</TouchableOpacity>
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
>
<Icon name={'flag'} size={24} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Report</Text>
</TouchableOpacity>
</View>
<View style={filePageStyle.channelRow}>
<View style={filePageStyle.publishInfo}>
{channelName && (
@ -969,12 +999,6 @@ class FilePage extends React.PureComponent {
onPress={this.onSaveFilePressed}
/>
)}
<Button
style={[filePageStyle.actionButton, filePageStyle.reportButton]}
theme={'light'}
icon={'flag'}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
/>
<Button
style={[filePageStyle.actionButton, filePageStyle.tipButton]}
theme={'light'}

View file

@ -377,6 +377,24 @@ const filePageStyle = StyleSheet.create({
backButtonIcon: {
color: Colors.White,
},
largeButton: {
alignItems: 'center',
justifyContent: 'center',
},
largeButtonIcon: {
color: Colors.DescriptionGrey,
},
largeButtonText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
marginTop: 4,
},
largeButtonsRow: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
margin: 16,
},
});
export default filePageStyle;