Compare commits
5
Commits
special-routes
..
rc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f4cca90e3 | ||
|
|
e496388b8f | ||
|
|
c1b1469703 | ||
|
|
fc1ef26a17 | ||
|
|
ba72be002a |
No files matched your search
@@ -27,15 +27,7 @@ import {
|
||||
createNavigationReducer,
|
||||
} from 'react-navigation-redux-helpers';
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
AppState,
|
||||
BackHandler,
|
||||
DeviceEventEmitter,
|
||||
Linking,
|
||||
NativeModules,
|
||||
TextInput,
|
||||
ToastAndroid,
|
||||
} from 'react-native';
|
||||
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
|
||||
import {
|
||||
|
||||
@@ -66,9 +66,7 @@ class FileItem extends React.PureComponent {
|
||||
|
||||
let shouldHide = false;
|
||||
if (blackListedOutpoints || filteredOutpoints) {
|
||||
const outpointsToHide = !blackListedOutpoints
|
||||
? filteredOutpoints
|
||||
: blackListedOutpoints.concat(filteredOutpoints);
|
||||
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
|
||||
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||
}
|
||||
if (shouldHide) {
|
||||
|
||||
@@ -120,9 +120,7 @@ class FileListItem extends React.PureComponent {
|
||||
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||
|
||||
if (blackListedOutpoints || filteredOutpoints) {
|
||||
const outpointsToHide = !blackListedOutpoints
|
||||
? filteredOutpoints
|
||||
: blackListedOutpoints.concat(filteredOutpoints);
|
||||
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
|
||||
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,7 @@ 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 && this.state.addressValid;
|
||||
const canSend = this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.card}>
|
||||
@@ -95,7 +94,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}
|
||||
|
||||
+1
-24
@@ -6,7 +6,6 @@ import {
|
||||
Alert,
|
||||
DeviceEventEmitter,
|
||||
Dimensions,
|
||||
Image,
|
||||
Linking,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
@@ -740,7 +739,6 @@ 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') {
|
||||
@@ -811,30 +809,9 @@ class FilePage extends React.PureComponent {
|
||||
thumbnail={thumbnail}
|
||||
/>
|
||||
)}
|
||||
{!unsupported &&
|
||||
(!this.state.downloadButtonShown || this.state.downloadPressed) &&
|
||||
!this.state.mediaLoaded && (
|
||||
{(!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)) &&
|
||||
|
||||
@@ -142,7 +142,7 @@ class SearchPage extends React.PureComponent {
|
||||
<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.tagResultTitle}>#{query}</Text>
|
||||
<Text style={searchStyle.tagResultDescription}>Explore content for this tag</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
@@ -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: tag.toLowerCase() } });
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_TAG, key: `tagPage`, params: { tag } });
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -140,7 +140,7 @@ class SettingsPage extends React.PureComponent {
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Content Interests')}</Text>
|
||||
<Text style={settingsStyle.label}>{__('Tags you follow')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
|
||||
+16
-43
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Lbry, doPreferenceGet } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { ActivityIndicator, DeviceEventEmitter, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
||||
import { ActivityIndicator, 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,10 +52,7 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
navigation.dispatch(resetAction);
|
||||
|
||||
const launchUrl =
|
||||
navigation.state.params && navigation.state.params.launchUrl
|
||||
? navigation.state.params.launchUrl
|
||||
: this.state.launchUrl;
|
||||
const launchUrl = navigation.state.params ? navigation.state.params.launchUrl : this.state.launchUrl;
|
||||
if (launchUrl) {
|
||||
if (launchUrl.startsWith('lbry://?verify=')) {
|
||||
let verification = {};
|
||||
@@ -121,12 +118,6 @@ class SplashScreen extends React.PureComponent {
|
||||
);
|
||||
};
|
||||
|
||||
onNotificationTargetLaunch = evt => {
|
||||
if (evt.url && evt.url.startsWith('lbry://')) {
|
||||
this.setState({ launchUrl: evt.url });
|
||||
}
|
||||
};
|
||||
|
||||
finishSplashScreen = () => {
|
||||
const {
|
||||
authenticate,
|
||||
@@ -158,10 +149,7 @@ class SplashScreen extends React.PureComponent {
|
||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||
this.setState({ shouldAuthenticate: true });
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => {
|
||||
console.log(firebaseToken);
|
||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||
})
|
||||
.then(firebaseToken => authenticate(appVersion, Platform.OS, firebaseToken))
|
||||
.catch(() => authenticate(appVersion, Platform.OS));
|
||||
});
|
||||
}
|
||||
@@ -262,14 +250,6 @@ 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');
|
||||
@@ -279,26 +259,6 @@ 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
|
||||
@@ -310,6 +270,19 @@ 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 = () => {
|
||||
|
||||
@@ -402,39 +402,6 @@ 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;
|
||||
+16
-21
@@ -6,31 +6,26 @@ 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
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
return targetRoute;
|
||||
|
||||
Reference in new issue
Block a user