Merge remote-tracking branch 'origin/channel-share' into product-review
This commit is contained in:
commit
085c613040
5 changed files with 29 additions and 8 deletions
|
@ -140,6 +140,8 @@ const Constants = {
|
||||||
TRUE_STRING: 'true',
|
TRUE_STRING: 'true',
|
||||||
|
|
||||||
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
||||||
|
|
||||||
|
SHARE_BASE_URL: 'https://open.lbry.com',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Constants;
|
export default Constants;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { TabView, SceneMap } from 'react-native-tab-view';
|
import { TabView, SceneMap } from 'react-native-tab-view';
|
||||||
import { normalizeURI } from 'lbry-redux';
|
import { normalizeURI } from 'lbry-redux';
|
||||||
import { navigateBack, getOrderBy } from 'utils/helper';
|
import { navigateBack, getOrderBy, formatLbryUrlForWeb } from 'utils/helper';
|
||||||
import ChannelIconItem from 'component/channelIconItem';
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
import ClaimList from 'component/claimList';
|
import ClaimList from 'component/claimList';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
|
@ -172,6 +172,15 @@ class ChannelPage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onSharePressed = () => {
|
||||||
|
const { claim } = this.props;
|
||||||
|
if (claim) {
|
||||||
|
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
||||||
|
const url = Constants.SHARE_BASE_URL + formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||||
|
NativeModules.UtilityModule.shareUrl(url);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onDeletePressed = () => {
|
onDeletePressed = () => {
|
||||||
const { abandonClaim, claim, navigation } = this.props;
|
const { abandonClaim, claim, navigation } = this.props;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
|
@ -274,6 +283,12 @@ class ChannelPage extends React.PureComponent {
|
||||||
onPress={this.onDeletePressed}
|
onPress={this.onDeletePressed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
<Button
|
||||||
|
style={[channelPageStyle.actionButton, channelPageStyle.shareButton]}
|
||||||
|
theme={'light'}
|
||||||
|
icon={'share-alt'}
|
||||||
|
onPress={this.onSharePressed}
|
||||||
|
/>
|
||||||
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
||||||
{!ownedChannel && (
|
{!ownedChannel && (
|
||||||
<SubscribeNotificationButton
|
<SubscribeNotificationButton
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {
|
||||||
WebView,
|
WebView,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { NavigationEvents } from 'react-navigation';
|
import { NavigationEvents } from 'react-navigation';
|
||||||
import { navigateBack, navigateToUri } from 'utils/helper';
|
import { navigateBack, navigateToUri, formatLbryUrlForWeb } from 'utils/helper';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
@ -508,16 +508,11 @@ class FilePage extends React.PureComponent {
|
||||||
this.setState({ fileViewLogged: true });
|
this.setState({ fileViewLogged: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Move this to lbry-redux
|
|
||||||
formatLbryUrlForWeb = url => {
|
|
||||||
return url.replace('lbry://', '/').replace(/#/g, ':');
|
|
||||||
};
|
|
||||||
|
|
||||||
handleSharePress = () => {
|
handleSharePress = () => {
|
||||||
const { claim, notify } = this.props;
|
const { claim, notify } = this.props;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
||||||
const url = 'https://open.lbry.com' + this.formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
const url = Constants.SHARE_BASE_URL + formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||||
NativeModules.UtilityModule.shareUrl(url);
|
NativeModules.UtilityModule.shareUrl(url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,6 +172,10 @@ const channelPageStyle = StyleSheet.create({
|
||||||
deleteButton: {
|
deleteButton: {
|
||||||
marginLeft: 8,
|
marginLeft: 8,
|
||||||
},
|
},
|
||||||
|
shareButton: {
|
||||||
|
marginLeft: 8,
|
||||||
|
marginRight: 8,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default channelPageStyle;
|
export default channelPageStyle;
|
||||||
|
|
|
@ -346,3 +346,8 @@ export function uploadImageAsset(filePath, success, failure) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Move this to lbry-redux
|
||||||
|
export function formatLbryUrlForWeb(url) {
|
||||||
|
return url.replace('lbry://', '/').replace(/#/g, ':');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue