diff --git a/app/src/component/fileListItem/view.js b/app/src/component/fileListItem/view.js index 2db2fd9b..00f89914 100644 --- a/app/src/component/fileListItem/view.js +++ b/app/src/component/fileListItem/view.js @@ -51,7 +51,6 @@ class FileListItem extends React.PureComponent { claim, fileInfo, metadata, - featuredResult, isResolvingUri, isDownloaded, style, @@ -73,10 +72,6 @@ class FileListItem extends React.PureComponent { fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel; } - if (featuredResult && !isResolvingUri && !claim && !title && !name) { - return null; - } - return ( @@ -86,17 +81,15 @@ class FileListItem extends React.PureComponent { title={(title || name)} thumbnail={metadata ? metadata.thumbnail : null} /> - {featuredResult && {uri}} - {!title && !name && !channel && isResolving && ( {(!title && !name) && {uri}} {(!title && !name) && - + } )} - {(title || name) && {this.formatTitle(title) || this.formatTitle(name)}} + {(title || name) && {this.formatTitle(title) || this.formatTitle(name)}} {channel && { navigateToUri(navigation, normalizeURI(fullChannelUri)); diff --git a/app/src/component/uriBar/view.js b/app/src/component/uriBar/view.js index 4cea8a3a..2313203d 100644 --- a/app/src/component/uriBar/view.js +++ b/app/src/component/uriBar/view.js @@ -32,29 +32,17 @@ class UriBar extends React.PureComponent { changeTextTimeout: null, currentValue: null, inputText: null, - focused: false, - // TODO: Add a setting to enable / disable direct search? - directSearch: true + focused: false }; } handleChangeText = text => { const newValue = text ? text : ''; clearTimeout(this.state.changeTextTimeout); - const { updateSearchQuery, onSearchSubmitted, navigation } = this.props; + const { updateSearchQuery } = this.props; let timeout = setTimeout(() => { updateSearchQuery(text); - - if (!text.startsWith('lbry://')) { - // not a URI input, so this is a search, perform a direct search - if (onSearchSubmitted) { - onSearchSubmitted(text); - } else { - navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text }}); - } - } - }, UriBar.INPUT_TIMEOUT); this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout }); } @@ -153,7 +141,7 @@ class UriBar extends React.PureComponent { } }}/> - {(this.state.focused && !this.state.directSearch) && ( + {this.state.focused && ( } {!fileInfo && } - {canLoadMedia && fileInfo && { this.playerBackground = ref; }} - onLayout={(evt) => { - if (!this.state.playerBgHeight) { - this.setState({ playerBgHeight: evt.nativeEvent.layout.height }); - } - }} />} - {canLoadMedia && fileInfo && { this.player = ref; }} - uri={uri} - style={playerStyle} - autoPlay={autoplay || this.state.autoPlayMedia} - onFullscreenToggled={this.handleFullscreenToggle} - onLayout={(evt) => { - if (!this.state.playerHeight) { - this.setState({ playerHeight: evt.nativeEvent.layout.height }); - } - }} - onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)} - onPlaybackStarted={this.onPlaybackStarted} - onPlaybackFinished={this.onPlaybackFinished} - thumbnail={metadata.thumbnail} - />} + {(canLoadMedia && fileInfo && isPlayable) && + { this.playerBackground = ref; }} + onLayout={(evt) => { + if (!this.state.playerBgHeight) { + this.setState({ playerBgHeight: evt.nativeEvent.layout.height }); + } + }} />} + {(canLoadMedia && fileInfo && isPlayable) && + { this.player = ref; }} + uri={uri} + style={playerStyle} + autoPlay={autoplay || this.state.autoPlayMedia} + onFullscreenToggled={this.handleFullscreenToggle} + onLayout={(evt) => { + if (!this.state.playerHeight) { + this.setState({ playerHeight: evt.nativeEvent.layout.height }); + } + }} + onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)} + onPlaybackStarted={this.onPlaybackStarted} + onPlaybackFinished={this.onPlaybackFinished} + thumbnail={metadata.thumbnail} + />} {showActions && diff --git a/app/src/page/search/view.js b/app/src/page/search/view.js index 56eb00ee..41a1bf35 100644 --- a/app/src/page/search/view.js +++ b/app/src/page/search/view.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Lbry, parseURI, normalizeURI, isURIValid } from 'lbry-redux'; +import { Lbry } from 'lbry-redux'; import { ActivityIndicator, Button, @@ -8,19 +8,15 @@ import { View, ScrollView } from 'react-native'; -import { navigateToUri } from 'utils/helper'; -import Colors from 'styles/colors'; -import PageHeader from 'component/pageHeader'; -import FileListItem from 'component/fileListItem'; -import FloatingWalletBalance from 'component/floatingWalletBalance'; -import UriBar from 'component/uriBar'; -import searchStyle from 'styles/search'; +import { navigateToUri } from '../../utils/helper'; +import Colors from '../../styles/colors'; +import PageHeader from '../../component/pageHeader'; +import FileListItem from '../../component/fileListItem'; +import FloatingWalletBalance from '../../component/floatingWalletBalance'; +import UriBar from '../../component/uriBar'; +import searchStyle from '../../styles/search'; class SearchPage extends React.PureComponent { - state = { - currentUri: null - } - static navigationOptions = { title: 'Search Results' }; @@ -33,38 +29,22 @@ class SearchPage extends React.PureComponent { const { navigation, search } = this.props; const { searchQuery } = navigation.state.params; if (searchQuery && searchQuery.trim().length > 0) { - this.setState({ currentUri: (isURIValid(searchQuery)) ? normalizeURI(searchQuery) : null }) search(searchQuery); } } - handleSearchSubmitted = (keywords) => { - const { search } = this.props; - this.setState({ currentUri: (isURIValid(keywords)) ? normalizeURI(keywords) : null }); - search(keywords); - } - render() { - const { isSearching, navigation, query, uris } = this.props; + const { isSearching, navigation, query, search, uris } = this.props; const { searchQuery } = navigation.state.params; return ( + onSearchSubmitted={(keywords) => search(keywords)} /> {!isSearching && (!uris || uris.length === 0) && No results to display.} - {this.state.currentUri && - navigateToUri(navigation, this.state.currentUri)} - />} {!isSearching && uris && uris.length ? ( uris.map(uri =>