diff --git a/src/component/AppNavigator.js b/src/component/AppNavigator.js index 812f89b..e335cba 100644 --- a/src/component/AppNavigator.js +++ b/src/component/AppNavigator.js @@ -27,7 +27,15 @@ 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, + TextInput, + ToastAndroid, +} from 'react-native'; import { selectDrawerStack } from 'redux/selectors/drawer'; import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux'; import { diff --git a/src/component/fileItem/view.js b/src/component/fileItem/view.js index cf2db92..6e5235d 100644 --- a/src/component/fileItem/view.js +++ b/src/component/fileItem/view.js @@ -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) { diff --git a/src/component/fileListItem/view.js b/src/component/fileListItem/view.js index c2faa83..48f2c4d 100644 --- a/src/component/fileListItem/view.js +++ b/src/component/fileListItem/view.js @@ -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); } diff --git a/src/component/suggestedSubscriptionItem/view.js b/src/component/suggestedSubscriptionItem/view.js index aa22439..35b60a1 100644 --- a/src/component/suggestedSubscriptionItem/view.js +++ b/src/component/suggestedSubscriptionItem/view.js @@ -72,7 +72,9 @@ class SuggestedSubscriptionItem extends React.PureComponent { )} - + {claim && ( + + )} ); } diff --git a/src/component/walletSend/view.js b/src/component/walletSend/view.js index f1d33ae..e06e25b 100644 --- a/src/component/walletSend/view.js +++ b/src/component/walletSend/view.js @@ -82,7 +82,8 @@ class WalletSend extends React.PureComponent { 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 ( @@ -94,7 +95,7 @@ class WalletSend extends React.PureComponent { 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} diff --git a/src/page/file/view.js b/src/page/file/view.js index 0318d8e..dcf4d5e 100644 --- a/src/page/file/view.js +++ b/src/page/file/view.js @@ -6,6 +6,7 @@ import { Alert, DeviceEventEmitter, Dimensions, + Image, Linking, NativeModules, ScrollView, @@ -739,6 +740,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,9 +811,30 @@ 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 && ( )} + + {unsupported && fileInfo && completed && ( + + + + Unsupported Content + + Sorry, we are unable to display this content in the app. You can find the file named{' '} + {fileInfo.file_name} in your + downloads folder. + + + + )} + {((isPlayable && !completed && !canLoadMedia) || canOpen || (!completed && !this.state.streamingMode)) && diff --git a/src/page/search/view.js b/src/page/search/view.js index 1f5a8f4..f1260d5 100644 --- a/src/page/search/view.js +++ b/src/page/search/view.js @@ -142,7 +142,7 @@ class SearchPage extends React.PureComponent { {showTagResult && ( this.handleTagResultPressed(query)}> - #{query} + #{query.toLowerCase()} Explore content for this tag )} @@ -152,7 +152,7 @@ class SearchPage extends React.PureComponent { handleTagResultPressed = tag => { const { navigation } = this.props; - navigation.navigate({ routeName: Constants.DRAWER_ROUTE_TAG, key: `tagPage`, params: { tag } }); + navigation.navigate({ routeName: Constants.DRAWER_ROUTE_TAG, key: `tagPage`, params: { tag: tag.toLowerCase() } }); }; render() { diff --git a/src/page/settings/view.js b/src/page/settings/view.js index ffeb6fe..7272461 100644 --- a/src/page/settings/view.js +++ b/src/page/settings/view.js @@ -140,7 +140,7 @@ class SettingsPage extends React.PureComponent { - {__('Tags you follow')} + {__('Content Interests')} { const { authenticate, @@ -149,7 +158,10 @@ 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 => { + console.log(firebaseToken); + authenticate(appVersion, Platform.OS, firebaseToken); + }) .catch(() => authenticate(appVersion, Platform.OS)); }); } @@ -250,6 +262,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 +279,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 +310,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 = () => { diff --git a/src/styles/filePage.js b/src/styles/filePage.js index 6f15861..58d71eb 100644 --- a/src/styles/filePage.js +++ b/src/styles/filePage.js @@ -402,6 +402,39 @@ 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, + }, }); export default filePageStyle;