diff --git a/src/constants.js b/src/constants.js
index 26659e3..6cbd629 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -140,6 +140,8 @@ const Constants = {
TRUE_STRING: 'true',
MINIMUM_TRANSACTION_BALANCE: 0.1,
+
+ SHARE_BASE_URL: 'https://open.lbry.com',
};
export default Constants;
diff --git a/src/page/channel/view.js b/src/page/channel/view.js
index 2a787be..4432c72 100644
--- a/src/page/channel/view.js
+++ b/src/page/channel/view.js
@@ -13,7 +13,7 @@ import {
} from 'react-native';
import { TabView, SceneMap } from 'react-native-tab-view';
import { normalizeURI } from 'lbry-redux';
-import { navigateBack, getOrderBy } from 'utils/helper';
+import { navigateBack, getOrderBy, formatLbryUrlForWeb } from 'utils/helper';
import ChannelIconItem from 'component/channelIconItem';
import ClaimList from 'component/claimList';
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 = () => {
const { abandonClaim, claim, navigation } = this.props;
if (claim) {
@@ -274,6 +283,12 @@ class ChannelPage extends React.PureComponent {
onPress={this.onDeletePressed}
/>
)}
+
{!ownedChannel && }
{!ownedChannel && (
{
- 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://open.lbry.com' + this.formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
+ const url = Constants.SHARE_BASE_URL + formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
NativeModules.UtilityModule.shareUrl(url);
}
};
diff --git a/src/styles/channelPage.js b/src/styles/channelPage.js
index d9963da..ba27579 100644
--- a/src/styles/channelPage.js
+++ b/src/styles/channelPage.js
@@ -172,6 +172,10 @@ const channelPageStyle = StyleSheet.create({
deleteButton: {
marginLeft: 8,
},
+ shareButton: {
+ marginLeft: 8,
+ marginRight: 8,
+ },
});
export default channelPageStyle;
diff --git a/src/utils/helper.js b/src/utils/helper.js
index 0126067..200dfaf 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -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, ':');
+}