Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
813be20ce0 | ||
|
|
eac9c0ed65 | ||
|
|
76305a67be | ||
|
|
82345070fb | ||
|
|
56aa0a96a7 | ||
|
|
232cdb3d29 | ||
|
|
61189b817a | ||
|
|
a127e14a0f | ||
|
|
51e3dfcf6a | ||
|
|
5915919560 | ||
|
|
943c5654c1 | ||
|
|
117c23fe3f | ||
|
|
072ad25146 | ||
|
|
f714310681 | ||
|
|
9bc5a1538a | ||
|
|
1458e4f321 | ||
|
|
ed513bcfb5 | ||
|
|
518285355c | ||
|
|
030b94ce01 | ||
|
|
12ca56cb45 | ||
|
|
8eb661171d | ||
|
|
67349b0ef6 | ||
|
|
41fd14e18f | ||
|
|
ce36be2b7b | ||
|
|
b4fc61ada0 | ||
|
|
032b5c26b1 | ||
|
|
871c2c538b | ||
|
|
60f6645515 | ||
|
|
61f0aa5dac | ||
|
|
2c6445c61c | ||
|
|
3239174ddf | ||
|
|
9157b18f45 | ||
|
|
f09269d48a |
No files matched your search
Generated
+4
-4
@@ -5640,8 +5640,8 @@
|
||||
}
|
||||
},
|
||||
"lbry-redux": {
|
||||
"version": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
||||
"from": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
||||
"version": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||
"from": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||
"requires": {
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"reselect": "^3.0.0",
|
||||
@@ -5649,8 +5649,8 @@
|
||||
}
|
||||
},
|
||||
"lbryinc": {
|
||||
"version": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||
"from": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||
"version": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
|
||||
"from": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
|
||||
"requires": {
|
||||
"reselect": "^3.0.0"
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
||||
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||
"lbry-redux": "lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||
"lbryinc": "lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
|
||||
@@ -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 {
|
||||
@@ -214,7 +222,7 @@ const drawer = createDrawerNavigator(
|
||||
},
|
||||
},
|
||||
{
|
||||
drawerWidth: 280,
|
||||
drawerWidth: 300,
|
||||
drawerBackgroundColor: 'transparent',
|
||||
headerMode: 'none',
|
||||
backBehavior: 'none',
|
||||
@@ -297,16 +305,18 @@ class AppWithNavigationState extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { dispatch } = this.props;
|
||||
const { dispatch, user } = this.props;
|
||||
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
||||
Linking.addEventListener('url', this._handleUrl);
|
||||
|
||||
// call /sync/get with interval
|
||||
this.syncGetInterval = setInterval(() => {
|
||||
this.setState({ syncHashChanged: false }); // reset local state
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
|
||||
});
|
||||
if (user && user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
|
||||
});
|
||||
}
|
||||
}, SYNC_GET_INTERVAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ class ChannelRewardsDriver extends React.PureComponent<Props> {
|
||||
return (
|
||||
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
|
||||
<Text style={publishStyle.rewardDriverText}>Earn some credits to be able to create your channel.</Text>
|
||||
<Text style={publishStyle.rewardDriverText}>
|
||||
Channel creation requires credits.{'\n'}Tap here to get some for free.
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchChannelListMine, selectMyChannelClaims } from 'lbry-redux';
|
||||
import { selectUser } from 'lbryinc';
|
||||
import DrawerContent from './view';
|
||||
|
||||
export default connect()(DrawerContent);
|
||||
const select = state => ({
|
||||
channels: selectMyChannelClaims(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(DrawerContent);
|
||||
@@ -1,21 +1,23 @@
|
||||
import React from 'react';
|
||||
import { DrawerItems, SafeAreaView } from 'react-navigation';
|
||||
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { Image, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||
import Button from 'component/button';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import channelIconStyle from 'styles/channelIcon';
|
||||
import discoverStyle from 'styles/discover';
|
||||
|
||||
const groupedMenuItems = {
|
||||
'Find content': [
|
||||
{ icon: 'hashtag', label: 'Your tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
||||
{ icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
||||
{ icon: 'heart', solid: true, label: 'Subscriptions', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
|
||||
{ icon: 'globe-americas', label: 'All content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
{ icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
],
|
||||
'Your content': [
|
||||
{ icon: 'at', label: 'Channels', route: Constants.DRAWER_ROUTE_CHANNEL_CREATOR },
|
||||
{ icon: 'download', label: 'Library', route: Constants.DRAWER_ROUTE_MY_LBRY },
|
||||
{ icon: 'cloud-upload-alt', label: 'Publishes', route: Constants.DRAWER_ROUTE_PUBLISHES },
|
||||
{ icon: 'upload', label: 'New publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
||||
{ icon: 'upload', label: 'New Publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
||||
],
|
||||
Wallet: [
|
||||
{ icon: 'wallet', label: 'Wallet', route: Constants.DRAWER_ROUTE_WALLET },
|
||||
@@ -30,19 +32,100 @@ const groupedMenuItems = {
|
||||
const groupNames = Object.keys(groupedMenuItems);
|
||||
|
||||
class DrawerContent extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
const { fetchChannelListMine } = this.props;
|
||||
fetchChannelListMine();
|
||||
}
|
||||
|
||||
getAvatarImageUrl = () => {
|
||||
const { channels = [] } = this.props;
|
||||
if (channels) {
|
||||
// get the first channel thumbnail found. In the future, allow the user to select a default channel thumbnail?
|
||||
for (let i = 0; i < channels.length; i++) {
|
||||
if (channels[i].value && channels[i].value.thumbnail) {
|
||||
return channels[i].value.thumbnail.url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
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 } });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { activeTintColor, navigation, onItemPress } = this.props;
|
||||
const { activeTintColor, navigation, user, onItemPress } = this.props;
|
||||
const { state } = navigation;
|
||||
|
||||
const activeItemKey = state.routes[state.index] ? state.routes[state.index].key : null;
|
||||
const signedIn = user && user.has_verified_email;
|
||||
const avatarImageUrl = this.getAvatarImageUrl();
|
||||
|
||||
return (
|
||||
<View style={discoverStyle.drawerContentArea}>
|
||||
{false && (
|
||||
<View style={discoverStyle.signInContainer}>
|
||||
{!signedIn && (
|
||||
<Button
|
||||
style={discoverStyle.signInButton}
|
||||
theme={'light'}
|
||||
text={'Sign in'}
|
||||
onPress={this.launchSignInFlow}
|
||||
/>
|
||||
)}
|
||||
{signedIn && (
|
||||
<View style={discoverStyle.signedIn}>
|
||||
<View style={discoverStyle.signedInAvatar}>
|
||||
{avatarImageUrl && (
|
||||
<Image
|
||||
style={discoverStyle.signedInAvatarImage}
|
||||
resizeMode={'cover'}
|
||||
source={{ uri: avatarImageUrl }}
|
||||
/>
|
||||
)}
|
||||
{!avatarImageUrl && (
|
||||
<Text style={channelIconStyle.autothumbCharacter}>
|
||||
{user.primary_email.substring(0, 1).toUpperCase()}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
<Text style={discoverStyle.signedInEmail} numberOfLines={1}>
|
||||
{user.primary_email}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
|
||||
<ScrollView contentContainerStyle={discoverStyle.menuScrollContent}>
|
||||
<SafeAreaView
|
||||
style={discoverStyle.drawerContentContainer}
|
||||
forceInset={{ top: 'always', horizontal: 'never' }}
|
||||
>
|
||||
{!signedIn && (
|
||||
<TouchableOpacity
|
||||
accessible
|
||||
accessibilityLabel={'Sign In'}
|
||||
onPress={this.launchSignInFlow}
|
||||
delayPressIn={0}
|
||||
style={[discoverStyle.signInMenuItem, discoverStyle.signInMenuItemButton]}
|
||||
>
|
||||
<Text style={discoverStyle.signInMenuItemButtonText}>SIGN IN</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{signedIn && (
|
||||
<View style={[discoverStyle.signInMenuItem, discoverStyle.signInMenuItemBorder]}>
|
||||
<Text style={discoverStyle.signInMenuItemText} numberOfLines={1}>
|
||||
{user.primary_email.toUpperCase()}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{groupNames.map(groupName => {
|
||||
const menuItems = groupedMenuItems[groupName];
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ class PublishRewardsDriver extends React.PureComponent<Props> {
|
||||
return (
|
||||
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
|
||||
<Text style={publishStyle.rewardDriverText}>Earn some credits to be able to publish your content.</Text>
|
||||
<Text style={publishStyle.rewardDriverText}>
|
||||
Publishing requires credits.{'\n'}Tap here to get some for free.
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Button from 'component/button';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Link from 'component/link';
|
||||
import Colors from 'styles/colors';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
@@ -24,26 +24,36 @@ class RewardEnrolment extends React.Component {
|
||||
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: false } });
|
||||
};
|
||||
|
||||
onLearnMorePressed = () => {
|
||||
Linking.openURL('https://lbry.com/faq/earn-credits');
|
||||
};
|
||||
|
||||
render() {
|
||||
const { fetching, navigation, unclaimedRewardAmount, user } = this.props;
|
||||
|
||||
return (
|
||||
<View style={rewardStyle.enrollContainer} onPress>
|
||||
<View style={rewardStyle.enrollContainer}>
|
||||
<View style={rewardStyle.summaryRow}>
|
||||
<Icon name="award" size={36} color={Colors.White} />
|
||||
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} unclaimed credits</Text>
|
||||
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} available credits</Text>
|
||||
</View>
|
||||
|
||||
<View style={rewardStyle.onboarding}>
|
||||
<Text style={rewardStyle.enrollDescText}>
|
||||
LBRY credits allow you to purchase content, publish content, and influence the network. You can start
|
||||
earning credits by watching videos on LBRY.
|
||||
LBRY credits allow you to purchase content, publish content, and influence the network.{'\n\n'}
|
||||
You get credits for free for providing an email address and taking other basic actions.{'\n\n'}
|
||||
<Link style={rewardStyle.learnMoreLink} text={'Learn more'} onPress={this.onLearnMorePressed} />.
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={rewardStyle.buttonRow}>
|
||||
<Link style={rewardStyle.notInterestedLink} text={'Not interested'} onPress={this.onNotInterestedPressed} />
|
||||
<Button style={rewardStyle.enrollButton} theme={'light'} text={'Enroll'} onPress={this.onEnrollPressed} />
|
||||
<Button
|
||||
style={rewardStyle.enrollButton}
|
||||
theme={'light'}
|
||||
text={'Get started'}
|
||||
onPress={this.onEnrollPressed}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ class RewardSummary extends React.Component {
|
||||
this.props.fetchRewards();
|
||||
|
||||
AsyncStorage.getItem(RewardSummary.itemKey).then(isDismissed => {
|
||||
if ('true' === isDismissed) {
|
||||
if (isDismissed === 'true') {
|
||||
this.setState({ dismissed: true });
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class RewardSummary extends React.Component {
|
||||
<TouchableOpacity style={rewardStyle.summaryContainer} onPress={this.handleSummaryPressed}>
|
||||
<View style={rewardStyle.summaryRow}>
|
||||
<Icon name="award" size={36} color={Colors.White} />
|
||||
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} unclaimed credits</Text>
|
||||
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} available credits</Text>
|
||||
</View>
|
||||
<Button style={rewardStyle.dismissButton} theme={'light'} text={'Dismiss'} onPress={this.onDismissPressed} />
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnclaimedRewardValue } from 'lbryinc';
|
||||
import WalletRewardsDriver from './view';
|
||||
|
||||
export default connect()(WalletRewardsDriver);
|
||||
const select = state => ({
|
||||
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
|
||||
});
|
||||
|
||||
export default connect(select)(WalletRewardsDriver);
|
||||
@@ -5,12 +5,15 @@ import walletStyle from 'styles/wallet';
|
||||
|
||||
class WalletRewardsDriver extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { navigation } = this.props;
|
||||
const { navigation, unclaimedRewardAmount } = this.props;
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
|
||||
<Text style={walletStyle.rewardDriverText}>Earn credits while using the LBRY app.</Text>
|
||||
<Text style={walletStyle.rewardDriverText}>
|
||||
Get {unclaimedRewardAmount > 0 ? unclaimedRewardAmount : ''} free credit
|
||||
{unclaimedRewardAmount === 1 ? '' : 's'} after creating an account.
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doToast } from 'lbry-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectUser } from 'lbryinc';
|
||||
import WalletSignIn from './view';
|
||||
|
||||
const select = state => ({
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(WalletSignIn);
|
||||
@@ -0,0 +1,48 @@
|
||||
import React from 'react';
|
||||
import { Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Button from 'component/button';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Link from 'component/link';
|
||||
import Colors from 'styles/colors';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import walletStyle from 'styles/wallet';
|
||||
|
||||
class WalletSignIn extends React.Component {
|
||||
onContinuePressed = () => {
|
||||
const { navigation, setClientSetting } = this.props;
|
||||
setClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS, true);
|
||||
};
|
||||
|
||||
onSignInPressed = () => {
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { navigation, user } = this.props;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.signInContainer}>
|
||||
<View style={walletStyle.signInSummaryRow}>
|
||||
<Text style={walletStyle.signInTitle}>Account Recommended</Text>
|
||||
</View>
|
||||
|
||||
<View style={walletStyle.onboarding}>
|
||||
<Text style={walletStyle.onboardingText}>
|
||||
An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced..
|
||||
{'\n\n'}
|
||||
Without an account, you assume all responsibility for securing your wallet and LBRY data.{'\n\n'}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={walletStyle.buttonRow}>
|
||||
<Link style={walletStyle.continueLink} text={'Skip Account'} onPress={this.onContinuePressed} />
|
||||
<Button style={walletStyle.signInButton} theme={'light'} text={'Sign Up'} onPress={this.onSignInPressed} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default WalletSignIn;
|
||||
@@ -140,6 +140,8 @@ const Constants = {
|
||||
TRUE_STRING: 'true',
|
||||
|
||||
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
||||
|
||||
SHARE_BASE_URL: 'https://open.lbry.com',
|
||||
};
|
||||
|
||||
export default Constants;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from 'react-native';
|
||||
import { TabView, SceneMap } from 'react-native-tab-view';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import { navigateBack, getOrderBy } from 'utils/helper';
|
||||
import { navigateBack, getOrderBy, formatLbryUrlForWeb } from 'utils/helper';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Colors from 'styles/colors';
|
||||
@@ -172,6 +172,15 @@ class ChannelPage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
onSharePressed = () => {
|
||||
const { claim } = this.props;
|
||||
if (claim) {
|
||||
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
||||
const url = Constants.SHARE_BASE_URL + formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||
NativeModules.UtilityModule.shareUrl(url);
|
||||
}
|
||||
};
|
||||
|
||||
onDeletePressed = () => {
|
||||
const { abandonClaim, claim, navigation } = this.props;
|
||||
if (claim) {
|
||||
@@ -274,6 +283,12 @@ class ChannelPage extends React.PureComponent {
|
||||
onPress={this.onDeletePressed}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
style={[channelPageStyle.actionButton, channelPageStyle.shareButton]}
|
||||
theme={'light'}
|
||||
icon={'share-alt'}
|
||||
onPress={this.onSharePressed}
|
||||
/>
|
||||
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
||||
{!ownedChannel && (
|
||||
<SubscribeNotificationButton
|
||||
|
||||
+26
-8
@@ -6,6 +6,7 @@ import {
|
||||
Alert,
|
||||
DeviceEventEmitter,
|
||||
Dimensions,
|
||||
Image,
|
||||
Linking,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
@@ -19,7 +20,7 @@ import {
|
||||
WebView,
|
||||
} from 'react-native';
|
||||
import { NavigationEvents } from 'react-navigation';
|
||||
import { navigateBack, navigateToUri } from 'utils/helper';
|
||||
import { navigateBack, navigateToUri, formatLbryUrlForWeb } from 'utils/helper';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||
import Button from 'component/button';
|
||||
@@ -508,16 +509,11 @@ class FilePage extends React.PureComponent {
|
||||
this.setState({ fileViewLogged: true });
|
||||
};
|
||||
|
||||
// TODO: Move this to lbry-redux
|
||||
formatLbryUrlForWeb = url => {
|
||||
return url.replace('lbry://', '/').replace(/#/g, ':');
|
||||
};
|
||||
|
||||
handleSharePress = () => {
|
||||
const { claim, notify } = this.props;
|
||||
if (claim) {
|
||||
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
||||
const url = 'https://open.lbry.com' + this.formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||
const url = Constants.SHARE_BASE_URL + formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||
NativeModules.UtilityModule.shareUrl(url);
|
||||
}
|
||||
};
|
||||
@@ -744,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') {
|
||||
@@ -814,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 && (
|
||||
<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)) &&
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-na
|
||||
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 Link from 'component/link';
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
|
||||
class WelcomePage extends React.PureComponent {
|
||||
@@ -106,6 +107,11 @@ class WelcomePage extends React.PureComponent {
|
||||
LBRY is a community-controlled content platform where you can find and publish videos, music, books, and
|
||||
more.
|
||||
</Text>
|
||||
<Text style={[firstRunStyle.infoParagraph, firstRunStyle.tosParagraph]}>
|
||||
By continuing, I agree to the{' '}
|
||||
<Link style={firstRunStyle.tosLink} text={'Terms of Service'} href={'https://lbry.com/termsofservice'} />{' '}
|
||||
and confirm I am over the age of 13.
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import {
|
||||
doToast,
|
||||
doUpdatePublishForm,
|
||||
selectBalance,
|
||||
selectMyClaims,
|
||||
selectPublishFormValues,
|
||||
} from 'lbry-redux';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { doUpdatePublishFormState, doClearPublishFormState } from 'redux/actions/form';
|
||||
import { doUpdatePublishFormState, doClearPublishFormState, doPendingPublishSuccess } from 'redux/actions/form';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -18,6 +19,7 @@ const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
hasFormState: selectHasPublishFormState(state),
|
||||
myClaims: selectMyClaims(state),
|
||||
publishFormState: selectPublishFormState(state),
|
||||
publishFormValues: selectPublishFormValues(state),
|
||||
});
|
||||
@@ -25,6 +27,7 @@ const select = state => ({
|
||||
const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
clearPublishFormState: () => dispatch(doClearPublishFormState()),
|
||||
pendingPublishSuccess: pendingClaim => dispatch(doPendingPublishSuccess(pendingClaim)),
|
||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
|
||||
publish: (success, fail) => dispatch(doPublish(success, fail)),
|
||||
|
||||
@@ -17,10 +17,12 @@ import {
|
||||
import { FlatGrid } from 'react-native-super-grid';
|
||||
import {
|
||||
isNameValid,
|
||||
batchActions,
|
||||
buildURI,
|
||||
normalizeURI,
|
||||
parseURI,
|
||||
regexInvalidURI,
|
||||
ACTIONS,
|
||||
CLAIM_VALUES,
|
||||
LICENSES,
|
||||
MATURE_TAGS,
|
||||
@@ -394,11 +396,11 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
handlePublishSuccess = data => {
|
||||
const { clearPublishFormState, navigation, notify } = this.props;
|
||||
const { clearPublishFormState, navigation, notify, pendingPublishSuccess } = this.props;
|
||||
const pendingClaim = data.outputs[0];
|
||||
logPublish(pendingClaim);
|
||||
|
||||
// TODO: fake temp claim for claim_list_mine
|
||||
pendingPublishSuccess(pendingClaim);
|
||||
|
||||
notify({
|
||||
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
|
||||
|
||||
@@ -3,7 +3,9 @@ import {
|
||||
doAbandonClaim,
|
||||
doCheckPendingPublishes,
|
||||
doFetchClaimListMine,
|
||||
doToast,
|
||||
selectMyClaimUrisWithoutChannels,
|
||||
selectPendingClaims,
|
||||
selectIsFetchingClaimListMine,
|
||||
} from 'lbry-redux';
|
||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
@@ -13,12 +15,14 @@ import PublishesPage from './view';
|
||||
const select = state => ({
|
||||
uris: selectMyClaimUrisWithoutChannels(state),
|
||||
fetching: selectIsFetchingClaimListMine(state),
|
||||
pendingClaims: selectPendingClaims(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_PUBLISHES)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
});
|
||||
|
||||
@@ -54,6 +54,8 @@ class PublishesPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
addOrRemoveItem = (uri, claim) => {
|
||||
const { pendingClaims } = this.state;
|
||||
|
||||
const { selectedClaimsMap } = this.state;
|
||||
let selectedUris = [...this.state.selectedUris];
|
||||
|
||||
@@ -172,8 +174,15 @@ class PublishesPage extends React.PureComponent {
|
||||
if (selectionMode) {
|
||||
this.handleSelectItem(item, claim);
|
||||
} else {
|
||||
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
||||
navigateToUri(navigation, item);
|
||||
const { notify, pendingClaims } = this.props;
|
||||
if (pendingClaims.some(pendingClaim => pendingClaim.claim_id === claim.claim_id)) {
|
||||
notify({
|
||||
message: __('This content is currently pending. It will be available in a few minutes.'),
|
||||
});
|
||||
} else {
|
||||
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
||||
navigateToUri(navigation, item);
|
||||
}
|
||||
}
|
||||
}}
|
||||
onLongPress={claim => this.handleItemLongPress(item, claim)}
|
||||
|
||||
@@ -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
@@ -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} />
|
||||
)}
|
||||
|
||||
@@ -14,6 +14,10 @@ const select = state => ({
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||
receiveSubscriptionNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS)(state),
|
||||
receiveRewardNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS)(state),
|
||||
receiveInterestsNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS)(state),
|
||||
receiveCreatorNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
||||
import { navigateBack } from 'utils/helper';
|
||||
import { __, navigateBack } from 'utils/helper';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import PageHeader from 'component/pageHeader';
|
||||
import settingsStyle from 'styles/settings';
|
||||
@@ -43,6 +43,16 @@ class SettingsPage extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
setNativeBooleanSetting = (key, value) => {
|
||||
const { setClientSetting } = this.props;
|
||||
setClientSetting(key, value);
|
||||
NativeModules.UtilityModule.setNativeBooleanSetting(key, value);
|
||||
};
|
||||
|
||||
getBooleanSetting = (value, defaultValue) => {
|
||||
return value === null || value === undefined ? defaultValue : value;
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
backgroundPlayEnabled,
|
||||
@@ -50,14 +60,21 @@ class SettingsPage extends React.PureComponent {
|
||||
keepDaemonRunning,
|
||||
navigation,
|
||||
popDrawerStack,
|
||||
receiveSubscriptionNotifications,
|
||||
receiveRewardNotifications,
|
||||
receiveInterestsNotifications,
|
||||
receiveCreatorNotifications,
|
||||
showNsfw,
|
||||
showUriBarSuggestions,
|
||||
setClientSetting,
|
||||
} = this.props;
|
||||
|
||||
// default to true if the setting is null or undefined
|
||||
const actualKeepDaemonRunning =
|
||||
keepDaemonRunning === null || keepDaemonRunning === undefined ? true : keepDaemonRunning;
|
||||
const actualKeepDaemonRunning = this.getBooleanSetting(keepDaemonRunning, true);
|
||||
const actualReceiveSubscriptionNotifications = this.getBooleanSetting(receiveSubscriptionNotifications, true);
|
||||
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
|
||||
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
|
||||
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
|
||||
|
||||
return (
|
||||
<View style={settingsStyle.container}>
|
||||
@@ -88,6 +105,69 @@ class SettingsPage extends React.PureComponent {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.sectionDivider} />
|
||||
<Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text>
|
||||
<Text style={settingsStyle.sectionDescription}>
|
||||
{__('Choose the notifications you would like to receive.')}
|
||||
</Text>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Subscriptions')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveSubscriptionNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Rewards')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveRewardNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Content Interests')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveInterestsNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{false && (
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Content creator tips')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveCreatorNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View style={settingsStyle.sectionDivider} />
|
||||
<Text style={settingsStyle.sectionTitle}>Search</Text>
|
||||
<View style={settingsStyle.row}>
|
||||
|
||||
+51
-20
@@ -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 = {};
|
||||
@@ -91,8 +94,10 @@ class SplashScreen extends React.PureComponent {
|
||||
// user is authenticated, navigate to the main view
|
||||
if (user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => this.getUserSettings());
|
||||
this.navigateToMain();
|
||||
getSync(walletPassword, () => {
|
||||
this.getUserSettings();
|
||||
this.navigateToMain();
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -116,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,
|
||||
@@ -138,14 +149,19 @@ class SplashScreen extends React.PureComponent {
|
||||
if (user && user.id && user.has_verified_email) {
|
||||
// user already authenticated
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => this.getUserSettings());
|
||||
this.navigateToMain();
|
||||
getSync(walletPassword, () => {
|
||||
this.getUserSettings();
|
||||
this.navigateToMain();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
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));
|
||||
});
|
||||
}
|
||||
@@ -246,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');
|
||||
@@ -255,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
|
||||
@@ -266,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 = () => {
|
||||
|
||||
+6
-23
@@ -5,6 +5,7 @@ import WalletAddress from 'component/walletAddress';
|
||||
import WalletBalance from 'component/walletBalance';
|
||||
import WalletSend from 'component/walletSend';
|
||||
import WalletRewardsDriver from 'component/walletRewardsDriver';
|
||||
import WalletSignIn from 'component/walletSignIn';
|
||||
import WalletSyncDriver from 'component/walletSyncDriver';
|
||||
import Button from 'component/button';
|
||||
import Link from 'component/link';
|
||||
@@ -66,33 +67,15 @@ class WalletPage extends React.PureComponent {
|
||||
understandsRisks,
|
||||
setClientSetting,
|
||||
navigation,
|
||||
user,
|
||||
} = this.props;
|
||||
|
||||
if (!understandsRisks) {
|
||||
const signedIn = user && user.has_verified_email;
|
||||
if (!signedIn && !understandsRisks) {
|
||||
return (
|
||||
<View>
|
||||
<View style={walletStyle.container}>
|
||||
<UriBar navigation={navigation} />
|
||||
<View style={walletStyle.warning}>
|
||||
<Text style={walletStyle.warningParagraph}>
|
||||
This is beta software. You may lose any credits that you send to your wallet due to software bugs, deleted
|
||||
files, or malicious third-party software. You should not use this wallet as your primary wallet.
|
||||
</Text>
|
||||
{!hasSyncedWallet && (
|
||||
<Text style={walletStyle.warningParagraph}>
|
||||
Since you are not using the LBRY sync service, you will lose all of your credits if you uninstall this
|
||||
application. Instructions on how to enroll as well as how to backup your wallet manually are available
|
||||
on the next page.
|
||||
</Text>
|
||||
)}
|
||||
<Text style={walletStyle.warningText}>
|
||||
If you understand the risks and you wish to continue, please tap the button below.
|
||||
</Text>
|
||||
</View>
|
||||
<Button
|
||||
text={'I understand the risks'}
|
||||
style={[walletStyle.button, walletStyle.understand]}
|
||||
onPress={() => setClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS, true)}
|
||||
/>
|
||||
<WalletSignIn navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import { ACTIONS, batchActions, selectMyClaims } from 'lbry-redux';
|
||||
|
||||
export const doUpdatePublishFormState = publishFormValue => dispatch =>
|
||||
dispatch({
|
||||
@@ -21,3 +22,31 @@ export const doClearChannelFormState = () => dispatch =>
|
||||
dispatch({
|
||||
type: Constants.ACTION_CLEAR_CHANNEL_FORM_STATE,
|
||||
});
|
||||
|
||||
export const doPendingPublishSuccess = pendingClaim => (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const myClaims = selectMyClaims(state);
|
||||
const { permanent_url: url } = pendingClaim;
|
||||
const actions = [
|
||||
{
|
||||
type: ACTIONS.PUBLISH_SUCCESS,
|
||||
},
|
||||
];
|
||||
|
||||
// We have to fake a temp claim until the new pending one is returned by claim_list_mine
|
||||
// We can't rely on claim_list_mine because there might be some delay before the new claims are returned
|
||||
// Doing this allows us to show the pending claim immediately, it will get overwritten by the real one
|
||||
const isMatch = claim => claim.claim_id === pendingClaim.claim_id;
|
||||
const isEdit = myClaims.some(isMatch);
|
||||
|
||||
const myNewClaims = isEdit
|
||||
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
|
||||
: myClaims.concat(pendingClaim);
|
||||
actions.push({
|
||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||
data: {
|
||||
claims: myNewClaims,
|
||||
},
|
||||
});
|
||||
dispatch(batchActions(...actions));
|
||||
};
|
||||
@@ -172,6 +172,10 @@ const channelPageStyle = StyleSheet.create({
|
||||
deleteButton: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
shareButton: {
|
||||
marginLeft: 8,
|
||||
marginRight: 8,
|
||||
},
|
||||
});
|
||||
|
||||
export default channelPageStyle;
|
||||
+59
-3
@@ -295,9 +295,7 @@ const discoverStyle = StyleSheet.create({
|
||||
color: Colors.DescriptionGrey,
|
||||
marginRight: 6,
|
||||
},
|
||||
menuScrollContent: {
|
||||
paddingTop: 16,
|
||||
},
|
||||
menuScrollContent: {},
|
||||
menuGroup: {
|
||||
marginTop: 8,
|
||||
marginBottom: 8,
|
||||
@@ -336,6 +334,64 @@ const discoverStyle = StyleSheet.create({
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
},
|
||||
signInContainer: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
height: 140,
|
||||
padding: 16,
|
||||
},
|
||||
signInButton: {
|
||||
backgroundColor: Colors.White,
|
||||
alignSelf: 'flex-start',
|
||||
position: 'absolute',
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
},
|
||||
signedInEmail: {
|
||||
fontFamily: 'Inter-UI-SemiBold',
|
||||
fontSize: 15,
|
||||
color: Colors.White,
|
||||
},
|
||||
signedInAvatar: {
|
||||
backgroundColor: Colors.NextLbryGreen,
|
||||
width: 80,
|
||||
height: 80,
|
||||
marginBottom: 12,
|
||||
borderRadius: 160,
|
||||
overflow: 'hidden',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
signedInAvatarImage: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
signInMenuItem: {
|
||||
paddingTop: 16,
|
||||
paddingBottom: 12,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
marginBottom: 6,
|
||||
borderBottomWidth: 1,
|
||||
},
|
||||
signInMenuItemBorder: {
|
||||
borderBottomColor: Colors.VeryLightGrey,
|
||||
},
|
||||
signInMenuItemButton: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
borderBottomColor: Colors.LbryGreen,
|
||||
},
|
||||
signInMenuItemText: {
|
||||
color: Colors.DescriptionGrey,
|
||||
fontFamily: 'Inter-UI-SemiBold',
|
||||
fontSize: 14,
|
||||
textAlign: 'center',
|
||||
},
|
||||
signInMenuItemButtonText: {
|
||||
color: Colors.White,
|
||||
fontFamily: 'Inter-UI-SemiBold',
|
||||
fontSize: 14,
|
||||
textAlign: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
export default discoverStyle;
|
||||
@@ -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;
|
||||
@@ -209,6 +209,12 @@ const firstRunStyle = StyleSheet.create({
|
||||
revealIcon: {
|
||||
color: Colors.White,
|
||||
},
|
||||
tosLink: {
|
||||
textDecorationLine: 'underline',
|
||||
},
|
||||
tosParagraph: {
|
||||
marginTop: 48,
|
||||
},
|
||||
});
|
||||
|
||||
export default firstRunStyle;
|
||||
@@ -29,10 +29,7 @@ const rewardStyle = StyleSheet.create({
|
||||
},
|
||||
enrollContainer: {
|
||||
flex: 1,
|
||||
marginTop: 76,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
marginBottom: 16,
|
||||
marginTop: 60,
|
||||
padding: 24,
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
},
|
||||
@@ -250,6 +247,11 @@ const rewardStyle = StyleSheet.create({
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
color: Colors.White,
|
||||
},
|
||||
learnMoreLink: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
color: Colors.White,
|
||||
textDecorationLine: 'underline',
|
||||
},
|
||||
enrollButton: {
|
||||
backgroundColor: Colors.White,
|
||||
paddingLeft: 16,
|
||||
|
||||
+16
-4
@@ -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%',
|
||||
|
||||
@@ -44,6 +44,13 @@ const settingsStyle = StyleSheet.create({
|
||||
fontSize: 20,
|
||||
marginBottom: 4,
|
||||
},
|
||||
sectionDescription: {
|
||||
color: '#aaaaaa',
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 12,
|
||||
lineHeight: 18,
|
||||
marginBottom: 8,
|
||||
},
|
||||
sectionDivider: {
|
||||
marginTop: 24,
|
||||
},
|
||||
|
||||
@@ -305,6 +305,52 @@ const walletStyle = StyleSheet.create({
|
||||
fontSize: 16,
|
||||
marginLeft: 8,
|
||||
},
|
||||
buttonRow: {
|
||||
width: '100%',
|
||||
position: 'absolute',
|
||||
alignItems: 'center',
|
||||
left: 24,
|
||||
bottom: 24,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
},
|
||||
continueLink: {
|
||||
fontSize: 14,
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
color: Colors.White,
|
||||
},
|
||||
learnMoreLink: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
color: Colors.NextLbryGreen,
|
||||
},
|
||||
signInButton: {
|
||||
backgroundColor: Colors.White,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
},
|
||||
signInContainer: {
|
||||
flex: 1,
|
||||
marginTop: 60,
|
||||
padding: 24,
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
},
|
||||
onboarding: {
|
||||
marginTop: 36,
|
||||
},
|
||||
onboardingText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 18,
|
||||
lineHeight: 28,
|
||||
color: Colors.White,
|
||||
},
|
||||
signInSummaryRow: {
|
||||
flexDirection: 'row',
|
||||
},
|
||||
signInTitle: {
|
||||
color: Colors.White,
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 28,
|
||||
},
|
||||
});
|
||||
|
||||
export default walletStyle;
|
||||
+26
-16
@@ -6,26 +6,31 @@ 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;
|
||||
@@ -346,3 +351,8 @@ export function uploadImageAsset(filePath, success, failure) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Move this to lbry-redux
|
||||
export function formatLbryUrlForWeb(url) {
|
||||
return url.replace('lbry://', '/').replace(/#/g, ':');
|
||||
}
|
||||
Reference in new issue
Block a user