Compare commits

...
Author SHA1 Message Date
Akinwale Ariwodola e208a9960f default sort content on channel view by newest first 2019-11-20 00:59:05 +01:00
Akinwale Ariwodola e5c6270d5c Merge pull request #83 from lbryio/first-run-navigation
always navigate to first run if not completed
2019-11-18 06:52:04 +01:00
Akinwale Ariwodola afbb9e1d79 add fullscreen mode to app state to better handle suspend / resume (#82)
* add fullscreen mode to app state to better handle suspend / resume
* rename argument mode -> isFullscreen
2019-11-18 06:50:55 +01:00
Akinwale Ariwodola 357be73947 refactor and batch-resolve for related content component (#81)
* refactor and batch-resolve for related content component
* code cleanup
2019-11-18 06:48:54 +01:00
Akinwale Ariwodola 2ddfc1eaf8 always navigate to first run if not completed 2019-11-14 23:07:28 +01:00
Akinwale Ariwodola e901e81074 fetching cost info fix 2019-11-12 21:10:23 +01:00
Akinwale Ariwodola 2e3e1a1250 Merge pull request #77 from lbryio/sync-after-signin
restore user preferences after in-app sign in  flow
2019-11-12 15:35:44 +01:00
Akinwale Ariwodola 190af405bb Merge pull request #79 from lbryio/faster-short-urls
avoid re-resolving a claim when navigation to a short / canonical URL
2019-11-12 15:35:28 +01:00
Akinwale Ariwodola 4467853d44 special URLs for all top-level navigation routes (#78)
* special URLs for all top-level navigation routes
* rename yourTags to discover
2019-11-11 15:49:27 +01:00
Akinwale Ariwodola a45f68d096 avoid re-resolving a claim when navigation to a short / canonical URL 2019-11-08 07:13:24 +01:00
Akinwale Ariwodola 79686ff6b9 restore user preferences after in-app sign in flow 2019-11-07 17:13:37 +01:00
Akinwale Ariwodola 76305a67be Tag search result (#71)
* show tag search result
* run claim search for tag result
2019-11-07 16:55:04 +01:00
Akinwale Ariwodola 82345070fb Merge pull request #75 from lbryio/better-file-handling
display unsupported content view
2019-11-07 16:51:56 +01:00
Akinwale Ariwodola 56aa0a96a7 Merge pull request #76 from lbryio/wallet-send
disable send button if the recipient address is not valid
2019-11-06 13:42:19 +01:00
Akinwale Ariwodola 232cdb3d29 disable send button if the recipient address is not valid 2019-11-06 13:41:05 +01:00
Akinwale Ariwodola 61189b817a display unsupported content view 2019-11-06 13:26:39 +01:00
Akinwale Ariwodola a127e14a0f Merge pull request #74 from lbryio/fcm-data
show notification settings. handle blackListedOutpoints being null.
2019-11-01 06:54:02 +01:00
Akinwale Ariwodola 51e3dfcf6a show notification settings. handle blackListedOutpoints being null. 2019-11-01 06:52:39 +01:00
Akinwale Ariwodola 5915919560 hide notification settings 2019-10-31 17:34:32 +01:00
Akinwale Ariwodola 943c5654c1 cleanup console.log 2019-10-31 07:54:42 +01:00
Akinwale Ariwodola 117c23fe3f Merge pull request #73 from lbryio/launch-url-fix
fix for launch urls and notification target urls
2019-10-31 07:53:59 +01:00
Akinwale Ariwodola 072ad25146 fix for launch urls and notification target urls 2019-10-31 07:52:57 +01:00
Akinwale Ariwodola f714310681 normalise tag name from search result 2019-10-30 13:02:33 +01:00
Akinwale Ariwodola 9bc5a1538a RC (#72)
* show tag search result
* fix suggested subscriptions. reduce number of search results.
* run claim search for tag result
2019-10-30 10:35:43 +01:00
29 changed files with 445 additions and 263 deletions

No files matched your search

+32 -2
View File
@@ -27,7 +27,16 @@ import {
createNavigationReducer,
} from 'react-navigation-redux-helpers';
import { connect } from 'react-redux';
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
import {
AppState,
BackHandler,
DeviceEventEmitter,
Linking,
NativeModules,
StatusBar,
TextInput,
ToastAndroid,
} from 'react-native';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
import {
@@ -42,7 +51,7 @@ import {
selectHashChanged,
selectUser,
} from 'lbryinc';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
import { decode as atob } from 'base-64';
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
import AsyncStorage from '@react-native-community/async-storage';
@@ -427,6 +436,26 @@ class AppWithNavigationState extends React.Component {
if (backgroundPlayEnabled || NativeModules.BackgroundMedia) {
NativeModules.BackgroundMedia.hidePlaybackNotification();
}
// check fullscreen mode and show / hide navigation bar accordingly
this.checkFullscreenMode();
}
};
checkFullscreenMode = () => {
const { fullscreenMode } = this.props;
StatusBar.setHidden(fullscreenMode);
if (fullscreenMode) {
// fullscreen, so change orientation to landscape mode
NativeModules.ScreenOrientation.lockOrientationLandscape();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.hideNavigationBar();
} else {
// Switch back to portrait mode when the media is not fullscreen
NativeModules.ScreenOrientation.lockOrientationPortrait();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.showNavigationBar();
}
};
@@ -481,6 +510,7 @@ const mapStateToProps = state => ({
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
user: selectUser(state),
fullscreenMode: selectFullscreenMode(state),
});
export default connect(mapStateToProps)(AppWithNavigationState);
+5 -1
View File
@@ -54,7 +54,11 @@ class DrawerContent extends React.PureComponent {
launchSignInFlow = () => {
// for now, sync flow (email, then password input) will be the default sign in flow
const { navigation } = this.props;
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
navigation.navigate({
routeName: 'Verification',
key: 'verification',
params: { syncFlow: true, signInFlow: true },
});
};
render() {
+12 -4
View File
@@ -30,12 +30,12 @@ class FileItem extends React.PureComponent {
}
navigateToFileUri = () => {
const { navigation, uri, shortUrl } = this.props;
const { claim, navigation, uri, shortUrl } = this.props;
const normalizedUri = normalizeURI(uri);
if (NativeModules.Firebase) {
NativeModules.Firebase.track('explore_click', { uri: normalizedUri, short_url: shortUrl });
}
navigateToUri(navigation, shortUrl || uri);
navigateToUri(navigation, shortUrl || uri, null, false, claim ? claim.permanent_url : null);
};
render() {
@@ -66,7 +66,9 @@ class FileItem extends React.PureComponent {
let shouldHide = false;
if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
const outpointsToHide = !blackListedOutpoints
? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
}
if (shouldHide) {
@@ -122,7 +124,13 @@ class FileItem extends React.PureComponent {
style={discoverStyle.channelName}
text={channelName}
onPress={() => {
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
+13 -5
View File
@@ -40,8 +40,8 @@ class FileListItem extends React.PureComponent {
};
componentDidMount() {
const { claim, resolveUri, uri } = this.props;
if (!claim) {
const { claim, resolveUri, uri, batchResolve } = this.props;
if (!claim && !batchResolve) {
resolveUri(uri);
}
}
@@ -59,7 +59,7 @@ class FileListItem extends React.PureComponent {
if (featuredResult && !claim) {
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
} else {
navigateToUri(navigation, shortUrl || uri, { autoplay });
navigateToUri(navigation, shortUrl || uri, { autoplay }, false, claim ? claim.permanent_url : null);
}
};
@@ -120,7 +120,9 @@ class FileListItem extends React.PureComponent {
shortChannelUri = signingChannel ? signingChannel.short_url : null;
if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
const outpointsToHide = !blackListedOutpoints
? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
}
@@ -196,7 +198,13 @@ class FileListItem extends React.PureComponent {
style={fileListStyle.publisher}
text={channel}
onPress={() => {
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
+2 -2
View File
@@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import {
doResolveUris,
makeSelectClaimForUri,
makeSelectRecommendedContentForUri,
makeSelectTitleForUri,
selectIsSearching,
} from 'lbry-redux';
import { doNativeSearch } from 'redux/actions/performance';
import RelatedContent from './view';
const select = (state, props) => ({
@@ -16,7 +16,7 @@ const select = (state, props) => ({
});
const perform = dispatch => ({
search: query => dispatch(doNativeSearch(query, 20, undefined, true)),
resolveUris: uris => dispatch(doResolveUris(uris)),
});
export default connect(
+11 -35
View File
@@ -8,45 +8,23 @@ import fileListStyle from 'styles/fileList';
import relatedContentStyle from 'styles/relatedContent';
export default class RelatedContent extends React.PureComponent {
constructor() {
super();
this.didSearch = undefined;
}
componentDidMount() {
this.getRecommendedContent();
}
state = {
urlsResolved: false,
};
componentDidUpdate(prevProps) {
const { claim, uri } = this.props;
const { resolveUris, recommendedContent } = this.props;
if (uri !== prevProps.uri) {
this.didSearch = false;
}
if (claim && !this.didSearch) {
this.getRecommendedContent();
if (recommendedContent && recommendedContent.length > 0 && !this.state.urisResolved) {
this.setState({ urisResolved: true }, () => {
// batch resolve the uris
resolveUris(recommendedContent);
});
}
}
getRecommendedContent() {
const { search, title } = this.props;
if (title) {
search(title);
this.didSearch = true;
}
}
didSearch;
render() {
const { recommendedContent, isSearching, navigation, uri, fullUri } = this.props;
if (!isSearching && (!recommendedContent || recommendedContent.length === 0)) {
return null;
}
const { recommendedContent, navigation, uri, fullUri } = this.props;
return (
<View style={relatedContentStyle.container}>
@@ -59,13 +37,11 @@ export default class RelatedContent extends React.PureComponent {
style={fileListStyle.item}
key={recommendedUri}
uri={recommendedUri}
batchResolve
navigation={navigation}
autoplay
/>
))}
{isSearching && (
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={relatedContentStyle.loading} />
)}
</View>
);
}
@@ -57,7 +57,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
style={subscriptionsStyle.suggestedItemName}
numberOfLines={1}
text={claim.name}
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri))}
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri), null, false, claim.permanent_url)}
/>
)}
{tags && (
@@ -72,7 +72,9 @@ class SuggestedSubscriptionItem extends React.PureComponent {
)}
</View>
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(uri)} />
{claim && (
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(claim.permanent_url)} />
)}
</View>
);
}
+3 -2
View File
@@ -82,7 +82,8 @@ class WalletSend extends React.PureComponent<Props> {
render() {
const { balance } = this.props;
const canSend = this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0;
const canSend =
this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0 && this.state.addressValid;
return (
<View style={walletStyle.card}>
@@ -94,7 +95,7 @@ class WalletSend extends React.PureComponent<Props> {
this.setState({
address: value,
addressChanged: true,
addressValid: value.trim().length == 0 || regexAddress.test(value),
addressValid: value.trim().length === 0 || regexAddress.test(value),
})
}
onBlur={this.handleAddressInputBlur}
+5 -1
View File
@@ -16,7 +16,11 @@ class WalletSignIn extends React.Component {
onSignInPressed = () => {
const { navigation } = this.props;
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
navigation.navigate({
routeName: 'Verification',
key: 'verification',
params: { syncFlow: true, signInFlow: true },
});
};
render() {
+2
View File
@@ -64,6 +64,8 @@ const Constants = {
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
ACTION_FULLSCREEN_MODE_TOGGLED: 'FULLSCREEN_MODE_TOGGLED',
ORIENTATION_HORIZONTAL: 'horizontal',
ORIENTATION_VERTICAL: 'vertical',
+3 -2
View File
@@ -36,7 +36,7 @@ class ChannelPage extends React.PureComponent {
autoStyle: null,
showSortPicker: false,
showTimePicker: false,
orderBy: Constants.DEFAULT_ORDER_BY,
orderBy: ['release_time'], // sort by new by default
activeTab: Constants.CONTENT_TAB,
};
@@ -48,8 +48,9 @@ class ChannelPage extends React.PureComponent {
}
componentDidMount() {
const { fetchChannelListMine } = this.props;
const { fetchChannelListMine, setSortByItem } = this.props;
NativeModules.Firebase.setCurrentScreen('Channel');
setSortByItem(Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1]); // sort by newest first
fetchChannelListMine();
}
+22 -14
View File
@@ -8,6 +8,7 @@ import {
doPurchaseUri,
doDeletePurchasedUri,
doResolveUri,
doSearch,
doSendTip,
doToast,
makeSelectIsUriResolving,
@@ -17,6 +18,7 @@ import {
makeSelectContentPositionForUri,
makeSelectContentTypeForUri,
makeSelectMetadataForUri,
makeSelectRecommendedContentForUri,
makeSelectStreamingUrlForUri,
makeSelectThumbnailForUri,
makeSelectTitleForUri,
@@ -26,6 +28,7 @@ import {
selectPurchasedUris,
selectFailedPurchaseUris,
selectPurchaseUriErrorMessage,
selectIsSearching,
} from 'lbry-redux';
import {
doClaimEligiblePurchaseRewards,
@@ -42,34 +45,37 @@ import {
doStopDownloadingFile,
} from 'redux/actions/file';
import { doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doToggleFullscreenMode } from 'redux/actions/settings';
import { selectDrawerStack } from 'redux/selectors/drawer';
import FilePage from './view';
const select = (state, props) => {
const selectProps = { uri: props.navigation.state.params.uri };
const { uri, fullUri } = props.navigation.state.params;
const contentUri = fullUri || uri;
const selectProps = { uri: contentUri };
return {
balance: selectBalance(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
channels: selectMyChannelClaims(state),
claim: makeSelectClaimForUri(selectProps.uri)(state),
claim: makeSelectClaimForUri(contentUri)(state),
drawerStack: selectDrawerStack(state),
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
// obscureNsfw: !selectShowNsfw(state),
// tab: makeSelectCurrentParam('tab')(state),
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
isResolvingUri: makeSelectIsUriResolving(contentUri)(state),
contentType: makeSelectContentTypeForUri(contentUri)(state),
costInfo: makeSelectCostInfoForUri(contentUri)(state),
metadata: makeSelectMetadataForUri(contentUri)(state),
fileInfo: makeSelectFileInfoForUri(contentUri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
channelUri: makeSelectChannelForClaimUri(selectProps.uri, true)(state),
position: makeSelectContentPositionForUri(selectProps.uri)(state),
channelUri: makeSelectChannelForClaimUri(contentUri, true)(state),
position: makeSelectContentPositionForUri(contentUri)(state),
purchasedUris: selectPurchasedUris(state),
failedPurchaseUris: selectFailedPurchaseUris(state),
myClaimUris: selectMyClaimUrisWithoutChannels(state),
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
streamingUrl: makeSelectStreamingUrlForUri(selectProps.uri)(state),
thumbnail: makeSelectThumbnailForUri(selectProps.uri)(state),
title: makeSelectTitleForUri(selectProps.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
title: makeSelectTitleForUri(contentUri)(state),
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
isSearchingRecommendContent: selectIsSearching(state),
};
};
@@ -89,6 +95,7 @@ const perform = dispatch => ({
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
resolveUri: uri => dispatch(doResolveUri(uri)),
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
@@ -96,6 +103,7 @@ const perform = dispatch => ({
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
});
export default connect(
+75 -24
View File
@@ -6,6 +6,7 @@ import {
Alert,
DeviceEventEmitter,
Dimensions,
Image,
Linking,
NativeModules,
ScrollView,
@@ -84,6 +85,7 @@ class FilePage extends React.PureComponent {
uriVars: null,
stopDownloadConfirmed: false,
streamingMode: false,
didSearchRecommended: false,
};
}
@@ -184,12 +186,25 @@ class FilePage extends React.PureComponent {
}
componentDidUpdate(prevProps) {
const { claim, contentType, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
const {
claim,
contentType,
fileInfo,
isResolvingUri,
resolveUri,
navigation,
searchRecommended,
title,
} = this.props;
const { uri } = this.state;
if (!isResolvingUri && claim === undefined && uri) {
resolveUri(uri);
}
if (title && !this.state.didSearchRecommended) {
this.setState({ didSearchRecommended: true }, () => searchRecommended(title));
}
// Returned to the page. If mediaLoaded, and currentMediaInfo is different, update
if (this.state.mediaLoaded && window.currentMediaInfo && window.currentMediaInfo.uri !== this.state.uri) {
const { metadata } = this.props;
@@ -213,25 +228,25 @@ class FilePage extends React.PureComponent {
}
}
handleFullscreenToggle = mode => {
this.setState({ fullscreenMode: mode });
StatusBar.setHidden(mode);
if (NativeModules.ScreenOrientation) {
if (mode) {
// fullscreen, so change orientation to landscape mode
NativeModules.ScreenOrientation.lockOrientationLandscape();
if (NativeModules.UtilityModule) {
// hide the navigation bar (on devices that use have soft navigation bar)
NativeModules.UtilityModule.hideNavigationBar();
}
} else {
// Switch back to portrait mode when the media is not fullscreen
NativeModules.ScreenOrientation.lockOrientationPortrait();
if (NativeModules.UtilityModule) {
// hide the navigation bar (on devices that use have soft navigation bar)
NativeModules.UtilityModule.showNavigationBar();
}
}
handleFullscreenToggle = isFullscreen => {
const { toggleFullscreenMode } = this.props;
this.setState({ fullscreenMode: isFullscreen });
toggleFullscreenMode(isFullscreen);
StatusBar.setHidden(isFullscreen);
if (isFullscreen) {
// fullscreen, so change orientation to landscape mode
NativeModules.ScreenOrientation.lockOrientationLandscape();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.hideNavigationBar();
} else {
// Switch back to portrait mode when the media is not fullscreen
NativeModules.ScreenOrientation.lockOrientationPortrait();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.showNavigationBar();
}
};
@@ -606,6 +621,8 @@ class FilePage extends React.PureComponent {
navigation,
position,
purchaseUri,
isSearchingRecommendContent,
recommendedContent,
thumbnail,
title,
} = this.props;
@@ -739,6 +756,7 @@ class FilePage extends React.PureComponent {
const isWebViewable = mediaType === 'text';
const canOpen = isViewable && completed;
const localFileUri = this.localUriForFileInfo(fileInfo);
const unsupported = !isPlayable && !canOpen;
const openFile = () => {
if (mediaType === 'image') {
@@ -809,15 +827,36 @@ class FilePage extends React.PureComponent {
thumbnail={thumbnail}
/>
)}
{(!this.state.downloadButtonShown || this.state.downloadPressed) && !this.state.mediaLoaded && (
{!unsupported &&
(!this.state.downloadButtonShown || this.state.downloadPressed) &&
!this.state.mediaLoaded && (
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={filePageStyle.loading} />
)}
{unsupported && fileInfo && completed && (
<View style={filePageStyle.unsupportedContent}>
<Image
style={filePageStyle.unsupportedContentImage}
resizeMode={'stretch'}
source={require('../../assets/gerbil-happy.png')}
/>
<View style={filePageStyle.unspportedContentTextContainer}>
<Text style={filePageStyle.unsupportedContentTitle}>Unsupported Content</Text>
<Text style={filePageStyle.unsupportedContentText}>
Sorry, we are unable to display this content in the app. You can find the file named{' '}
<Text style={filePageStyle.unsupportedContentFilename}>{fileInfo.file_name}</Text> in your
downloads folder.
</Text>
</View>
</View>
)}
{((isPlayable && !completed && !canLoadMedia) ||
canOpen ||
(!completed && !this.state.streamingMode)) &&
!this.state.downloadPressed && (
<FileDownloadButton
uri={uri}
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
style={filePageStyle.downloadButton}
openFile={openFile}
isPlayable={isPlayable}
@@ -976,7 +1015,13 @@ class FilePage extends React.PureComponent {
numberOfLines={1}
ellipsizeMode={'tail'}
onPress={() => {
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
@@ -1076,7 +1121,13 @@ class FilePage extends React.PureComponent {
)}
<View onLayout={this.setRelatedContentPosition} />
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
{isSearchingRecommendContent && (
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={filePageStyle.relatedLoading} />
)}
{!isSearchingRecommendContent && recommendedContent && recommendedContent.length > 0 && (
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
)}
</ScrollView>
</View>
)}
+13 -17
View File
@@ -44,24 +44,20 @@ class FirstRunScreen extends React.PureComponent {
}
});
if (NativeModules.FirstRun) {
NativeModules.FirstRun.isFirstRun().then(firstRun => {
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
this.setState({ isFirstRun: firstRun });
// FirstRun module should always be present (in order to detect first run status)
NativeModules.FirstRun.isFirstRun().then(firstRun => {
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
this.setState({ isFirstRun: firstRun });
if (firstRun) {
NativeModules.Firebase.setCurrentScreen('First Run');
this.setState({ currentPage: FirstRunScreen.pages[0] });
} else {
// Not the first run. Navigate to the splash screen right away
this.launchSplashScreen();
}
});
} else {
// The first run module was not detected. Go straight to the splash screen.
this.launchSplashScreen();
}
if (firstRun) {
NativeModules.Firebase.setCurrentScreen('First Run');
this.setState({ currentPage: FirstRunScreen.pages[0] });
} else {
// Not the first run. Navigate to the splash screen right away
this.launchSplashScreen();
}
});
}
componentWillReceiveProps(nextProps) {
+5 -1
View File
@@ -1,8 +1,10 @@
import { connect } from 'react-redux';
import {
doClaimSearch,
doSearch,
doUpdateSearchQuery,
makeSelectSearchUris,
selectClaimSearchByQuery,
selectIsSearching,
selectSearchValue,
makeSelectQueryWithOptions,
@@ -13,9 +15,10 @@ import { selectCurrentRoute } from 'redux/selectors/drawer';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import SearchPage from './view';
const numSearchResults = 50;
const numSearchResults = 25;
const select = state => ({
claimSearchByQuery: selectClaimSearchByQuery(state),
currentRoute: selectCurrentRoute(state),
isSearching: selectIsSearching(state),
query: selectSearchValue(state),
@@ -25,6 +28,7 @@ const select = state => ({
const perform = dispatch => ({
search: query => dispatch(doSearch(query, numSearchResults)),
claimSearch: options => dispatch(doClaimSearch(options)),
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
+58 -7
View File
@@ -1,6 +1,15 @@
import React from 'react';
import { Lbry, parseURI, normalizeURI, isURIValid } from 'lbry-redux';
import { ActivityIndicator, Button, FlatList, NativeModules, Text, TextInput, View } from 'react-native';
import { Lbry, createNormalizedClaimSearchKey, parseURI, normalizeURI, isURIValid } from 'lbry-redux';
import {
ActivityIndicator,
Button,
FlatList,
NativeModules,
Text,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
import { navigateToUri } from 'utils/helper';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
@@ -14,6 +23,9 @@ class SearchPage extends React.PureComponent {
state = {
currentQuery: null,
currentUri: null,
showTagResult: false,
claimSearchRun: false,
claimSearchOptions: null,
};
static navigationOptions = {
@@ -43,6 +55,9 @@ class SearchPage extends React.PureComponent {
this.setState({
currentQuery: searchQuery,
currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null,
claimSearchOptions: null,
claimSearchRun: false,
showTagResult: false,
});
search(searchQuery);
}
@@ -80,7 +95,12 @@ class SearchPage extends React.PureComponent {
handleSearchSubmitted = keywords => {
const { search } = this.props;
this.setState({ currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null });
this.setState({
currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null,
claimSearchOptions: null,
claimSearchRun: false,
showTagResult: false,
});
search(keywords);
};
@@ -96,15 +116,45 @@ class SearchPage extends React.PureComponent {
);
};
listHeaderComponent = () => {
const { navigation } = this.props;
listHeaderComponent = showTagResult => {
const { navigation, claimSearch, claimSearchByQuery } = this.props;
const { currentUri } = this.state;
const query = this.getSearchQuery();
const canBeTag = query && query.trim().length > 0 && isURIValid(query);
if (canBeTag && !this.state.claimSearchRun) {
const options = {
any_tags: [query],
page: 1,
no_totals: true,
};
this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options));
}
if (this.state.claimSearchRun && this.state.claimSearchOptions) {
const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions);
const claimSearchUris = claimSearchByQuery[claimSearchKey];
this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 });
}
return (
<FileListItem uri={currentUri} featuredResult style={searchStyle.featuredResultItem} navigation={navigation} />
<View>
<FileListItem uri={currentUri} featuredResult style={searchStyle.featuredResultItem} navigation={navigation} />
{showTagResult && (
<TouchableOpacity style={searchStyle.tagResultItem} onPress={() => this.handleTagResultPressed(query)}>
<Text style={searchStyle.tagResultTitle}>#{query.toLowerCase()}</Text>
<Text style={searchStyle.tagResultDescription}>Explore content for this tag</Text>
</TouchableOpacity>
)}
</View>
);
};
handleTagResultPressed = tag => {
const { navigation } = this.props;
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_TAG, key: `tagPage`, params: { tag: tag.toLowerCase() } });
};
render() {
const { isSearching, navigation, query, uris, urisByQuery } = this.props;
@@ -119,6 +169,7 @@ class SearchPage extends React.PureComponent {
)}
<FlatList
extraData={this.state}
style={searchStyle.scrollContainer}
contentContainerStyle={searchStyle.scrollPadding}
keyboardShouldPersistTaps={'handled'}
@@ -128,7 +179,7 @@ class SearchPage extends React.PureComponent {
maxToRenderPerBatch={20}
removeClippedSubviews
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent() : null}
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
renderItem={({ item }) => (
<FileListItem key={item} uri={item} style={searchStyle.resultItem} navigation={navigation} />
)}
+1 -1
View File
@@ -140,7 +140,7 @@ class SettingsPage extends React.PureComponent {
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>{__('Tags you follow')}</Text>
<Text style={settingsStyle.label}>{__('Content Interests')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
+42 -16
View File
@@ -1,7 +1,7 @@
import React from 'react';
import { Lbry, doPreferenceGet } from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
import { ActivityIndicator, DeviceEventEmitter, Linking, NativeModules, Platform, Text, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
import { decode as atob } from 'base-64';
import { navigateToUri, transformUrl } from 'utils/helper';
@@ -52,7 +52,10 @@ class SplashScreen extends React.PureComponent {
});
navigation.dispatch(resetAction);
const launchUrl = navigation.state.params ? navigation.state.params.launchUrl : this.state.launchUrl;
const launchUrl =
navigation.state.params && navigation.state.params.launchUrl
? navigation.state.params.launchUrl
: this.state.launchUrl;
if (launchUrl) {
if (launchUrl.startsWith('lbry://?verify=')) {
let verification = {};
@@ -118,6 +121,12 @@ class SplashScreen extends React.PureComponent {
);
};
onNotificationTargetLaunch = evt => {
if (evt.url && evt.url.startsWith('lbry://')) {
this.setState({ launchUrl: evt.url });
}
};
finishSplashScreen = () => {
const {
authenticate,
@@ -149,7 +158,9 @@ class SplashScreen extends React.PureComponent {
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => authenticate(appVersion, Platform.OS, firebaseToken))
.then(firebaseToken => {
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(() => authenticate(appVersion, Platform.OS));
});
}
@@ -250,6 +261,14 @@ class SplashScreen extends React.PureComponent {
}, 1000);
}
componentWillMount() {
DeviceEventEmitter.addListener('onNotificationTargetLaunch', this.onNotificationTargetLaunch);
}
componentWillUnmount() {
DeviceEventEmitter.removeListener('onNotificationTargetLaunch', this.onNotificationTargetLaunch);
}
componentDidMount() {
NativeModules.Firebase.track('app_launch', null);
NativeModules.Firebase.setCurrentScreen('Splash');
@@ -259,6 +278,26 @@ class SplashScreen extends React.PureComponent {
if (url) {
this.setState({ launchUrl: url });
}
NativeModules.UtilityModule.getNotificationLaunchTarget().then(target => {
if (target) {
this.setState({ launchUrl: target });
}
// Only connect after checking initial launch url / notification launch target
Lbry.connect()
.then(() => {
this.updateStatus();
})
.catch(e => {
this.setState({
isLagging: true,
message: 'Connection Failure',
details:
'We could not establish a connection to the daemon. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.',
});
});
});
});
// Start measuring the first launch time from the splash screen
@@ -270,19 +309,6 @@ class SplashScreen extends React.PureComponent {
AsyncStorage.setItem('firstLaunchTime', String(moment().unix()));
}
});
Lbry.connect()
.then(() => {
this.updateStatus();
})
.catch(e => {
this.setState({
isLagging: true,
message: 'Connection Failure',
details:
'We could not establish a connection to the daemon. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.',
});
});
}
handleContinueAnywayPressed = () => {
+2 -1
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { doToast, doPopulateSharedUserState } from 'lbry-redux';
import {
doCheckSync,
doGetSync,
@@ -58,6 +58,7 @@ const perform = dispatch => ({
checkSync: () => dispatch(doCheckSync()),
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
notify: data => dispatch(doToast(data)),
populateSharedUserState: settings => dispatch(doPopulateSharedUserState(settings)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
@@ -112,7 +112,7 @@ class SyncVerifyPage extends React.PureComponent {
};
render() {
const { hasSyncedWallet, syncApplyIsPending } = this.props;
const { hasSyncedWallet, syncApplyIsPending, signInFlow } = this.props;
let paragraph;
if (!hasSyncedWallet) {
@@ -194,7 +194,7 @@ class SyncVerifyPage extends React.PureComponent {
<Button
style={rewardStyle.verificationButton}
theme={'light'}
text={'Enable sync'}
text={signInFlow ? 'Use LBRY' : 'Enable sync'}
onPress={this.onEnableSyncPressed}
/>
)}
+30 -5
View File
@@ -1,10 +1,11 @@
import React from 'react';
import { Lbry } from 'lbry-redux';
import { Lbry, doPreferenceGet } from 'lbry-redux';
import { ActivityIndicator, Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
import AsyncStorage from '@react-native-community/async-storage';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Icon from 'react-native-vector-icons/FontAwesome5';
import EmailVerifyPage from './internal/email-verify-page';
import ManualVerifyPage from './internal/manual-verify-page';
import PhoneVerifyPage from './internal/phone-verify-page';
@@ -19,6 +20,7 @@ class VerificationScreen extends React.PureComponent {
showSkip: false,
skipAccountConfirmed: false,
showBottomContainer: true,
signInFlow: false,
walletPassword: null,
isEmailVerificationPhase: false,
isEmailVerified: false,
@@ -27,7 +29,9 @@ class VerificationScreen extends React.PureComponent {
};
componentDidMount() {
const { user } = this.props;
const { user, navigation } = this.props;
const { signInFlow } = navigation.state.params;
this.setState({ signInFlow });
this.checkVerificationStatus(user);
NativeModules.Firebase.setCurrentScreen('Verification');
}
@@ -36,8 +40,22 @@ class VerificationScreen extends React.PureComponent {
this.setState({ isEmailVerificationPhase: value });
};
getUserSettings = () => {
const { populateSharedUserState } = this.props;
doPreferenceGet(
'shared',
preference => {
populateSharedUserState(preference);
},
error => {
/* failed */
}
);
};
checkVerificationStatus = user => {
const { deviceWalletSynced, navigation } = this.props;
const { deviceWalletSynced, getSync, navigation } = this.props;
const { syncFlow } = navigation.state.params;
this.setState(
@@ -57,7 +75,13 @@ class VerificationScreen extends React.PureComponent {
}
if (this.state.isEmailVerified && syncFlow && deviceWalletSynced) {
navigation.goBack();
// retrieve user settings
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => {
this.getUserSettings();
navigation.goBack();
});
});
}
} else {
if (this.state.isEmailVerified && !this.state.isIdentityVerified && !this.state.isRewardApproved) {
@@ -167,6 +191,7 @@ class VerificationScreen extends React.PureComponent {
syncApply={syncApply}
syncData={syncData}
syncHash={syncHash}
signInFlow={this.state.signInFlow}
/>
);
break;
@@ -182,7 +207,7 @@ class VerificationScreen extends React.PureComponent {
{!this.state.isEmailVerificationPhase && (
<TouchableOpacity style={firstRunStyle.closeButton} onPress={this.onCloseButtonPressed}>
<Text style={firstRunStyle.closeButtonText}>x</Text>
<Icon name={'times'} size={16} style={firstRunStyle.closeButtonIcon} />
</TouchableOpacity>
)}
</View>
-95
View File
@@ -1,95 +0,0 @@
// @flow
import { NativeModules } from 'react-native';
import {
ACTIONS,
batchActions,
buildURI,
doResolveUri,
doUpdateSearchQuery,
makeSelectSearchUris,
selectSuggestions,
makeSelectQueryWithOptions,
selectSearchValue,
} from 'lbry-redux';
let CONNECTION_STRING = 'https://lighthouse.lbry.com/';
const handleNativeFetchResponse = str => {
const json = JSON.parse(str);
if (json.error) {
return Promise.reject(new Error(json.error));
}
return Promise.resolve(json);
};
// Use a native asyncTask to call the lighthouse api
export const doNativeSearch = (
rawQuery: string, // pass in a query if you don't want to search for what's in the search bar
size: ?number, // only pass in if you don't want to use the users setting (ex: related content)
from: ?number,
isBackgroundSearch: boolean = false
) => (dispatch: Dispatch, getState: GetState) => {
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
if (!query) {
dispatch({
type: ACTIONS.SEARCH_FAIL,
});
return;
}
const state = getState();
const queryWithOptions = makeSelectQueryWithOptions(query, size, from, isBackgroundSearch)(state);
// If we have already searched for something, we don't need to do anything
const urisForQuery = makeSelectSearchUris(queryWithOptions)(state);
if (urisForQuery && !!urisForQuery.length) {
return;
}
dispatch({
type: ACTIONS.SEARCH_START,
});
// If the user is on the file page with a pre-populated uri and they select
// the search option without typing anything, searchQuery will be empty
// We need to populate it so the input is filled on the search page
// isBackgroundSearch means the search is happening in the background, don't update the search query
if (!state.search.searchQuery && !isBackgroundSearch) {
dispatch(doUpdateSearchQuery(query));
}
const url = `${CONNECTION_STRING}search?${queryWithOptions}`;
NativeModules.Requests.get(url)
.then(handleNativeFetchResponse)
.then((data: Array<{ name: String, claimId: string }>) => {
const uris = [];
const actions = [];
data.forEach(result => {
if (result.name) {
const uri = buildURI({
claimName: result.name,
claimId: result.claimId,
});
actions.push(doResolveUri(uri));
uris.push(uri);
}
});
actions.push({
type: ACTIONS.SEARCH_SUCCESS,
data: {
query: queryWithOptions,
uris,
},
});
dispatch(batchActions(...actions));
})
.catch(e => {
dispatch({
type: ACTIONS.SEARCH_FAIL,
});
});
};
+11
View File
@@ -38,3 +38,14 @@ export function doSetTimeItem(item) {
});
};
}
export function doToggleFullscreenMode(mode) {
return dispatch => {
dispatch({
type: Constants.ACTION_FULLSCREEN_MODE_TOGGLED,
data: {
mode,
},
});
};
}
+6
View File
@@ -6,6 +6,7 @@ const defaultState = {
clientSettings: {},
sortByItemName: Constants.SORT_BY_HOT,
timeItemName: Constants.TIME_WEEK,
fullscreenMode: false,
};
reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
@@ -29,6 +30,11 @@ reducers[Constants.ACTION_TIME_ITEM_CHANGED] = (state, action) =>
timeItemName: action.data.name,
});
reducers[Constants.ACTION_FULLSCREEN_MODE_TOGGLED] = (state, action) =>
Object.assign({}, state, {
fullscreenMode: action.data.mode,
});
export default function reducer(state = defaultState, action) {
const handler = reducers[action.type];
if (handler) return handler(state, action);
+5
View File
@@ -34,3 +34,8 @@ export const makeSelectClientSetting = setting =>
export const selectShowNsfw = makeSelectClientSetting(SETTINGS.SHOW_NSFW);
export const selectKeepDaemonRunning = makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING);
export const selectFullscreenMode = createSelector(
selectState,
state => state.fullscreenMode
);
+36
View File
@@ -402,6 +402,42 @@ const filePageStyle = StyleSheet.create({
marginTop: 12,
marginBottom: 12,
},
unsupportedContent: {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 16,
padding: 24,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: Colors.White,
},
unspportedContentTextContainer: {
flex: 1,
},
unsupportedContentFilename: {
color: Colors.LbryGreen,
fontFamily: 'Inter-UI-SemiBold',
fontSize: 16,
},
unsupportedContentImage: {
width: 64,
height: 80,
marginRight: 24,
},
unsupportedContentTitle: {
fontFamily: 'Inter-UI-Regular',
fontSize: 20,
},
unsupportedContentText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
marginTop: 4,
},
relatedLoading: {
marginTop: 16,
},
});
export default filePageStyle;
+4
View File
@@ -153,6 +153,10 @@ const firstRunStyle = StyleSheet.create({
color: Colors.White,
fontSize: 16,
},
closeButtonIcon: {
alignSelf: 'center',
color: Colors.White,
},
buttonContainer: {
flexDirection: 'row',
alignItems: 'center',
+16 -4
View File
@@ -35,12 +35,24 @@ const searchStyle = StyleSheet.create({
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
paddingTop: 8,
paddingBottom: 8,
paddingLeft: 8,
paddingRight: 8,
padding: 8,
backgroundColor: Colors.Black,
},
tagResultItem: {
flex: 1,
padding: 16,
backgroundColor: Colors.DarkerGrey,
},
tagResultTitle: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 24,
color: Colors.White,
},
tagResultDescription: {
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
color: Colors.VeryLightGrey,
},
searchInput: {
width: '100%',
height: '100%',
+25 -20
View File
@@ -6,32 +6,37 @@ import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslin
const tagNameLength = 10;
const specialRouteMap = {
about: Constants.DRAWER_ROUTE_ABOUT,
allContent: Constants.DRAWER_ROUTE_TRENDING,
channels: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
library: Constants.DRAWER_ROUTE_MY_LBRY,
publish: Constants.DRAWER_ROUTE_PUBLISH,
publishes: Constants.DRAWER_ROUTE_PUBLISHES,
rewards: Constants.DRAWER_ROUTE_REWARDS,
settings: Constants.DRAWER_ROUTE_SETTINGS,
subscriptions: Constants.DRAWER_ROUTE_SUBSCRIPTIONS,
wallet: Constants.FULL_ROUTE_NAME_WALLET,
discover: Constants.FULL_ROUTE_NAME_DISCOVER,
};
function getRouteForSpecialUri(uri) {
let targetRoute;
const page = uri.substring(8).trim(); // 'lbry://?'.length == 8
switch (page) {
case Constants.PAGE_REWARDS:
targetRoute = Constants.DRAWER_ROUTE_REWARDS;
break;
case Constants.PAGE_SETTINGS:
targetRoute = Constants.DRAWER_ROUTE_SETTINGS;
break;
case Constants.PAGE_TRENDING:
targetRoute = Constants.DRAWER_ROUTE_TRENDING;
break;
case Constants.PAGE_WALLET:
targetRoute = Constants.FULL_ROUTE_NAME_WALLET;
break;
default:
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
break;
if (specialRouteMap[page]) {
targetRoute = specialRouteMap[page];
}
if (!targetRoute) {
// default to the home page if there is no match for the page
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
}
return targetRoute;
}
export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack) {
export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack, fullUri) {
if (uri.startsWith('lbry://?')) {
dispatch(NavigationActions.navigate({ routeName: getRouteForSpecialUri(uri) }));
return;
@@ -45,7 +50,7 @@ export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack) {
uriVars = parseUriVars(uriVarsStr);
}
const params = { uri, uriVars };
const params = { uri, uriVars, fullUri: fullUri };
if (!isNavigatingBack) {
dispatch(doPushDrawerStack(uri));
@@ -108,7 +113,7 @@ function parseUriVars(vars) {
return uriVars;
}
export function navigateToUri(navigation, uri, additionalParams, isNavigatingBack) {
export function navigateToUri(navigation, uri, additionalParams, isNavigatingBack, fullUri) {
if (!navigation) {
return;
}
@@ -131,7 +136,7 @@ export function navigateToUri(navigation, uri, additionalParams, isNavigatingBac
}
const { store } = window;
const params = Object.assign({ uri, uriVars }, additionalParams);
const params = Object.assign({ uri, uriVars, fullUri: fullUri }, additionalParams);
if (navigation.state.routeName === 'File') {
const stackAction = StackActions.replace({ routeName: 'File', newKey: uri, params });
navigation.dispatch(stackAction);