From 918a7e64bd0d244903b1f9ec65454d02be8eac64 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 11 Feb 2019 11:56:14 +0100 Subject: [PATCH] use full URIs for channelname links --- app/src/component/fileItem/view.js | 5 +++-- app/src/component/fileListItem/view.js | 7 ++++--- app/src/page/file/view.js | 11 +++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/src/component/fileItem/view.js b/app/src/component/fileItem/view.js index e37d0571..8f8b2daa 100644 --- a/app/src/component/fileItem/view.js +++ b/app/src/component/fileItem/view.js @@ -51,6 +51,8 @@ class FileItem extends React.PureComponent { const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id); const channelName = claim ? claim.channel_name : null; + const channelClaimId = claim && claim.value && claim.value.publisherSignature && claim.value.publisherSignature.certificateId; + const fullChannelUri = channelClaimId ? `${channelName}#${channelClaimId}` : channelName; const height = claim ? claim.height : null; return ( @@ -76,8 +78,7 @@ class FileItem extends React.PureComponent { {channelName && { - const channelUri = normalizeURI(channelName); - navigateToUri(navigation, channelUri); + navigateToUri(navigation, normalizeURI(fullChannelUri)); }} />} diff --git a/app/src/component/fileListItem/view.js b/app/src/component/fileListItem/view.js index 1f771617..00f89914 100644 --- a/app/src/component/fileListItem/view.js +++ b/app/src/component/fileListItem/view.js @@ -63,11 +63,13 @@ class FileListItem extends React.PureComponent { const isResolving = !fileInfo && isResolvingUri; const title = fileInfo ? fileInfo.metadata.title : metadata && metadata.title ? metadata.title : parseURI(uri).contentName; - let name, channel, height; + let name, channel, height, channelClaimId, fullChannelUri; if (claim) { name = claim.name; channel = claim.channel_name; height = claim.height; + channelClaimId = claim.value && claim.value.publisherSignature && claim.value.publisherSignature.certificateId; + fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel; } return ( @@ -90,8 +92,7 @@ class FileListItem extends React.PureComponent { {(title || name) && {this.formatTitle(title) || this.formatTitle(name)}} {channel && { - const channelUri = normalizeURI(channel); - navigateToUri(navigation, channelUri); + navigateToUri(navigation, normalizeURI(fullChannelUri)); }} />} diff --git a/app/src/page/file/view.js b/app/src/page/file/view.js index ca4d49c9..3566c314 100644 --- a/app/src/page/file/view.js +++ b/app/src/page/file/view.js @@ -428,9 +428,9 @@ class FilePage extends React.PureComponent { const { height, channel_name: channelName, value } = claim; const showActions = !this.state.fullscreenMode && !this.state.showImageViewer && !this.state.showWebView; const showFileActions = (completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes)); - const channelClaimId = - value && value.publisherSignature && value.publisherSignature.certificateId; + const channelClaimId = value && value.publisherSignature && value.publisherSignature.certificateId; const canSendTip = this.state.tipAmount > 0; + const fullChannelUri = channelClaimId && channelClaimId.trim().length > 0 ? `${channelName}#${channelClaimId}` : channelName; const playerStyle = [filePageStyle.player, this.state.isLandscape ? filePageStyle.containedPlayerLandscape : @@ -575,8 +575,7 @@ class FilePage extends React.PureComponent { numberOfLines={1} ellipsizeMode={"tail"} onPress={() => { - const channelUri = normalizeURI(channelName); - navigateToUri(navigation, channelUri); + navigateToUri(navigation, normalizeURI(fullChannelUri)); }} />