mirror of
https://github.com/LBRYFoundation/lbry-android.git
synced 2025-08-30 00:31:26 +00:00
* add save file button for audio/video * set state for downloads initiated using the save file button * allow actions to be shown if there's a download_path in fileInfo * do not auto play downloaded media
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { normalizeURI, parseURI } from 'lbry-redux';
|
|
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
|
import Button from 'component/button';
|
|
import Colors from 'styles/colors';
|
|
|
|
class SubscribeButton extends React.PureComponent {
|
|
render() {
|
|
const {
|
|
uri,
|
|
isSubscribed,
|
|
doChannelSubscribe,
|
|
doChannelUnsubscribe,
|
|
style,
|
|
hideText
|
|
} = this.props;
|
|
|
|
let styles = [];
|
|
if (style) {
|
|
if (style.length) {
|
|
styles = styles.concat(style);
|
|
} else {
|
|
styles.push(style);
|
|
}
|
|
}
|
|
|
|
const iconColor = isSubscribed ? null : Colors.Red;
|
|
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
|
const subscriptionLabel = isSubscribed ? null : __('Subscribe');
|
|
const { claimName } = parseURI(uri);
|
|
|
|
return (
|
|
<Button
|
|
style={styles}
|
|
theme={"light"}
|
|
icon={isSubscribed ? "heart-broken" : "heart"}
|
|
iconColor={iconColor}
|
|
solid={isSubscribed ? false : true}
|
|
text={hideText ? null : subscriptionLabel}
|
|
onPress={() => {
|
|
subscriptionHandler({
|
|
channelName: claimName,
|
|
uri: normalizeURI(uri),
|
|
});
|
|
}} />
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SubscribeButton;
|