Compare commits

..
50 Commits
Author SHA1 Message Date
Akinwale Ariwodola 11bc8f1a85 fix merge conflict 2019-11-07 16:54:21 +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
Akinwale Ariwodola e496388b8f run claim search for tag result 2019-10-30 10:30:08 +01:00
Akinwale Ariwodola fc1ef26a17 Merge remote-tracking branch 'origin/master' into tag-search-result 2019-10-29 16:06:30 +01:00
Akinwale Ariwodola 1458e4f321 capitalise menu item labels 2019-10-29 15:06:37 +01:00
Akinwale Ariwodola ed513bcfb5 fix learn more link style 2019-10-29 15:02:54 +01:00
Akinwale Ariwodola 518285355c Merge pull request #70 from lbryio/tos
terms of service acknowledgement
2019-10-29 15:00:29 +01:00
Akinwale Ariwodola 030b94ce01 terms of service acknowledgement 2019-10-29 14:59:20 +01:00
Akinwale Ariwodola 12ca56cb45 change learn more link colour 2019-10-29 14:54:19 +01:00
Akinwale Ariwodola 8eb661171d tweak sign in button 2019-10-29 14:52:59 +01:00
Akinwale Ariwodola ba72be002a show tag search result 2019-10-29 14:29:17 +01:00
Akinwale Ariwodola 67349b0ef6 add sign in area to drawer content (#64)
* add sign in area to drawer content
* make sign in a menu item in the drawer content
* fix typo
2019-10-29 14:04:21 +01:00
Akinwale Ariwodola 41fd14e18f wallet sign in driver (#67) 2019-10-29 13:36:11 +01:00
Akinwale Ariwodola ce36be2b7b Merge pull request #65 from lbryio/channel-share
add share button to channel page
2019-10-29 13:33:30 +01:00
Akinwale Ariwodola b4fc61ada0 Merge pull request #69 from lbryio/wait-for-sync
wait for getSync to complete and apply user settings
2019-10-28 16:36:41 +01:00
Akinwale Ariwodola 032b5c26b1 wait for getSync to complete and apply user settings 2019-10-28 16:32:09 +01:00
Akinwale Ariwodola 871c2c538b Merge pull request #68 from lbryio/verified-sync
only sync for users with a verified email address
2019-10-25 16:54:42 +01:00
Akinwale Ariwodola 60f6645515 only sync for users with a verified email address 2019-10-25 16:53:40 +01:00
Akinwale Ariwodola 61f0aa5dac add notification settings (#63) 2019-10-25 16:44:49 +01:00
Akinwale Ariwodola 2c6445c61c improve handling of pending claims (#61) 2019-10-25 16:43:57 +01:00
Akinwale Ariwodola 3239174ddf Merge pull request #66 from lbryio/ux-updates
rewards page and rewards driver changes
2019-10-25 15:48:22 +01:00
Akinwale Ariwodola 9157b18f45 add share button to channel page 2019-10-25 15:24:57 +01:00
Akinwale Ariwodola f09269d48a rewards page and rewards driver changes 2019-10-25 15:14:06 +01:00
Akinwale Ariwodola 69a760f011 Navigation drawer (#62)
* downgrade react-navigation-drawer package
* adjust drawer width
2019-10-21 18:22:03 +01:00
Akinwale Ariwodola 22cd556e13 fix blank password wallet state 2019-10-21 15:55:55 +01:00
Akinwale Ariwodola 68bee32dde Merge pull request #60 from lbryio/blank-password-encrypt
do not call wallet_encrypt with blank password
2019-10-20 19:31:15 +01:00
Akinwale Ariwodola cc2b3b845d do not call wallet_encrypt with blank password 2019-10-20 19:30:18 +01:00
Akinwale Ariwodola b6df5ee97c more cleanup 2019-10-17 20:14:04 +01:00
Akinwale Ariwodola ddd8d49a62 cleanup 2019-10-17 20:12:43 +01:00
Akinwale Ariwodola e6ee26f94c fix for devices without Firebase support 2019-10-17 19:55:30 +01:00
Akinwale Ariwodola 2bf67d31e8 proceed from splash if Firebase doesn't work 2019-10-17 19:12:16 +01:00
Akinwale Ariwodola 9ec5ac5d60 remove getSync wait before navigation to main 2019-10-17 18:19:45 +01:00
Akinwale Ariwodola 9080913811 Next RC (#57)
* use doPreferenceGet for retrieving saved user state
* add share button
* remove extra slash
* preferences sync and wallet sync updates
* preference updates. send firebase token.
* add URI bar suggestions setting. reorganise settings page
* NSFW -> mature
* sdk calls: account_* -> wallet_*
* more updates for release
* filtered homepage. other updates.
* log publish
* remove getSync from channel creation success
2019-10-17 14:10:49 +01:00
Akinwale Ariwodola eca6af122b improve ux for insufficient balance for channel creation and publish (#58) 2019-10-15 17:56:22 +01:00
Akinwale Ariwodola b258654d60 add share button (#55)
* add share button
* remove extra slash
* change beta.lbry.tv -> lbry.tv
2019-10-15 08:31:03 +01:00
Akinwale Ariwodola 342e022594 Merge pull request #54 from lbryio/fix-dmca-report
Fix dmca report route
2019-10-11 14:11:02 +01:00
Thomas Zarebczan d16e4b7f69 Fix dmca report route
example: https://lbry.com/dmca/116d62d14d8efc311e1f8a9de92dcbc17deb259a
2019-10-10 13:44:48 -04:00
Alex Grin 648206b6a5 Merge pull request #53 from StrikerRUS/patch-1
bump year in license
2019-10-09 10:37:30 -04:00
Nikita Titov 14994d2a30 bump year in license 2019-10-08 23:36:02 +03:00
67 changed files with 1265 additions and 381 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2017-2018 LBRY Inc
Copyright (c) 2017-2019 LBRY Inc
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+10 -7
View File
@@ -5640,8 +5640,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#7ec72a737bcd336f000c5f5085891643110298c3",
"from": "github:lbryio/lbry-redux#7ec72a737bcd336f000c5f5085891643110298c3",
"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#c55a2c98ab92c72149c824ee5906aed4404fd89b",
"from": "github:lbryio/lbryinc#c55a2c98ab92c72149c824ee5906aed4404fd89b",
"version": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
"from": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
"requires": {
"reselect": "^3.0.0"
}
@@ -8402,9 +8402,12 @@
}
},
"react-navigation-drawer": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-2.2.2.tgz",
"integrity": "sha512-KcFH7RRzT1XuREkTbNMCqfy7nK7yenzpGKvqp1dTvAE+DIyHHpf+Po959lsmITlt/njQBn+QxvdX1FZ9we3lNA=="
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-1.4.0.tgz",
"integrity": "sha512-ZyWBozcjB2aZ7vwCALv90cYA2NpDjM+WALaiYRshvPvue8l7cqynePbHK8GhlMGyJDwZqp4MxQmu8u1XAKp3Bw==",
"requires": {
"react-native-tab-view": "^1.2.0"
}
},
"react-navigation-redux-helpers": {
"version": "3.0.2",
+3 -3
View File
@@ -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#7ec72a737bcd336f000c5f5085891643110298c3",
"lbryinc": "lbryio/lbryinc#c55a2c98ab92c72149c824ee5906aed4404fd89b",
"lbry-redux": "lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"lbryinc": "lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",
"moment": "^2.22.1",
@@ -34,7 +34,7 @@
"react-native-vector-icons": "^6.6.0",
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
"react-navigation": "^3.11.0",
"react-navigation-drawer": "^2.2.2",
"react-navigation-drawer": "^1.4.0",
"react-navigation-redux-helpers": "^3.0.2",
"react-navigation-stack": "^1.8.1",
"react-redux": "^5.0.3",
+48 -6
View File
@@ -27,9 +27,17 @@ 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, doToast, selectToast } from 'lbry-redux';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
import {
Lbryio,
doGetSync,
@@ -39,6 +47,7 @@ import {
selectEmailToVerify,
selectEmailVerifyIsPending,
selectEmailVerifyErrorMessage,
selectHashChanged,
selectUser,
} from 'lbryinc';
import { makeSelectClientSetting } from 'redux/selectors/settings';
@@ -53,6 +62,8 @@ import discoverStyle from 'styles/discover';
import searchStyle from 'styles/search';
import SearchRightHeaderIcon from 'component/searchRightHeaderIcon';
const SYNC_GET_INTERVAL = 1000 * 60 * 5; // every 5 minutes
const menuNavigationButton = navigation => (
<NavigationButton
name="bars"
@@ -269,9 +280,11 @@ class AppWithNavigationState extends React.Component {
constructor() {
super();
this.emailVerifyCheckInterval = null;
this.syncGetInterval = null;
this.state = {
emailVerifyDone: false,
verifyPending: false,
syncHashChanged: false,
};
}
@@ -292,8 +305,19 @@ class AppWithNavigationState extends React.Component {
}
componentDidMount() {
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
if (user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
});
}
}, SYNC_GET_INTERVAL);
}
checkEmailVerification = () => {
@@ -308,19 +332,31 @@ class AppWithNavigationState extends React.Component {
getUserSettings = () => {
const { dispatch } = this.props;
Lbryio.call('user_settings', 'get').then(settings => {
dispatch(doPopulateSharedUserState(settings));
});
doPreferenceGet(
'shared',
preference => {
dispatch(doPopulateSharedUserState(preference));
},
error => {
/* failed */
}
);
};
componentWillUnmount() {
AppState.removeEventListener('change', this._handleAppStateChange);
BackHandler.removeEventListener('hardwareBackPress');
Linking.removeEventListener('url', this._handleUrl);
if (this.emailVerifyCheckInterval > -1) {
clearInterval(this.emailVerifyCheckInterval);
}
if (this.syncGetInterval > -1) {
clearInterval(this.syncGetInterval);
}
}
componentDidUpdate() {
const { dispatch, user } = this.props;
const { dispatch, user, hashChanged } = this.props;
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
clearInterval(this.emailVerifyCheckInterval);
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
@@ -332,6 +368,11 @@ class AppWithNavigationState extends React.Component {
// get user settings after email verification
this.getUserSettings();
}
if (hashChanged && !this.state.syncHashChanged) {
this.setState({ syncHashChanged: true });
this.getUserSettings();
}
}
componentWillUpdate(nextProps) {
@@ -438,6 +479,7 @@ class AppWithNavigationState extends React.Component {
const mapStateToProps = state => ({
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
hashChanged: selectHashChanged(state),
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
nav: state.nav,
toast: selectToast(state),
+3 -1
View File
@@ -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>
);
}
+2
View File
@@ -7,6 +7,7 @@ import {
doCreateChannel,
doToast,
} from 'lbry-redux';
import { doGetSync } from 'lbryinc';
import ChannelSelector from './view';
const select = state => ({
@@ -19,6 +20,7 @@ const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
});
export default connect(
+8 -3
View File
@@ -1,6 +1,7 @@
import React from 'react';
import { CLAIM_VALUES, isNameValid } from 'lbry-redux';
import { ActivityIndicator, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { logPublish } from 'utils/helper';
import Button from 'component/button';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
@@ -117,7 +118,7 @@ export default class ChannelSelector extends React.PureComponent {
};
handleCreateChannelClick = () => {
const { balance, createChannel, onChannelChange, notify } = this.props;
const { balance, createChannel, getSync, onChannelChange, notify } = this.props;
const { newChannelBid, newChannelName } = this.state;
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
@@ -142,17 +143,21 @@ export default class ChannelSelector extends React.PureComponent {
createChannelError: undefined,
});
const success = () => {
const success = channelClaim => {
this.setState({
creatingChannel: false,
addingChannel: false,
currentSelectedValue: channelName,
showCreateChannel: false,
});
logPublish(channelClaim);
if (onChannelChange) {
onChannelChange(channelName);
}
// sync wallet
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
};
const failure = () => {
+1 -1
View File
@@ -12,7 +12,7 @@ import claimListStyle from 'styles/claimList';
import discoverStyle from 'styles/discover';
import moment from 'moment';
const horizontalLimit = 7;
const horizontalLimit = 10;
const softLimit = 500;
class ClaimList extends React.PureComponent {
+15 -1
View File
@@ -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);
+88 -5
View File
@@ -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];
+3 -1
View File
@@ -10,13 +10,15 @@ import {
makeSelectClaimIsNsfw,
makeSelectShortUrlForUri,
} from 'lbry-redux';
import { selectRewardContentClaimIds } from 'lbryinc';
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
import { selectShowNsfw } from 'redux/selectors/settings';
import FileItem from './view';
const select = (state, props) => ({
blackListedOutpoints: selectBlackListedOutpoints(state),
claim: makeSelectClaimForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
filteredOutpoints: selectFilteredOutpoints(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
+15 -1
View File
@@ -40,10 +40,12 @@ class FileItem extends React.PureComponent {
render() {
const {
blackListedOutpoints,
claim,
title,
thumbnail,
fileInfo,
filteredOutpoints,
metadata,
isResolvingUri,
rewardedContentClaimIds,
@@ -58,7 +60,19 @@ class FileItem extends React.PureComponent {
} = this.props;
if (claim && claim.value_type === 'channel') {
// don't display channels in the lists on the Explore page
// don't display channels in the lists on the Your tags page
return null;
}
let shouldHide = false;
if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = !blackListedOutpoints
? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
}
if (shouldHide) {
// don't display blacklisted or filtered outpoints on the Your tags page
return null;
}
+3 -1
View File
@@ -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);
}
+1 -1
View File
@@ -9,7 +9,7 @@ class FileRewardsDriver extends React.PureComponent<Props> {
return (
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={filePageStyle.rewardIcon} />
<Icon name="award" size={16} style={filePageStyle.rewardDriverIcon} />
<Text style={filePageStyle.rewardDriverText}>Earn some credits to access this content.</Text>
</TouchableOpacity>
);
+1 -1
View File
@@ -34,7 +34,7 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
{(!isNaN(balance) || balance === 0) && (
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 0, true)}</Text>
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)}
</TouchableOpacity>
</View>
+2 -2
View File
@@ -55,7 +55,7 @@ export default class ModalTagSelector extends React.PureComponent {
return (
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
<View style={modalTagSelectorStyle.container}>
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
<View style={modalTagSelectorStyle.titleRow}>
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
</View>
@@ -75,7 +75,7 @@ export default class ModalTagSelector extends React.PureComponent {
<View style={modalTagSelectorStyle.buttons}>
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
</View>
</View>
</TouchableOpacity>
</TouchableOpacity>
);
}
+3 -1
View File
@@ -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>
);
}
+17 -7
View File
@@ -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>
);
+2 -2
View File
@@ -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>
);
}
+3
View File
@@ -4,8 +4,10 @@ import {
selectSearchState as selectSearch,
selectSearchValue,
selectSearchSuggestions,
SETTINGS,
} from 'lbry-redux';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import UriBar from './view';
const select = state => {
@@ -16,6 +18,7 @@ const select = state => {
query: selectSearchValue(state),
currentRoute: selectCurrentRoute(state),
suggestions: selectSearchSuggestions(state),
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
};
};
@@ -20,6 +20,10 @@ class UriBarItem extends React.PureComponent {
icon = <Icon name="search" size={18} />;
break;
case SEARCH_TYPES.TAG:
icon = <Icon name="hashtag" size={18} />;
break;
case SEARCH_TYPES.FILE:
default:
icon = <Icon name="file" size={18} />;
@@ -37,6 +41,7 @@ class UriBarItem extends React.PureComponent {
{type === SEARCH_TYPES.SEARCH && `Search for '${value}'`}
{type === SEARCH_TYPES.CHANNEL && `View the @${shorthand} channel`}
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
{type === SEARCH_TYPES.TAG && `Explore the '${value}' tag`}
</Text>
</View>
</TouchableOpacity>
+65 -39
View File
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { Dimensions, FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { navigateToUri, transformUrl } from 'utils/helper';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import UriBarItem from './internal/uri-bar-item';
@@ -14,6 +14,8 @@ class UriBar extends React.PureComponent {
textInput = null;
keyboardDidShowListener = null;
keyboardDidHideListener = null;
state = {
@@ -21,17 +23,19 @@ class UriBar extends React.PureComponent {
currentValue: null,
inputText: null,
focused: false,
// TODO: Add a setting to enable / disable direct search?
directSearch: true,
keyboardHeight: 0,
};
componentDidMount() {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
this.setSelection();
}
componentWillUnmount() {
if (this.keyboardDidShowListener) {
this.keyboardDidShowListener.remove();
}
if (this.keyboardDidHideListener) {
this.keyboardDidHideListener.remove();
}
@@ -49,25 +53,28 @@ class UriBar extends React.PureComponent {
handleChangeText = text => {
const newValue = text || '';
clearTimeout(this.state.changeTextTimeout);
const { updateSearchQuery, onSearchSubmitted, navigation } = this.props;
const { updateSearchQuery, onSearchSubmitted, showUriBarSuggestions, navigation } = this.props;
let timeout = setTimeout(() => {
if (text.trim().length === 0) {
// don't do anything if the text is empty
return;
}
updateSearchQuery(text);
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 } });
let timeout = -1;
if (!showUriBarSuggestions) {
timeout = setTimeout(() => {
if (text.trim().length === 0) {
// don't do anything if the text is empty
return;
}
}
}, UriBar.INPUT_TIMEOUT);
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 });
};
@@ -86,18 +93,34 @@ class UriBar extends React.PureComponent {
return;
}
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value } });
navigation.navigate({
routeName: Constants.DRAWER_ROUTE_SEARCH,
key: 'searchPage',
params: { searchQuery: value },
});
} else if (SEARCH_TYPES.TAG === type) {
navigation.navigate({
routeName: Constants.DRAWER_ROUTE_TAG,
key: 'tagPage',
params: {
tag: value.toLowerCase(),
},
});
} else {
const uri = normalizeURI(value);
navigateToUri(navigation, uri);
}
};
_keyboardDidShow = evt => {
this.setState({ keyboardHeight: evt.endCoordinates.height });
};
_keyboardDidHide = () => {
if (this.textInput) {
this.textInput.blur();
}
this.setState({ focused: false });
this.setState({ focused: false, keyboardHeight: 0 });
};
setSelection() {
@@ -152,16 +175,18 @@ class UriBar extends React.PureComponent {
selectedItemCount,
selectionMode,
suggestions,
showUriBarSuggestions,
value,
} = this.props;
if (this.state.currentValue === null) {
this.setState({ currentValue: value });
}
let style = [uriBarStyle.overlay, belowOverlay ? null : uriBarStyle.overlayElevated];
// TODO: Add optional setting to enable URI / search bar suggestions
/* if (this.state.focused) { style.push(uriBarStyle.inFocus); } */
let style = [
uriBarStyle.overlay,
belowOverlay ? null : uriBarStyle.overlayElevated,
this.state.focused && showUriBarSuggestions ? uriBarStyle.inFocus : null,
];
// TODO: selectionModeActions should be dynamically created / specified
return (
@@ -248,20 +273,21 @@ class UriBar extends React.PureComponent {
onSubmitEditing={this.handleSubmitEditing}
/>
)}
{this.state.focused && !this.state.directSearch && (
<View style={uriBarStyle.suggestions}>
<FlatList
style={uriBarStyle.suggestionList}
data={suggestions}
keyboardShouldPersistTaps={'handled'}
keyExtractor={(item, value) => item.value}
renderItem={({ item }) => (
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
)}
/>
</View>
)}
</View>
{this.state.focused && showUriBarSuggestions && (
<FlatList
style={[
uriBarStyle.suggestions,
{ height: Dimensions.get('window').height - this.state.keyboardHeight - 60 },
]}
data={suggestions}
keyboardShouldPersistTaps={'handled'}
keyExtractor={(item, value) => `${item.value}-${item.type}`}
renderItem={({ item }) => (
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
)}
/>
)}
</View>
);
}
+6 -1
View File
@@ -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 -2
View File
@@ -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>
);
}
+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}
+19
View File
@@ -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);
+48
View File
@@ -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;
+5 -1
View File
@@ -32,7 +32,7 @@ const Constants = {
ABOUT_TAB: 'about',
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword',
KEY_WALLET_PASSWORD: 'firstRunPassword',
KEY_FIRST_USER_AUTH: 'firstUserAuth',
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
@@ -138,6 +138,10 @@ const Constants = {
MORE_PLACEHOLDER: '_more',
TRUE_STRING: 'true',
MINIMUM_TRANSACTION_BALANCE: 0.1,
SHARE_BASE_URL: 'https://open.lbry.com',
};
export default Constants;
+58 -26
View File
@@ -4,6 +4,8 @@ import { Provider, connect } from 'react-redux';
import { AppRegistry, Text, View, NativeModules } from 'react-native';
import {
Lbry,
buildSharedStateMiddleware,
blockedReducer,
claimsReducer,
contentReducer,
fileReducer,
@@ -13,19 +15,24 @@ import {
searchReducer,
tagsReducer,
walletReducer,
ACTIONS as LBRY_REDUX_ACTIONS,
} from 'lbry-redux';
import {
Lbryio,
authReducer,
blacklistReducer,
costInfoReducer,
doGetSync,
filteredReducer,
homepageReducer,
rewardsReducer,
selectUserVerifiedEmail,
subscriptionsReducer,
syncReducer,
userReducer,
LBRYINC_ACTIONS,
} from 'lbryinc';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { createStore, applyMiddleware, compose } from 'redux';
import AppWithNavigationState, {
AppNavigator,
@@ -33,6 +40,7 @@ import AppWithNavigationState, {
reactNavigationMiddleware,
} from 'component/AppNavigator';
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import FilesystemStorage from 'redux-persist-filesystem-storage';
import createCompressor from 'redux-persist-transform-compress';
@@ -42,7 +50,6 @@ import formReducer from 'redux/reducers/form';
import drawerReducer from 'redux/reducers/drawer';
import settingsReducer from 'redux/reducers/settings';
import thunk from 'redux-thunk';
import isEqual from 'utils/deep-equal';
const globalExceptionHandler = (error, isFatal) => {
if (error && NativeModules.Firebase) {
@@ -81,6 +88,7 @@ function enableBatching(reducer) {
const compressor = createCompressor();
const authFilter = createFilter('auth', ['authToken']);
const blockedFilter = createFilter('blocked', ['blockedChannels']);
const contentFilter = createFilter('content', ['positions']);
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']);
@@ -89,10 +97,18 @@ const tagsFilter = createFilter('tags', ['followedTags']);
const walletFilter = createFilter('wallet', ['receiveAddress']);
const v4PersistOptions = {
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
whitelist: ['auth', 'blocked', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
// Order is important. Needs to be compressed last or other transforms can't
// read the data
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
transforms: [
authFilter,
blockedFilter,
saveClaimsFilter,
subscriptionsFilter,
settingsFilter,
walletFilter,
compressor,
],
debounce: 10000,
storage: FilesystemStorage,
};
@@ -105,6 +121,7 @@ const persistOptions = Object.assign({}, v4PersistOptions, {
const reducers = persistCombineReducers(persistOptions, {
auth: authReducer,
blacklist: blacklistReducer,
blocked: blockedReducer,
claims: claimsReducer,
content: contentReducer,
costInfo: costInfoReducer,
@@ -127,8 +144,45 @@ const reducers = persistCombineReducers(persistOptions, {
wallet: walletReducer,
});
/**
* source: the reducer name
* property: the property in the reducer-specific state
* transform: optional method to modify the value to be stored
*/
const sharedStateActions = [
LBRYINC_ACTIONS.CHANNEL_SUBSCRIBE,
LBRYINC_ACTIONS.CHANNEL_UNSUBSCRIBE,
LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
];
const sharedStateFilters = {
tags: { source: 'tags', property: 'followedTags' },
subscriptions: {
source: 'subscriptions',
property: 'subscriptions',
transform: function(value) {
return value.map(({ uri }) => uri);
},
},
blocked: { source: 'blocked', property: 'blockedChannels' },
};
const sharedStateCallback = ({ dispatch, getState }) => {
const state = getState();
const syncEnabled = makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state);
const emailVerified = selectUserVerifiedEmail(state);
if (syncEnabled && emailVerified) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
dispatch(doGetSync(password))
);
}
};
const sharedStateMiddleware = buildSharedStateMiddleware(sharedStateActions, sharedStateFilters, sharedStateCallback);
const bulkThunk = createBulkThunkMiddleware();
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
const middleware = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = compose;
@@ -147,28 +201,6 @@ const persistor = persistStore(store, persistOptions, err => {
});
window.persistor = persistor;
let currentPayload;
store.subscribe(() => {
const state = store.getState();
const subscriptions = state.subscriptions.subscriptions.map(({ uri }) => uri);
const tags = state.tags.followedTags;
const newPayload = {
version: '0.1',
shared: {
subscriptions,
tags,
},
};
if (!isEqual(newPayload, currentPayload)) {
currentPayload = newPayload;
if (Lbryio.authToken) {
Lbryio.call('user_settings', 'set', { settings: JSON.stringify(newPayload) });
}
}
});
// TODO: Find i18n module that is compatible with react-native
global.__ = str => str;
+16 -1
View File
@@ -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
+2
View File
@@ -12,6 +12,7 @@ import {
doUpdateChannel,
doToast,
} from 'lbry-redux';
import { doGetSync } from 'lbryinc';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
import { selectDrawerStack } from 'redux/selectors/drawer';
@@ -37,6 +38,7 @@ const perform = dispatch => ({
clearChannelFormState: () => dispatch(doClearChannelFormState()),
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
updateChannel: params => dispatch(doUpdateChannel(params)),
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
+33 -14
View File
@@ -14,7 +14,7 @@ import {
TouchableOpacity,
View,
} from 'react-native';
import { navigateToUri, uploadImageAsset } from 'utils/helper';
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
import Button from 'component/button';
import ChannelIconItem from 'component/channelIconItem';
import ChannelRewardsDriver from 'component/channelRewardsDriver';
@@ -32,9 +32,11 @@ import channelIconStyle from 'styles/channelIcon';
import seedrandom from 'seedrandom';
export default class ChannelCreator extends React.PureComponent {
scrollView = null;
state = {
autoStyle: null,
canSave: false,
canSave: true,
claimId: null,
currentSelectedValue: Constants.ITEM_ANONYMOUS,
currentPhase: null,
@@ -161,9 +163,6 @@ export default class ChannelCreator extends React.PureComponent {
if (!fetchingChannels) {
fetchChannelListMine();
}
if (balance >= 0.1) {
this.setState({ canSave: true });
}
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
@@ -376,7 +375,15 @@ export default class ChannelCreator extends React.PureComponent {
};
handleCreateChannelClick = () => {
const { balance, clearChannelFormState, createChannel, onChannelChange, notify, updateChannel } = this.props;
const {
balance,
clearChannelFormState,
createChannel,
onChannelChange,
getSync,
notify,
updateChannel,
} = this.props;
const {
claimId,
coverImageUrl,
@@ -392,6 +399,16 @@ export default class ChannelCreator extends React.PureComponent {
website,
} = this.state;
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({
message: 'Creating a channel requires credits. Press the blue bar to get some for free.',
});
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
}
return;
}
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
notify({ message: 'Your channel name contains invalid characters.' });
return;
@@ -423,7 +440,7 @@ export default class ChannelCreator extends React.PureComponent {
createChannelError: undefined,
});
const success = () => {
const success = channelClaim => {
this.setState({
creatingChannel: false,
addingChannel: false,
@@ -439,6 +456,8 @@ export default class ChannelCreator extends React.PureComponent {
clearChannelFormState();
notify({ message: 'The channel was successfully created.' });
this.showChannelList();
logPublish(channelClaim);
};
const failure = () => {
@@ -528,9 +547,9 @@ export default class ChannelCreator extends React.PureComponent {
};
handleNewChannelPress = () => {
const { balance, pushDrawerStack } = this.props;
const { pushDrawerStack } = this.props;
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
this.setState({ canSave: balance >= 0.1, currentPhase: Constants.PHASE_CREATE });
this.setState({ currentPhase: Constants.PHASE_CREATE });
};
handleCreateCancel = () => {
@@ -548,7 +567,7 @@ export default class ChannelCreator extends React.PureComponent {
resetChannelCreator = () => {
this.setState({
canSave: false,
canSave: true,
claimId: null,
editMode: false,
displayName: null,
@@ -610,7 +629,7 @@ export default class ChannelCreator extends React.PureComponent {
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
this.setState({
canSave: balance >= 0.1,
canSave: true,
claimId: channel.claim_id,
currentPhase: Constants.PHASE_CREATE,
displayName: value && value.title ? value.title : channel.name.substring(1),
@@ -841,7 +860,7 @@ export default class ChannelCreator extends React.PureComponent {
)}
{currentPhase === Constants.PHASE_CREATE && (
<ScrollView style={channelCreatorStyle.createChannelContainer}>
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
<View style={channelCreatorStyle.imageSelectors}>
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
<Image
@@ -886,7 +905,7 @@ export default class ChannelCreator extends React.PureComponent {
</TouchableOpacity>
</View>
</View>
{balance < 0.1 && <ChannelRewardsDriver navigation={navigation} />}
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
<View style={channelCreatorStyle.card}>
<View style={channelCreatorStyle.textInputLayout}>
@@ -1046,7 +1065,7 @@ export default class ChannelCreator extends React.PureComponent {
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
<Button
style={channelCreatorStyle.createButton}
disabled={!canSave || uploadingImage || !newChannelName || newChannelName.trim().length === 0}
disabled={!canSave || uploadingImage}
text={editMode ? 'Update' : 'Create'}
onPress={this.handleCreateChannelClick}
/>
+58 -14
View File
@@ -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,6 +509,15 @@ class FilePage extends React.PureComponent {
this.setState({ fileViewLogged: true });
};
handleSharePress = () => {
const { claim, notify } = 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);
}
};
handleSendTip = () => {
const { claim, balance, navigation, notify, sendTip } = this.props;
const { uri } = navigation.state.params;
@@ -730,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') {
@@ -800,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)) &&
@@ -933,6 +965,30 @@ class FilePage extends React.PureComponent {
</View>
</View>
</TouchableWithoutFeedback>
<View style={filePageStyle.largeButtonsRow}>
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
<Icon name={'share-alt'} size={20} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Share</Text>
</TouchableOpacity>
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => this.setState({ showTipView: true })}
>
<Icon name={'gift'} size={20} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Tip</Text>
</TouchableOpacity>
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
>
<Icon name={'flag'} size={20} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Report</Text>
</TouchableOpacity>
</View>
<View style={filePageStyle.channelRow}>
<View style={filePageStyle.publishInfo}>
{channelName && (
@@ -969,18 +1025,6 @@ class FilePage extends React.PureComponent {
onPress={this.onSaveFilePressed}
/>
)}
<Button
style={[filePageStyle.actionButton, filePageStyle.reportButton]}
theme={'light'}
icon={'flag'}
onPress={() => Linking.openURL(`https://lbry.com/dmca?claim_id=${claim.claim_id}`)}
/>
<Button
style={[filePageStyle.actionButton, filePageStyle.tipButton]}
theme={'light'}
icon={'gift'}
onPress={() => this.setState({ showTipView: true })}
/>
{channelName && (
<SubscribeButton
style={filePageStyle.actionButton}
+2 -4
View File
@@ -4,7 +4,6 @@ import {
doAuthenticate,
doCheckSync,
doGetSync,
doSetDefaultAccount,
doSyncApply,
doUserEmailNew,
doUserResendVerificationEmail,
@@ -41,12 +40,11 @@ const select = state => ({
const perform = dispatch => ({
addUserEmail: email => dispatch(doUserEmailNew(email)),
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
getSync: password => dispatch(doGetSync(password)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
checkSync: () => dispatch(doCheckSync()),
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
notify: data => dispatch(doToast(data)),
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
});
@@ -12,7 +12,7 @@ import {
View,
} from 'react-native';
import Colors from 'styles/colors';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Icon from 'react-native-vector-icons/FontAwesome5';
import firstRunStyle from 'styles/firstRun';
@@ -45,8 +45,8 @@ class SkipAccountPage extends React.PureComponent {
/>
</View>
<Text style={firstRunStyle.rowParagraph}>
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery
option if it is not backed up manually (see wallet page)
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option
if it is not backed up manually (see wallet page)
</Text>
</View>
</View>
+11 -4
View File
@@ -14,7 +14,7 @@ import {
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
import AsyncStorage from '@react-native-community/async-storage';
import Colors from 'styles/colors';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import firstRunStyle from 'styles/firstRun';
import Icon from 'react-native-vector-icons/FontAwesome5';
@@ -62,7 +62,14 @@ class WalletPage extends React.PureComponent {
};
render() {
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
const {
onPasswordChanged,
onWalletViewLayout,
getSyncIsPending,
hasSyncedWallet,
syncApplyIsPending,
syncApplyStarted,
} = this.props;
let content;
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
@@ -72,11 +79,11 @@ class WalletPage extends React.PureComponent {
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
</View>
);
} else if (syncApplyIsPending) {
} else if (syncApplyStarted || syncApplyIsPending) {
content = (
<View style={firstRunStyle.centered}>
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
<Text style={firstRunStyle.paragraph}>Validating password...</Text>
<Text style={firstRunStyle.paragraph}>{syncApplyIsPending ? 'Validating password' : 'Synchronizing'}...</Text>
</View>
);
} else {
+35 -21
View File
@@ -3,7 +3,8 @@ import { Lbry } from 'lbry-redux';
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import Colors from 'styles/colors';
import Constants from 'constants';
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 {
@@ -25,7 +26,7 @@ class WelcomePage extends React.PureComponent {
} else {
// first_user_auth because it's the first time
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
if ('true' !== firstUserAuth) {
if (firstUserAuth !== 'true') {
// first_user_auth
NativeModules.Firebase.track('first_user_auth', null);
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
@@ -44,31 +45,39 @@ class WelcomePage extends React.PureComponent {
}
startAuthenticating = () => {
const { authenticate } = this.props;
this.setState({ authenticationStarted: true, authenticationFailed: false });
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
Lbry.status()
.then(info => {
this.setState({ sdkStarted: true });
authenticate(appVersion, Platform.OS);
})
.catch(error => {
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
this.setState({ authenticationFailed: true });
// sdk_start_failed
NativeModules.Firebase.track('sdk_start_failed', null);
} else {
setTimeout(() => {
this.startAuthenticating();
this.setState({ statusTries: this.state.statusTries + 1 });
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
}
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => this.performAuthenticate(appVersion, firebaseToken))
.catch(() => {
this.performAuthenticate(appVersion); /* proceed without firebase */
});
});
};
performAuthenticate(appVersion, firebaseToken) {
const { authenticate } = this.props;
Lbry.status()
.then(info => {
this.setState({ sdkStarted: true });
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(error => {
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
this.setState({ authenticationFailed: true });
// sdk_start_failed
NativeModules.Firebase.track('sdk_start_failed', null);
} else {
setTimeout(() => {
this.startAuthenticating();
this.setState({ statusTries: this.state.statusTries + 1 });
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
}
});
}
render() {
const { authenticating, authToken, onWelcomePageLayout } = this.props;
@@ -98,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>
);
}
+35 -26
View File
@@ -66,7 +66,7 @@ class FirstRunScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props;
const { notify, isApplyingSync, setClientSetting } = this.props;
if (this.state.emailSubmitted && !emailNewPending) {
this.setState({ emailSubmitted: false });
@@ -81,32 +81,33 @@ class FirstRunScreen extends React.PureComponent {
if (this.state.syncApplyStarted && !syncApplyIsPending) {
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: syncApplyErrorMessage, syncApplyStarted: false, isError: true });
this.setState({ showBottomContainer: true });
notify({ message: syncApplyErrorMessage, isError: true });
this.setState({ showBottomContainer: true, syncApplyStarted: false });
} else {
// password successfully verified
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_FIRST_RUN_PASSWORD,
Constants.KEY_WALLET_PASSWORD,
this.state.walletPassword ? this.state.walletPassword : ''
);
setDefaultAccount(
() => {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
// unlock the wallet
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
.then(() => this.closeFinalPage())
.catch(err =>
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
);
},
err => {
notify({
message:
'The account restore operation could not be completed successfully. Please restart the app and try again.',
});
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
Lbry.wallet_status().then(status => {
// unlock the wallet
if (status.is_locked) {
Lbry.wallet_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' }).then(
unlocked => {
if (unlocked) {
this.closeFinalPage();
} else {
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
}
}
);
} else {
// wallet not locked. close final page
this.closeFinalPage();
}
);
});
}
}
@@ -132,9 +133,9 @@ class FirstRunScreen extends React.PureComponent {
const { navigation } = this.props;
const resetAction = StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUri } })],
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUrl } })],
});
navigation.dispatch(resetAction);
setTimeout(() => navigation.dispatch(resetAction), 1000);
}
handleLeftButtonPressed = () => {
@@ -298,13 +299,20 @@ class FirstRunScreen extends React.PureComponent {
const { getSync, setClientSetting } = this.props;
if (NativeModules.UtilityModule) {
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
// fresh account, new password set
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
if (newPassword.trim().length === 0) {
// blank password. Do not encrypt
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
this.closeFinalPage();
});
} else {
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
// fresh account, new password set
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
this.closeFinalPage();
});
}
}
};
@@ -367,6 +375,7 @@ class FirstRunScreen extends React.PureComponent {
hasSyncedWallet={hasSyncedWallet}
getSyncIsPending={getSyncIsPending}
syncApplyIsPending={syncApplyIsPending}
syncApplyStarted={this.state.syncApplyStarted}
onWalletViewLayout={this.onWalletViewLayout}
onPasswordChanged={this.onWalletPasswordChanged}
/>
+4 -1
View File
@@ -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)),
+27 -9
View File
@@ -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,
@@ -43,7 +45,7 @@ import Tag from 'component/tag';
import TagSearch from 'component/tagSearch';
import UriBar from 'component/uriBar';
import publishStyle from 'styles/publish';
import { __, navigateToUri, uploadImageAsset } from 'utils/helper';
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
const languages = {
en: 'English',
@@ -76,8 +78,10 @@ const languages = {
class PublishPage extends React.PureComponent {
camera = null;
scrollView = null;
state = {
canPublish: false,
canPublish: true,
canUseCamera: false,
documentPickerOpen: false,
editMode: false,
@@ -186,7 +190,6 @@ class PublishPage extends React.PureComponent {
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
this.setState(
{
canPublish: balance >= 0.1,
loadingVideos: true,
},
() => {
@@ -319,7 +322,7 @@ class PublishPage extends React.PureComponent {
};
handlePublishPressed = () => {
const { notify, publish, updatePublishForm } = this.props;
const { balance, notify, publish, updatePublishForm } = this.props;
const {
editMode,
bid,
@@ -340,6 +343,16 @@ class PublishPage extends React.PureComponent {
uri,
} = this.state;
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({
message: 'Publishing content requires credits. Press the blue bar to get some for free.',
});
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
}
return;
}
if (!title || title.trim().length === 0) {
notify({ message: 'Please provide a title' });
return;
@@ -360,7 +373,7 @@ class PublishPage extends React.PureComponent {
filePath: currentMedia ? currentMedia.filePath : null,
bid: bid || 0.1,
title: title || '',
thumbnail,
thumbnail: thumbnail || '',
description: description || '',
language,
license,
@@ -383,7 +396,12 @@ 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);
pendingPublishSuccess(pendingClaim);
notify({
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
});
@@ -961,7 +979,7 @@ class PublishPage extends React.PureComponent {
this.updateThumbnailUriForMedia(currentMedia);
}
content = (
<ScrollView style={publishStyle.publishDetails}>
<ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
<FastImage
style={publishStyle.mainThumbnail}
@@ -980,7 +998,7 @@ class PublishPage extends React.PureComponent {
</View>
)}
</TouchableOpacity>
{!this.state.canPublish && <PublishRewardsDriver navigation={navigation} />}
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
<View style={publishStyle.card}>
<View style={publishStyle.textInputLayout}>
@@ -1190,7 +1208,7 @@ class PublishPage extends React.PureComponent {
<View style={publishStyle.rightActionButtons}>
<Button
style={publishStyle.publishButton}
disabled={!this.state.canPublish || this.state.uploadThumbnailStarted}
disabled={this.state.uploadThumbnailStarted}
text={this.state.editMode ? 'Save changes' : 'Publish'}
onPress={this.handlePublishPressed}
/>
+4
View File
@@ -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)),
});
+11 -2
View File
@@ -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)}
+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} />
)}
+6 -1
View File
@@ -4,7 +4,7 @@ import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/a
import { doSetClientSetting } from 'redux/actions/settings';
import { selectCurrentRoute, selectDrawerStack } from 'redux/selectors/drawer';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import SettingsPage from './view';
const select = state => ({
@@ -13,6 +13,11 @@ const select = state => ({
drawerStack: selectDrawerStack(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 => ({
+102 -4
View File
@@ -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,18 +60,27 @@ 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}>
<PageHeader title={'Settings'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
<ScrollView style={settingsStyle.scrollContainer}>
<Text style={settingsStyle.sectionTitle}>Content</Text>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Enable background media playback</Text>
@@ -79,13 +98,92 @@ class SettingsPage extends React.PureComponent {
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Show NSFW content</Text>
<Text style={settingsStyle.label}>Show mature content</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch value={showNsfw} onValueChange={value => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
</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}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Show URL suggestions</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
value={showUriBarSuggestions}
onValueChange={value => setClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS, value)}
/>
</View>
</View>
<View style={settingsStyle.sectionDivider} />
<Text style={settingsStyle.sectionTitle}>Other</Text>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Keep the daemon background service running after closing the app</Text>
+2 -2
View File
@@ -23,14 +23,14 @@ const select = state => ({
});
const perform = dispatch => ({
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
fetchSubscriptions: callback => dispatch(doFetchMySubscriptions(callback)),
getSync: password => dispatch(doGetSync(password)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
+103 -81
View File
@@ -1,7 +1,7 @@
import React from 'react';
import { Lbry } from 'lbry-redux';
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';
@@ -16,8 +16,6 @@ import splashStyle from 'styles/splash';
const BLOCK_HEIGHT_INTERVAL = 1000 * 60 * 2.5; // every 2.5 minutes
const SETTINGS_GET_INTERVAL = 1000 * 60 * 5; // every 5 minutes
const testingNetwork = 'Testing network';
const waitingForResolution = 'Waiting for name resolution';
@@ -40,12 +38,6 @@ class SplashScreen extends React.PureComponent {
subscriptionsFetched: false,
};
componentWillMount() {
if (NativeModules.DaemonServiceControl) {
NativeModules.DaemonServiceControl.startService();
}
}
updateStatus() {
Lbry.status().then(status => {
this._updateStatusCallback(status);
@@ -60,7 +52,10 @@ class SplashScreen extends React.PureComponent {
});
navigation.dispatch(resetAction);
const launchUrl = 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,17 +86,18 @@ class SplashScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { emailToVerify, getSync, setEmailToVerify, verifyUserEmail, verifyUserEmailFailure } = this.props;
const { daemonReady, shouldAuthenticate } = this.state;
const { user } = nextProps;
if (this.state.daemonReady && this.state.shouldAuthenticate && user && user.id) {
if (daemonReady && shouldAuthenticate && user && user.id) {
this.setState({ shouldAuthenticate: false }, () => {
// user is authenticated, navigate to the main view
if (user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword) {
getSync(walletPassword);
}
this.navigateToMain();
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => {
this.getUserSettings();
this.navigateToMain();
});
});
return;
}
@@ -113,9 +109,22 @@ class SplashScreen extends React.PureComponent {
getUserSettings = () => {
const { populateSharedUserState } = this.props;
Lbryio.call('user_settings', 'get').then(settings => {
populateSharedUserState(settings);
});
doPreferenceGet(
'shared',
preference => {
populateSharedUserState(preference);
},
error => {
/* failed */
}
);
};
onNotificationTargetLaunch = evt => {
if (evt.url && evt.url.startsWith('lbry://')) {
this.setState({ launchUrl: evt.url });
}
};
finishSplashScreen = () => {
@@ -137,28 +146,25 @@ class SplashScreen extends React.PureComponent {
filteredOutpointsSubscribe();
checkSubscriptionsInit();
NativeModules.Firebase.getMessagingToken().then(fcmToken => {
console.log('fcmtoken=' + fcmToken);
// get user settings interval
this.getUserSettings();
setInterval(() => this.getUserSettings(), SETTINGS_GET_INTERVAL);
if (user && user.id && user.has_verified_email) {
// user already authenticated
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword) {
getSync(walletPassword);
}
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();
});
} else {
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true });
authenticate(appVersion, Platform.OS);
});
}
});
});
} else {
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => {
console.log(firebaseToken);
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(() => authenticate(appVersion, Platform.OS));
});
}
});
};
@@ -185,31 +191,35 @@ class SplashScreen extends React.PureComponent {
isRunning: true,
});
// For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
if (walletStatus.is_locked) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
Lbry.wallet_status().then(secureWalletStatus => {
// For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
if ((secureWalletStatus.is_encrypted && !secureWalletStatus.is_locked) || secureWalletStatus.is_locked) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
// unlock the wallet and then finish the splash screen
Lbry.account_unlock({ password: password || '' })
.then(() => {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
})
.catch(() => this.handleAccountUnlockFailed());
} else {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
}
// unlock the wallet and then finish the splash screen
Lbry.wallet_unlock({ password: password || '' }).then(unlocked => {
if (unlocked) {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
} else {
this.handleAccountUnlockFailed();
}
});
} else {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
}
});
});
return;
@@ -252,11 +262,16 @@ class SplashScreen extends React.PureComponent {
}, 1000);
}
componentDidMount() {
if (NativeModules.Firebase) {
NativeModules.Firebase.track('app_launch', null);
}
componentWillMount() {
DeviceEventEmitter.addListener('onNotificationTargetLaunch', this.onNotificationTargetLaunch);
}
componentWillUnmount() {
DeviceEventEmitter.removeListener('onNotificationTargetLaunch', this.onNotificationTargetLaunch);
}
componentDidMount() {
NativeModules.Firebase.track('app_launch', null);
NativeModules.Firebase.setCurrentScreen('Splash');
this.props.fetchRewardedContent();
@@ -264,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
@@ -275,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 = () => {
+1 -3
View File
@@ -3,7 +3,6 @@ import { doToast } from 'lbry-redux';
import {
doCheckSync,
doGetSync,
doSetDefaultAccount,
doSyncApply,
doUserEmailNew,
doUserEmailToVerify,
@@ -55,12 +54,11 @@ const select = state => ({
const perform = dispatch => ({
addUserEmail: email => dispatch(doUserEmailNew(email)),
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
getSync: password => dispatch(doGetSync(password)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
checkSync: () => dispatch(doCheckSync()),
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
@@ -37,11 +37,17 @@ class SyncVerifyPage extends React.PureComponent {
if (!hasSyncedWallet) {
// fresh account with no sync
const newPassword = this.state.password ? this.state.password : '';
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
if (newPassword.trim().length === 0) {
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
navigation.goBack();
});
} else {
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
navigation.goBack();
});
}
} else {
syncApply(syncHash, syncData, this.state.password ? this.state.password : '');
}
@@ -50,7 +56,7 @@ class SyncVerifyPage extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps;
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting, setDefaultAccount } = this.props;
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting } = this.props;
if (this.state.checkSyncStarted && !getSyncIsPending) {
this.setState({ syncChecked: true });
}
@@ -63,17 +69,12 @@ class SyncVerifyPage extends React.PureComponent {
// password successfully verified
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_FIRST_RUN_PASSWORD,
Constants.KEY_WALLET_PASSWORD,
this.state.password ? this.state.password : ''
);
}
setDefaultAccount(
() => this.finishSync(true),
err => {
// fail silently and still finish
this.finishSync();
}
);
this.finishSync(true);
}
}
}
@@ -84,15 +85,17 @@ class SyncVerifyPage extends React.PureComponent {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
// unlock the wallet (if locked)
Lbry.status().then(status => {
if (status.wallet.is_locked) {
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
.then(() => navigation.goBack())
.catch(err => {
Lbry.wallet_status().then(status => {
if (status.is_locked) {
Lbry.wallet_unlock({ password: this.state.password ? this.state.password : '' }).then(unlocked => {
if (unlocked) {
navigation.goBack();
} else {
if (notifyUnlockFailed) {
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
}
});
}
});
} else {
navigation.goBack();
}
-2
View File
@@ -101,7 +101,6 @@ class VerificationScreen extends React.PureComponent {
notify,
addUserPhone,
getSyncIsPending,
setDefaultAccount,
hasSyncedWallet,
setSyncIsPending,
syncApplyIsPending,
@@ -162,7 +161,6 @@ class VerificationScreen extends React.PureComponent {
notify={notify}
setEmailVerificationPhase={this.setEmailVerificationPhase}
setClientSetting={setClientSetting}
setDefaultAccount={setDefaultAccount}
setSyncIsPending={setSyncIsPending}
syncApplyIsPending={syncApplyIsPending}
syncApplyErrorMessage={syncApplyErrorMessage}
+2 -2
View File
@@ -5,7 +5,7 @@ import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import { selectBalance } from 'lbry-redux';
import { doCheckSync, doGetSync, selectUser, selectHasSyncedWallet } from 'lbryinc';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import WalletPage from './view';
const select = state => ({
@@ -21,7 +21,7 @@ const select = state => ({
const perform = dispatch => ({
checkSync: () => dispatch(doCheckSync()),
getSync: password => dispatch(doGetSync(password)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_WALLET)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
+8 -27
View File
@@ -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';
@@ -46,10 +47,8 @@ class WalletPage extends React.PureComponent {
const { deviceWalletSynced, getSync, user } = this.props;
if (deviceWalletSynced && user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword) {
getSync(walletPassword);
}
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword);
});
}
};
@@ -68,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>
);
}
+29
View File
@@ -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));
};
+4
View File
@@ -172,6 +172,10 @@ const channelPageStyle = StyleSheet.create({
deleteButton: {
marginLeft: 8,
},
shareButton: {
marginLeft: 8,
marginRight: 8,
},
});
export default channelPageStyle;
+1
View File
@@ -19,6 +19,7 @@ const Colors = {
VeryLightGrey: '#f1f1f1',
White: '#ffffff',
UriDescBlue: '#3971db',
RewardDriverBlue: '#2196f3',
StatsAudio: '#f6a637',
StatsImage: '#ff4a7d',
+59 -3
View File
@@ -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;
+59 -1
View File
@@ -348,13 +348,17 @@ const filePageStyle = StyleSheet.create({
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.BrighterLbryGreen,
backgroundColor: Colors.RewardDriverBlue,
flexDirection: 'row',
paddingLeft: 16,
paddingRight: 16,
paddingTop: 12,
paddingBottom: 12,
},
rewardDriverIcon: {
color: Colors.White,
marginRight: 8,
},
rewardDriverText: {
fontFamily: 'Inter-UI-Regular',
color: Colors.White,
@@ -377,6 +381,60 @@ const filePageStyle = StyleSheet.create({
backButtonIcon: {
color: Colors.White,
},
largeButton: {
alignItems: 'center',
justifyContent: 'center',
marginRight: 48,
},
largeButtonIcon: {
color: Colors.DescriptionGrey,
},
largeButtonText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
marginTop: 4,
},
largeButtonsRow: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 20,
marginRight: 20,
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;
+6
View File
@@ -209,6 +209,12 @@ const firstRunStyle = StyleSheet.create({
revealIcon: {
color: Colors.White,
},
tosLink: {
textDecorationLine: 'underline',
},
tosParagraph: {
marginTop: 48,
},
});
export default firstRunStyle;
+1 -1
View File
@@ -297,7 +297,7 @@ const publishStyle = StyleSheet.create({
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.BrighterLbryGreen,
backgroundColor: Colors.RewardDriverBlue,
flexDirection: 'row',
paddingLeft: 16,
paddingRight: 16,
+6 -4
View File
@@ -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
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%',
+15
View File
@@ -39,6 +39,21 @@ const settingsStyle = StyleSheet.create({
fontFamily: 'Inter-UI-Regular',
lineHeight: 18,
},
sectionTitle: {
fontFamily: 'Inter-UI-Regular',
fontSize: 20,
marginBottom: 4,
},
sectionDescription: {
color: '#aaaaaa',
fontFamily: 'Inter-UI-Regular',
fontSize: 12,
lineHeight: 18,
marginBottom: 8,
},
sectionDivider: {
marginTop: 24,
},
});
export default settingsStyle;
+5 -4
View File
@@ -36,7 +36,7 @@ const uriBarStyle = StyleSheet.create({
},
overlay: {
position: 'absolute',
backgroundColor: 'transparent',
backgroundColor: 'red',
top: 0,
width: '100%',
zIndex: 200,
@@ -54,9 +54,10 @@ const uriBarStyle = StyleSheet.create({
item: {
flexDirection: 'row',
alignItems: 'center',
padding: 12,
paddingTop: 8,
paddingBottom: 8,
paddingLeft: 16,
paddingRight: 16,
paddingTop: 12,
paddingBottom: 12,
},
itemContent: {
marginLeft: 12,
+47 -1
View File
@@ -198,7 +198,7 @@ const walletStyle = StyleSheet.create({
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.BrighterLbryGreen,
backgroundColor: Colors.RewardDriverBlue,
flexDirection: 'row',
padding: 16,
marginLeft: 16,
@@ -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;
+23
View File
@@ -1,5 +1,6 @@
import { NavigationActions, StackActions } from 'react-navigation';
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
@@ -290,6 +291,23 @@ export function __(str) {
return str;
}
export function logPublish(claimResult) {
// eslint-disable-next-line no-undef
if (!__DEV__) {
const { permanent_url: uri, claim_id: claimId, txid, nout, signing_channel: signingChannel } = claimResult;
let channelClaimId;
if (signingChannel) {
channelClaimId = signingChannel.claim_id;
}
const outpoint = `${txid}:${nout}`;
const params = { uri, claim_id: claimId, outpoint };
if (channelClaimId) {
params['channel_claim_id'] = channelClaimId;
}
Lbryio.call('event', 'publish', params);
}
}
export function uploadImageAsset(filePath, success, failure) {
const makeid = () => {
let text = '';
@@ -328,3 +346,8 @@ export function uploadImageAsset(filePath, success, failure) {
}
});
}
// TODO: Move this to lbry-redux
export function formatLbryUrlForWeb(url) {
return url.replace('lbry://', '/').replace(/#/g, ':');
}