Compare commits

..
12 Commits
61 changed files with 429 additions and 941 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2017-2019 LBRY Inc
Copyright (c) 2017-2018 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:
+7 -10
View File
@@ -5640,8 +5640,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
"from": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
"version": "github:lbryio/lbry-redux#d44cd9ca56dee784dba42c0cc13061ae75cbd46c",
"from": "github:lbryio/lbry-redux#d44cd9ca56dee784dba42c0cc13061ae75cbd46c",
"requires": {
"proxy-polyfill": "0.1.6",
"reselect": "^3.0.0",
@@ -5649,8 +5649,8 @@
}
},
"lbryinc": {
"version": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
"from": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
"version": "github:lbryio/lbryinc#d250096a6fc5df16be4f82812ecce28d6e558b6e",
"from": "github:lbryio/lbryinc#d250096a6fc5df16be4f82812ecce28d6e558b6e",
"requires": {
"reselect": "^3.0.0"
}
@@ -8402,12 +8402,9 @@
}
},
"react-navigation-drawer": {
"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"
}
"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=="
},
"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#9919a8150998822ca997cd23418f023d64d4a3da",
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
"lbry-redux": "lbryio/lbry-redux#d44cd9ca56dee784dba42c0cc13061ae75cbd46c",
"lbryinc": "lbryio/lbryinc#d250096a6fc5df16be4f82812ecce28d6e558b6e",
"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": "^1.4.0",
"react-navigation-drawer": "^2.2.2",
"react-navigation-redux-helpers": "^3.0.2",
"react-navigation-stack": "^1.8.1",
"react-redux": "^5.0.3",
+6 -38
View File
@@ -29,7 +29,7 @@ import {
import { connect } from 'react-redux';
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doToast, selectToast } from 'lbry-redux';
import {
Lbryio,
doGetSync,
@@ -39,7 +39,6 @@ import {
selectEmailToVerify,
selectEmailVerifyIsPending,
selectEmailVerifyErrorMessage,
selectHashChanged,
selectUser,
} from 'lbryinc';
import { makeSelectClientSetting } from 'redux/selectors/settings';
@@ -54,8 +53,6 @@ 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"
@@ -214,7 +211,7 @@ const drawer = createDrawerNavigator(
},
},
{
drawerWidth: 280,
drawerWidth: 300,
drawerBackgroundColor: 'transparent',
headerMode: 'none',
backBehavior: 'none',
@@ -272,11 +269,9 @@ class AppWithNavigationState extends React.Component {
constructor() {
super();
this.emailVerifyCheckInterval = null;
this.syncGetInterval = null;
this.state = {
emailVerifyDone: false,
verifyPending: false,
syncHashChanged: false,
};
}
@@ -297,17 +292,8 @@ class AppWithNavigationState extends React.Component {
}
componentDidMount() {
const { dispatch } = this.props;
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
Linking.addEventListener('url', this._handleUrl);
// call /sync/get with interval
this.syncGetInterval = setInterval(() => {
this.setState({ syncHashChanged: false }); // reset local state
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
});
}, SYNC_GET_INTERVAL);
}
checkEmailVerification = () => {
@@ -322,31 +308,19 @@ class AppWithNavigationState extends React.Component {
getUserSettings = () => {
const { dispatch } = this.props;
doPreferenceGet(
'shared',
preference => {
dispatch(doPopulateSharedUserState(preference));
},
error => {
/* failed */
}
);
Lbryio.call('user_settings', 'get').then(settings => {
dispatch(doPopulateSharedUserState(settings));
});
};
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, hashChanged } = this.props;
const { dispatch, user } = 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');
@@ -358,11 +332,6 @@ 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) {
@@ -469,7 +438,6 @@ 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),
@@ -1,4 +0,0 @@
import { connect } from 'react-redux';
import ChannelRewardsDriver from './view';
export default connect()(ChannelRewardsDriver);
@@ -1,22 +0,0 @@
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
import publishStyle from 'styles/publish';
class ChannelRewardsDriver extends React.PureComponent<Props> {
render() {
const { navigation } = this.props;
return (
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
<Text style={publishStyle.rewardDriverText}>
Channel creation requires credits.{'\n'}Tap here to get some for free.
</Text>
</TouchableOpacity>
);
}
}
export default ChannelRewardsDriver;
-2
View File
@@ -7,7 +7,6 @@ import {
doCreateChannel,
doToast,
} from 'lbry-redux';
import { doGetSync } from 'lbryinc';
import ChannelSelector from './view';
const select = state => ({
@@ -20,7 +19,6 @@ 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(
+12 -19
View File
@@ -1,7 +1,6 @@
import React from 'react';
import { CLAIM_VALUES, isNameValid } from 'lbry-redux';
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { logPublish } from 'utils/helper';
import { CLAIM_VALUES, isURIValid } from 'lbry-redux';
import { ActivityIndicator, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
import Button from 'component/button';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
@@ -86,7 +85,7 @@ export default class ChannelSelector extends React.PureComponent {
newChannelName = newChannelName.slice(1);
}
if (newChannelName.trim().length > 0 && !isNameValid(newChannelName)) {
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
newChannelNameError = 'Your channel name contains invalid characters.';
} else if (this.channelExists(newChannelName)) {
newChannelNameError = 'You have already created a channel with the same name.';
@@ -118,10 +117,10 @@ export default class ChannelSelector extends React.PureComponent {
};
handleCreateChannelClick = () => {
const { balance, createChannel, getSync, onChannelChange, notify } = this.props;
const { balance, createChannel, onChannelChange, notify } = this.props;
const { newChannelBid, newChannelName } = this.state;
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
notify({ message: 'Your channel name contains invalid characters.' });
return;
}
@@ -143,21 +142,17 @@ export default class ChannelSelector extends React.PureComponent {
createChannelError: undefined,
});
const success = channelClaim => {
const success = () => {
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 = () => {
@@ -172,14 +167,12 @@ export default class ChannelSelector extends React.PureComponent {
channelExists = name => {
const { channels = [] } = this.props;
if (channels) {
for (let channel of channels) {
if (
name.toLowerCase() === channel.name.toLowerCase() ||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
) {
return true;
}
for (let channel of channels) {
if (
name.toLowerCase() === channel.name.toLowerCase() ||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
) {
return true;
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ import claimListStyle from 'styles/claimList';
import discoverStyle from 'styles/discover';
import moment from 'moment';
const horizontalLimit = 10;
const horizontalLimit = 7;
const softLimit = 500;
class ClaimList extends React.PureComponent {
+1 -3
View File
@@ -10,15 +10,13 @@ import {
makeSelectClaimIsNsfw,
makeSelectShortUrlForUri,
} from 'lbry-redux';
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
import { 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),
+1 -13
View File
@@ -40,12 +40,10 @@ class FileItem extends React.PureComponent {
render() {
const {
blackListedOutpoints,
claim,
title,
thumbnail,
fileInfo,
filteredOutpoints,
metadata,
isResolvingUri,
rewardedContentClaimIds,
@@ -60,17 +58,7 @@ class FileItem extends React.PureComponent {
} = this.props;
if (claim && claim.value_type === 'channel') {
// don't display channels in the lists on the Your tags page
return null;
}
let shouldHide = false;
if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = 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
// don't display channels in the lists on the Explore page
return null;
}
+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.rewardDriverIcon} />
<Icon name="award" size={16} style={filePageStyle.rewardIcon} />
<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), 1, true)}</Text>
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 0, true)}</Text>
)}
</TouchableOpacity>
</View>
@@ -1,4 +0,0 @@
import { connect } from 'react-redux';
import ModalSuggestedSubscriptions from './view';
export default connect()(ModalSuggestedSubscriptions);
@@ -1,26 +0,0 @@
import React from 'react';
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
import modalStyle from 'styles/modal';
import subscriptionsStyle from 'styles/subscriptions';
import Button from 'component/button';
import Colors from 'styles/colors';
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Icon from 'react-native-vector-icons/FontAwesome5';
export default class ModalSuggestedSubcriptions extends React.PureComponent {
render() {
const { navigation, onDonePress, onOverlayPress } = this.props;
return (
<TouchableOpacity style={modalStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
<TouchableOpacity style={[modalStyle.container, subscriptionsStyle.modalContainer]} activeOpacity={1}>
<SuggestedSubscriptions inModal navigation={navigation} />
<View style={modalStyle.buttons}>
<Button style={modalStyle.doneButton} text={'Done'} onPress={onDonePress} />
</View>
</TouchableOpacity>
</TouchableOpacity>
);
}
}
+2 -2
View File
@@ -55,7 +55,7 @@ export default class ModalTagSelector extends React.PureComponent {
return (
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
<View style={modalTagSelectorStyle.container}>
<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>
</TouchableOpacity>
</View>
</TouchableOpacity>
);
}
+3 -5
View File
@@ -4,19 +4,17 @@ import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
import publishStyle from 'styles/publish';
class PublishRewardsDriver extends React.PureComponent<Props> {
class PublishRewadsDriver extends React.PureComponent<Props> {
render() {
const { navigation } = this.props;
return (
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
<Text style={publishStyle.rewardDriverText}>
Publishing requires credits.{'\n'}Tap here to get some for free.
</Text>
<Text style={publishStyle.rewardDriverText}>Earn some credits to be able to publish your content.</Text>
</TouchableOpacity>
);
}
}
export default PublishRewardsDriver;
export default PublishRewadsDriver;
+6 -16
View File
@@ -1,8 +1,8 @@
import React from 'react';
import { Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
import { 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 Constants from 'constants';
import Link from 'component/link';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
@@ -24,10 +24,6 @@ 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;
@@ -35,25 +31,19 @@ class RewardEnrolment extends React.Component {
<View style={rewardStyle.enrollContainer} onPress>
<View style={rewardStyle.summaryRow}>
<Icon name="award" size={36} color={Colors.White} />
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} available credits</Text>
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} unclaimed credits</Text>
</View>
<View style={rewardStyle.onboarding}>
<Text style={rewardStyle.enrollDescText}>
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} />.
LBRY credits allow you to purchase content, publish content, and influence the network. You can start
earning credits by watching videos on LBRY.
</Text>
</View>
<View style={rewardStyle.buttonRow}>
<Link style={rewardStyle.notInterestedLink} text={'Not interested'} onPress={this.onNotInterestedPressed} />
<Button
style={rewardStyle.enrollButton}
theme={'light'}
text={'Get started'}
onPress={this.onEnrollPressed}
/>
<Button style={rewardStyle.enrollButton} theme={'light'} text={'Enroll'} 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 (isDismissed === 'true') {
if ('true' === isDismissed) {
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} available credits</Text>
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} unclaimed credits</Text>
</View>
<Button style={rewardStyle.dismissButton} theme={'light'} text={'Dismiss'} onPress={this.onDismissPressed} />
</TouchableOpacity>
@@ -1,7 +1,6 @@
import { connect } from 'react-redux';
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
import { selectShowNsfw } from 'redux/selectors/settings';
import SuggestedSubscriptions from './view';
const select = state => ({
@@ -9,7 +8,6 @@ const select = state => ({
suggested: selectSuggestedChannels(state),
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
claimSearchByQuery: selectClaimSearchByQuery(state),
showNsfwContent: selectShowNsfw(state),
});
const perform = dispatch => ({
+7 -12
View File
@@ -1,6 +1,6 @@
import React from 'react';
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
import { ActivityIndicator, FlatList, SectionList, Text, View } from 'react-native';
import { createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
import { __, navigateToUri } from 'utils/helper';
import SubscribeButton from 'component/subscribeButton';
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
@@ -16,16 +16,13 @@ class SuggestedSubscriptions extends React.PureComponent {
};
componentDidMount() {
const { claimSearch, followedTags, showNsfwContent } = this.props;
const { claimSearch, followedTags } = this.props;
const options = {
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
page: 1,
no_totals: true,
claim_type: 'channel',
};
if (!showNsfwContent) {
options.not_tags = MATURE_TAGS;
}
this.setState({ options });
claimSearch(options);
}
@@ -38,7 +35,7 @@ class SuggestedSubscriptions extends React.PureComponent {
const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : [];
return [
{
title: __('Suggested channels'),
title: __('Tags you follow'),
data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [],
},
{
@@ -49,7 +46,7 @@ class SuggestedSubscriptions extends React.PureComponent {
};
render() {
const { suggested, inModal, loading, navigation } = this.props;
const { suggested, loading, navigation } = this.props;
if (loading) {
return (
@@ -61,10 +58,8 @@ class SuggestedSubscriptions extends React.PureComponent {
return (
<SectionList
style={inModal ? subscriptionsStyle.modalScrollContainer : subscriptionsStyle.scrollContainer}
contentContainerStyle={
inModal ? subscriptionsStyle.modalSuggestedScrollContent : subscriptionsStyle.suggestedScrollContent
}
style={subscriptionsStyle.scrollContainer}
contentContainerStyle={subscriptionsStyle.suggestedScrollPadding}
renderItem={({ item, index, section }) => (
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
)}
-3
View File
@@ -4,10 +4,8 @@ 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 => {
@@ -18,7 +16,6 @@ const select = state => {
query: selectSearchValue(state),
currentRoute: selectCurrentRoute(state),
suggestions: selectSearchSuggestions(state),
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
};
};
@@ -20,10 +20,6 @@ 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} />;
@@ -41,7 +37,6 @@ 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>
+39 -65
View File
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
import { Dimensions, FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { 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,8 +14,6 @@ class UriBar extends React.PureComponent {
textInput = null;
keyboardDidShowListener = null;
keyboardDidHideListener = null;
state = {
@@ -23,19 +21,17 @@ class UriBar extends React.PureComponent {
currentValue: null,
inputText: null,
focused: false,
keyboardHeight: 0,
// TODO: Add a setting to enable / disable direct search?
directSearch: true,
};
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();
}
@@ -53,28 +49,25 @@ class UriBar extends React.PureComponent {
handleChangeText = text => {
const newValue = text || '';
clearTimeout(this.state.changeTextTimeout);
const { updateSearchQuery, onSearchSubmitted, showUriBarSuggestions, navigation } = this.props;
const { updateSearchQuery, onSearchSubmitted, navigation } = this.props;
updateSearchQuery(text);
let timeout = setTimeout(() => {
if (text.trim().length === 0) {
// don't do anything if the text is empty
return;
}
let timeout = -1;
if (!showUriBarSuggestions) {
timeout = setTimeout(() => {
if (text.trim().length === 0) {
// don't do anything if the text is empty
return;
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 } });
}
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);
}
}
}, UriBar.INPUT_TIMEOUT);
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
};
@@ -93,34 +86,18 @@ class UriBar extends React.PureComponent {
return;
}
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(),
},
});
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value } });
} 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, keyboardHeight: 0 });
this.setState({ focused: false });
};
setSelection() {
@@ -175,18 +152,16 @@ 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,
this.state.focused && showUriBarSuggestions ? uriBarStyle.inFocus : null,
];
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); } */
// TODO: selectionModeActions should be dynamically created / specified
return (
@@ -273,21 +248,20 @@ 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>
);
}
+1 -6
View File
@@ -1,9 +1,4 @@
import { connect } from 'react-redux';
import { selectUnclaimedRewardValue } from 'lbryinc';
import WalletRewardsDriver from './view';
const select = state => ({
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
});
export default connect(select)(WalletRewardsDriver);
export default connect()(WalletRewardsDriver);
+2 -5
View File
@@ -5,15 +5,12 @@ import walletStyle from 'styles/wallet';
class WalletRewardsDriver extends React.PureComponent<Props> {
render() {
const { navigation, unclaimedRewardAmount } = this.props;
const { navigation } = this.props;
return (
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
<Text style={walletStyle.rewardDriverText}>
Get {unclaimedRewardAmount > 0 ? unclaimedRewardAmount : ''} free credit
{unclaimedRewardAmount === 1 ? '' : 's'} after creating an account.
</Text>
<Text style={walletStyle.rewardDriverText}>Earn credits while using the LBRY app.</Text>
</TouchableOpacity>
);
}
+1 -3
View File
@@ -32,7 +32,7 @@ const Constants = {
ABOUT_TAB: 'about',
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
KEY_WALLET_PASSWORD: 'firstRunPassword',
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword',
KEY_FIRST_USER_AUTH: 'firstUserAuth',
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
@@ -138,8 +138,6 @@ const Constants = {
MORE_PLACEHOLDER: '_more',
TRUE_STRING: 'true',
MINIMUM_TRANSACTION_BALANCE: 0.1,
};
export default Constants;
+27 -59
View File
@@ -4,8 +4,6 @@ import { Provider, connect } from 'react-redux';
import { AppRegistry, Text, View, NativeModules } from 'react-native';
import {
Lbry,
buildSharedStateMiddleware,
blockedReducer,
claimsReducer,
contentReducer,
fileReducer,
@@ -15,24 +13,19 @@ 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,
@@ -40,7 +33,6 @@ 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';
@@ -50,6 +42,7 @@ 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) {
@@ -88,27 +81,18 @@ 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']);
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']);
const settingsFilter = createFilter('settings', ['clientSettings']);
const tagsFilter = createFilter('tags', ['followedTags']);
const walletFilter = createFilter('wallet', ['receiveAddress']);
const v4PersistOptions = {
whitelist: ['auth', 'blocked', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
// Order is important. Needs to be compressed last or other transforms can't
// read the data
transforms: [
authFilter,
blockedFilter,
saveClaimsFilter,
subscriptionsFilter,
settingsFilter,
walletFilter,
compressor,
],
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
debounce: 10000,
storage: FilesystemStorage,
};
@@ -121,7 +105,6 @@ const persistOptions = Object.assign({}, v4PersistOptions, {
const reducers = persistCombineReducers(persistOptions, {
auth: authReducer,
blacklist: blacklistReducer,
blocked: blockedReducer,
claims: claimsReducer,
content: contentReducer,
costInfo: costInfoReducer,
@@ -144,45 +127,8 @@ 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 = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = compose;
@@ -201,6 +147,28 @@ 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;
-2
View File
@@ -12,7 +12,6 @@ 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';
@@ -38,7 +37,6 @@ 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)),
+34 -64
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { CLAIM_VALUES, isNameValid, regexInvalidURI } from 'lbry-redux';
import { CLAIM_VALUES, isURIValid, regexInvalidURI } from 'lbry-redux';
import {
ActivityIndicator,
Alert,
@@ -14,10 +14,9 @@ import {
TouchableOpacity,
View,
} from 'react-native';
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
import { navigateToUri, uploadImageAsset } from 'utils/helper';
import Button from 'component/button';
import ChannelIconItem from 'component/channelIconItem';
import ChannelRewardsDriver from 'component/channelRewardsDriver';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import EmptyStateView from 'component/emptyStateView';
@@ -32,11 +31,9 @@ import channelIconStyle from 'styles/channelIcon';
import seedrandom from 'seedrandom';
export default class ChannelCreator extends React.PureComponent {
scrollView = null;
state = {
autoStyle: null,
canSave: true,
canSave: false,
claimId: null,
currentSelectedValue: Constants.ITEM_ANONYMOUS,
currentPhase: null,
@@ -104,13 +101,11 @@ export default class ChannelCreator extends React.PureComponent {
generateAutoStyles = size => {
const { channels = [] } = this.props;
const autoStyles = [];
if (channels) {
for (let i = 0; i < size && i < channels.length; i++) {
// seed generator using the claim_id
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
}
for (let i = 0; i < size && i < channels.length; i++) {
// seed generator using the claim_id
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
}
return autoStyles;
};
@@ -163,6 +158,9 @@ 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);
@@ -338,7 +336,7 @@ export default class ChannelCreator extends React.PureComponent {
newChannelName = newChannelName.slice(1);
}
if (newChannelName.trim().length > 0 && !isNameValid(newChannelName)) {
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
newChannelNameError = 'Your channel name contains invalid characters.';
} else if (this.channelExists(newChannelName)) {
newChannelNameError = 'You have already created a channel with the same name.';
@@ -375,15 +373,7 @@ export default class ChannelCreator extends React.PureComponent {
};
handleCreateChannelClick = () => {
const {
balance,
clearChannelFormState,
createChannel,
onChannelChange,
getSync,
notify,
updateChannel,
} = this.props;
const { balance, clearChannelFormState, createChannel, onChannelChange, notify, updateChannel } = this.props;
const {
claimId,
coverImageUrl,
@@ -399,17 +389,7 @@ 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)) {
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
notify({ message: 'Your channel name contains invalid characters.' });
return;
}
@@ -440,7 +420,7 @@ export default class ChannelCreator extends React.PureComponent {
createChannelError: undefined,
});
const success = channelClaim => {
const success = () => {
this.setState({
creatingChannel: false,
addingChannel: false,
@@ -456,8 +436,6 @@ export default class ChannelCreator extends React.PureComponent {
clearChannelFormState();
notify({ message: 'The channel was successfully created.' });
this.showChannelList();
logPublish(channelClaim);
};
const failure = () => {
@@ -475,8 +453,8 @@ export default class ChannelCreator extends React.PureComponent {
return { name: tag };
}),
website,
coverUrl: coverImageUrl,
thumbnailUrl: thumbnailUrl,
cover: coverImageUrl,
thumbnail: thumbnailUrl,
};
if (this.state.editMode) {
@@ -500,14 +478,12 @@ export default class ChannelCreator extends React.PureComponent {
channelExists = name => {
const { channels = [] } = this.props;
if (channels) {
for (let channel of channels) {
if (
name.toLowerCase() === channel.name.toLowerCase() ||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
) {
return true;
}
for (let channel of channels) {
if (
name.toLowerCase() === channel.name.toLowerCase() ||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
) {
return true;
}
}
@@ -567,7 +543,7 @@ export default class ChannelCreator extends React.PureComponent {
resetChannelCreator = () => {
this.setState({
canSave: true,
canSave: false,
claimId: null,
editMode: false,
displayName: null,
@@ -581,8 +557,8 @@ export default class ChannelCreator extends React.PureComponent {
newChannelBidError: '',
createChannelError: undefined,
showCreateChannel: false,
thumbnailUrl: '',
coverImageUrl: '',
thumbnailUrl: null,
coverImageUrl: null,
avatarImagePickerOpen: false,
coverImagePickerOpen: false,
@@ -624,17 +600,16 @@ export default class ChannelCreator extends React.PureComponent {
};
prepareEdit = channel => {
const { balance, pushDrawerStack } = this.props;
const { pushDrawerStack } = this.props;
const { value } = channel;
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
this.setState({
canSave: true,
claimId: channel.claim_id,
currentPhase: Constants.PHASE_CREATE,
displayName: value && value.title ? value.title : channel.name.substring(1),
editMode: true,
coverImageUrl: value && value.cover ? value.cover.url : '',
coverImageUrl: value && value.cover ? value.cover.url : null,
currentChannelName: channel.name.substring(1),
newChannelName: channel.name.substring(1),
newChannelTitle: value ? value.title : null,
@@ -643,7 +618,7 @@ export default class ChannelCreator extends React.PureComponent {
email: value ? value.email : null,
website: value ? value.website_url : null,
tags: value && value.tags ? value.tags : [],
thumbnailUrl: value && value.thumbnail ? value.thumbnail.url : '',
thumbnailUrl: value && value.thumbnail ? value.thumbnail.url : null,
showOptionalFields: value && (value.description || value.email || value.website_url || value.tags),
});
};
@@ -749,7 +724,7 @@ export default class ChannelCreator extends React.PureComponent {
};
render() {
const { abandoningClaimIds, balance, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
const { abandoningClaimIds, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
const {
autoStyle,
autoStyles,
@@ -860,7 +835,7 @@ export default class ChannelCreator extends React.PureComponent {
)}
{currentPhase === Constants.PHASE_CREATE && (
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
<ScrollView style={channelCreatorStyle.createChannelContainer}>
<View style={channelCreatorStyle.imageSelectors}>
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
<Image
@@ -893,7 +868,7 @@ export default class ChannelCreator extends React.PureComponent {
source={{ uri: thumbnailUrl }}
/>
)}
{(thumbnailUrl === null || thumbnailUrl.trim().length === 0) && newChannelName.length > 0 && (
{(thumbnailUrl === null || thumbnailUrl.trim().length === 0) && newChannelName.length > 1 && (
<Text style={channelIconStyle.autothumbCharacter}>
{newChannelName.substring(0, 1).toUpperCase()}
</Text>
@@ -905,7 +880,6 @@ export default class ChannelCreator extends React.PureComponent {
</TouchableOpacity>
</View>
</View>
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
<View style={channelCreatorStyle.card}>
<View style={channelCreatorStyle.textInputLayout}>
@@ -933,7 +907,7 @@ export default class ChannelCreator extends React.PureComponent {
<View>
<Text style={channelCreatorStyle.channelAt}>@</Text>
<TextInput
editable={canSave && !editMode && !creatingChannel && !updatingChannel}
editable={canSave && !creatingChannel && !updatingChannel}
style={channelCreatorStyle.channelNameInput}
value={this.state.newChannelName}
onChangeText={value => this.handleNewChannelNameChange(value, true)}
@@ -947,10 +921,6 @@ export default class ChannelCreator extends React.PureComponent {
{newChannelNameError.length > 0 && (
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
)}
{editMode && (
<Text style={channelCreatorStyle.helpText}>The channel name cannot be changed while editing.</Text>
)}
<View style={channelCreatorStyle.bidRow}>
<Text style={channelCreatorStyle.label}>Deposit</Text>
<TextInput
@@ -1065,7 +1035,7 @@ export default class ChannelCreator extends React.PureComponent {
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
<Button
style={channelCreatorStyle.createButton}
disabled={!canSave || uploadingImage}
disabled={!canSave || uploadingImage || !newChannelName || newChannelName.trim().length === 0}
text={editMode ? 'Update' : 'Create'}
onPress={this.handleCreateChannelClick}
/>
-2
View File
@@ -11,7 +11,6 @@ import {
selectSubscriptionClaims,
selectUnreadSubscriptions,
} from 'lbryinc';
import { doPushDrawerStack } from 'redux/actions/drawer';
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
@@ -38,7 +37,6 @@ const perform = dispatch => ({
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
fileList: () => dispatch(doFileList()),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_DISCOVER)),
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setSortByItem: item => dispatch(doSetSortByItem(item)),
+46 -53
View File
@@ -38,6 +38,8 @@ class DiscoverPage extends React.PureComponent {
};
componentDidMount() {
NativeModules.Firebase.setCurrentScreen('Your tags');
// Track the total time taken if this is the first launch
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
@@ -61,39 +63,17 @@ class DiscoverPage extends React.PureComponent {
}
});
const { sortByItem, fetchRewardedContent, fileList, followedTags } = this.props;
const { sortByItem, fetchRewardedContent, fetchSubscriptions, fileList, followedTags } = this.props;
this.buildTagCollection(followedTags);
fetchRewardedContent();
fetchSubscriptions();
fileList();
this.handleSortByItemSelected(sortByItem);
this.showRatingReminder();
this.onComponentFocused();
}
componentWillReceiveProps(nextProps) {
const { currentRoute: prevRoute, followedTags: prevFollowedTags } = this.props;
const { currentRoute, followedTags } = nextProps;
if (Constants.DRAWER_ROUTE_DISCOVER === currentRoute && currentRoute !== prevRoute) {
this.onComponentFocused();
}
if (!_.isEqual(followedTags, prevFollowedTags)) {
this.buildTagCollection(followedTags);
}
}
onComponentFocused = () => {
const { fetchSubscriptions, pushDrawerStack } = this.props;
// pushDrawerStack();
NativeModules.Firebase.setCurrentScreen('Your tags').then(result => {
fetchSubscriptions();
});
};
handleSortByItemSelected = item => {
const { setSortByItem } = this.props;
setSortByItem(item);
@@ -124,43 +104,56 @@ class DiscoverPage extends React.PureComponent {
return null;
};
componentWillReceiveProps(nextProps) {
const { followedTags: prevFollowedTags } = this.props;
const { followedTags } = nextProps;
if (!_.isEqual(followedTags, prevFollowedTags)) {
this.buildTagCollection(followedTags);
}
}
componentDidUpdate(prevProps, prevState) {
const { unreadSubscriptions, enabledChannelNotifications } = this.props;
const utility = NativeModules.UtilityModule;
const hasUnread =
prevProps.unreadSubscriptions &&
prevProps.unreadSubscriptions.length !== unreadSubscriptions.length &&
unreadSubscriptions.length > 0;
if (utility) {
const hasUnread =
prevProps.unreadSubscriptions &&
prevProps.unreadSubscriptions.length !== unreadSubscriptions.length &&
unreadSubscriptions.length > 0;
if (hasUnread) {
unreadSubscriptions.map(({ channel, uris }) => {
const { claimName: channelName } = parseURI(channel);
if (hasUnread) {
unreadSubscriptions.map(({ channel, uris }) => {
const { claimName: channelName } = parseURI(channel);
// check if notifications are enabled for the channel
if (enabledChannelNotifications.includes(channelName)) {
uris.forEach(uri => {
Lbry.resolve({ urls: uri }).then(result => {
const sub = result[uri];
if (sub && sub.value) {
const { source, title, thumbnail } = sub.value;
const isPlayable =
source && source.media_type && ['audio', 'video'].includes(source.media_type.substring(0, 5));
if (title) {
utility.showNotificationForContent(
uri,
title,
channelName,
thumbnail ? thumbnail.url : null,
isPlayable
);
// check if notifications are enabled for the channel
if (enabledChannelNotifications.indexOf(channelName) > -1) {
uris.forEach(uri => {
Lbry.resolve({ urls: uri }).then(result => {
const sub = result[uri].claim;
if (sub && sub.value && sub.value.stream) {
let isPlayable = false;
const source = sub.value.stream.source;
const metadata = sub.value.stream.metadata;
if (source) {
isPlayable =
source.contentType && ['audio', 'video'].indexOf(source.contentType.substring(0, 5)) > -1;
}
if (metadata) {
utility.showNotificationForContent(
uri,
metadata.title,
channelName,
metadata.thumbnail,
isPlayable
);
}
}
}
});
});
});
}
});
}
});
}
}
}
-2
View File
@@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import {
doAbandonClaim,
doFetchFileInfo,
doFetchChannelListMine,
doFetchClaimListMine,
@@ -74,7 +73,6 @@ const select = (state, props) => {
};
const perform = dispatch => ({
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
+9 -52
View File
@@ -6,7 +6,6 @@ import {
Alert,
DeviceEventEmitter,
Dimensions,
Linking,
NativeModules,
ScrollView,
StatusBar,
@@ -241,7 +240,7 @@ class FilePage extends React.PureComponent {
};
onDeletePressed = () => {
const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props;
const { claim, deleteFile, deletePurchasedUri, fileInfo, navigation } = this.props;
Alert.alert(
'Delete file',
@@ -263,16 +262,6 @@ class FilePage extends React.PureComponent {
mediaLoaded: false,
stopDownloadConfirmed: false,
});
if (claim) {
const fullUri = normalizeURI(`${claim.name}#${claim.claim_id}`);
const ownedClaim = myClaimUris.includes(fullUri);
if (ownedClaim) {
const { txid, nout } = claim;
abandonClaim(txid, nout);
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES });
}
}
},
},
],
@@ -508,20 +497,6 @@ class FilePage extends React.PureComponent {
this.setState({ fileViewLogged: true });
};
// TODO: Move this to lbry-redux
formatLbryUrlForWeb = url => {
return url.replace('lbry://', '/').replace(/#/g, ':');
};
handleSharePress = () => {
const { claim, notify } = this.props;
if (claim) {
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
const url = 'https://open.lbry.com' + this.formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
NativeModules.UtilityModule.shareUrl(url);
}
};
handleSendTip = () => {
const { claim, balance, navigation, notify, sendTip } = this.props;
const { uri } = navigation.state.params;
@@ -899,11 +874,11 @@ class FilePage extends React.PureComponent {
/>
)}
{(completed || canEdit) && (
{completed && (
<Button
style={filePageStyle.actionButton}
theme={'light'}
icon={'trash-alt'}
icon={'trash'}
text={'Delete'}
onPress={this.onDeletePressed}
/>
@@ -947,30 +922,6 @@ 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 && (
@@ -1007,6 +958,12 @@ class FilePage extends React.PureComponent {
onPress={this.onSaveFilePressed}
/>
)}
<Button
style={[filePageStyle.actionButton, filePageStyle.tipButton]}
theme={'light'}
icon={'gift'}
onPress={() => this.setState({ showTipView: true })}
/>
{channelName && (
<SubscribeButton
style={filePageStyle.actionButton}
+4 -2
View File
@@ -4,6 +4,7 @@ import {
doAuthenticate,
doCheckSync,
doGetSync,
doSetDefaultAccount,
doSyncApply,
doUserEmailNew,
doUserResendVerificationEmail,
@@ -40,11 +41,12 @@ const select = state => ({
const perform = dispatch => ({
addUserEmail: email => dispatch(doUserEmailNew(email)),
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
getSync: password => dispatch(doGetSync(password)),
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'; // eslint-disable-line node/no-deprecated-api
import Constants from 'constants';
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.
</Text>
</View>
</View>
+4 -11
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'; // eslint-disable-line node/no-deprecated-api
import Constants from 'constants';
import firstRunStyle from 'styles/firstRun';
import Icon from 'react-native-vector-icons/FontAwesome5';
@@ -62,14 +62,7 @@ class WalletPage extends React.PureComponent {
};
render() {
const {
onPasswordChanged,
onWalletViewLayout,
getSyncIsPending,
hasSyncedWallet,
syncApplyIsPending,
syncApplyStarted,
} = this.props;
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
let content;
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
@@ -79,11 +72,11 @@ class WalletPage extends React.PureComponent {
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
</View>
);
} else if (syncApplyStarted || syncApplyIsPending) {
} else if (syncApplyIsPending) {
content = (
<View style={firstRunStyle.centered}>
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
<Text style={firstRunStyle.paragraph}>{syncApplyIsPending ? 'Validating password' : 'Synchronizing'}...</Text>
<Text style={firstRunStyle.paragraph}>Validating password...</Text>
</View>
);
} else {
+21 -29
View File
@@ -3,7 +3,7 @@ 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'; // eslint-disable-line node/no-deprecated-api
import Constants from 'constants';
import firstRunStyle from 'styles/firstRun';
class WelcomePage extends React.PureComponent {
@@ -25,7 +25,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 (firstUserAuth !== 'true') {
if ('true' !== firstUserAuth) {
// first_user_auth
NativeModules.Firebase.track('first_user_auth', null);
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
@@ -44,39 +44,31 @@ class WelcomePage extends React.PureComponent {
}
startAuthenticating = () => {
const { authenticate } = this.props;
this.setState({ authenticationStarted: true, authenticationFailed: false });
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => this.performAuthenticate(appVersion, firebaseToken))
.catch(() => {
this.performAuthenticate(appVersion); /* proceed without firebase */
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)
}
});
});
};
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;
+26 -38
View File
@@ -66,7 +66,7 @@ class FirstRunScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
const { notify, isApplyingSync, setClientSetting } = this.props;
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props;
if (this.state.emailSubmitted && !emailNewPending) {
this.setState({ emailSubmitted: false });
@@ -80,34 +80,31 @@ class FirstRunScreen extends React.PureComponent {
}
if (this.state.syncApplyStarted && !syncApplyIsPending) {
this.setState({ syncApplyStarted: false });
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: syncApplyErrorMessage, isError: true });
this.setState({ showBottomContainer: true, syncApplyStarted: false });
this.setState({ showBottomContainer: true });
} else {
// password successfully verified
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_WALLET_PASSWORD,
this.state.walletPassword ? this.state.walletPassword : ''
);
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
setDefaultAccount(
() => {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
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();
// 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.',
});
}
});
);
}
}
@@ -133,9 +130,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.launchUrl } })],
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUri } })],
});
setTimeout(() => navigation.dispatch(resetAction), 1000);
navigation.dispatch(resetAction);
}
handleLeftButtonPressed = () => {
@@ -236,7 +233,6 @@ class FirstRunScreen extends React.PureComponent {
closeFinalPage() {
// Final page. Let the app know that first run experience is completed.
this.setState({ syncApplyStarted: false });
if (NativeModules.FirstRun) {
NativeModules.FirstRun.firstRunCompleted();
}
@@ -299,20 +295,13 @@ 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_WALLET_PASSWORD, newPassword);
if (newPassword.trim().length === 0) {
// blank password. Do not encrypt
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
// fresh account, new password set
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();
});
}
});
}
};
@@ -375,7 +364,6 @@ class FirstRunScreen extends React.PureComponent {
hasSyncedWallet={hasSyncedWallet}
getSyncIsPending={getSyncIsPending}
syncApplyIsPending={syncApplyIsPending}
syncApplyStarted={this.state.syncApplyStarted}
onWalletViewLayout={this.onWalletViewLayout}
onPasswordChanged={this.onWalletPasswordChanged}
/>
+37 -58
View File
@@ -43,7 +43,7 @@ import Tag from 'component/tag';
import TagSearch from 'component/tagSearch';
import UriBar from 'component/uriBar';
import publishStyle from 'styles/publish';
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
import { __, navigateToUri, uploadImageAsset } from 'utils/helper';
const languages = {
en: 'English',
@@ -76,10 +76,8 @@ const languages = {
class PublishPage extends React.PureComponent {
camera = null;
scrollView = null;
state = {
canPublish: true,
canPublish: false,
canUseCamera: false,
documentPickerOpen: false,
editMode: false,
@@ -188,6 +186,7 @@ class PublishPage extends React.PureComponent {
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
this.setState(
{
canPublish: balance >= 0.1,
loadingVideos: true,
},
() => {
@@ -320,7 +319,7 @@ class PublishPage extends React.PureComponent {
};
handlePublishPressed = () => {
const { balance, notify, publish, updatePublishForm } = this.props;
const { notify, publish, updatePublishForm } = this.props;
const {
editMode,
bid,
@@ -341,16 +340,6 @@ 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;
@@ -371,7 +360,7 @@ class PublishPage extends React.PureComponent {
filePath: currentMedia ? currentMedia.filePath : null,
bid: bid || 0.1,
title: title || '',
thumbnail: thumbnail || '',
thumbnail,
description: description || '',
language,
license,
@@ -395,11 +384,6 @@ class PublishPage extends React.PureComponent {
handlePublishSuccess = data => {
const { clearPublishFormState, navigation, notify } = this.props;
const pendingClaim = data.outputs[0];
logPublish(pendingClaim);
// TODO: fake temp claim for claim_list_mine
notify({
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
});
@@ -563,7 +547,7 @@ class PublishPage extends React.PureComponent {
this.setState({ documentPickerOpen: false, thumbnailImagePickerOpen: false }, () => {
const currentMedia = {
id: -1,
filePath: evt.path,
filePath: fileUrl,
duration: 0,
};
this.setCurrentMedia(currentMedia);
@@ -886,7 +870,6 @@ class PublishPage extends React.PureComponent {
const {
allThumbnailsChecked,
canUseCamera,
showCameraOverlay,
currentPhase,
checkedThumbnails,
loadingVideos,
@@ -899,9 +882,7 @@ class PublishPage extends React.PureComponent {
content = (
<View style={publishStyle.gallerySelector}>
<View style={publishStyle.actionsView}>
{canUseCamera && !showCameraOverlay && (
<RNCamera captureAudio={false} style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />
)}
{canUseCamera && <RNCamera style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />}
<View style={publishStyle.actionsSubView}>
<TouchableOpacity
style={[
@@ -977,7 +958,7 @@ class PublishPage extends React.PureComponent {
this.updateThumbnailUriForMedia(currentMedia);
}
content = (
<ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
<ScrollView style={publishStyle.publishDetails}>
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
<FastImage
style={publishStyle.mainThumbnail}
@@ -996,7 +977,7 @@ class PublishPage extends React.PureComponent {
</View>
)}
</TouchableOpacity>
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
{!this.state.canPublish && <PublishRewardsDriver navigation={navigation} />}
<View style={publishStyle.card}>
<View style={publishStyle.textInputLayout}>
@@ -1206,7 +1187,7 @@ class PublishPage extends React.PureComponent {
<View style={publishStyle.rightActionButtons}>
<Button
style={publishStyle.publishButton}
disabled={this.state.uploadThumbnailStarted}
disabled={!this.state.canPublish || this.state.uploadThumbnailStarted}
text={this.state.editMode ? 'Save changes' : 'Publish'}
onPress={this.handlePublishPressed}
/>
@@ -1255,36 +1236,34 @@ class PublishPage extends React.PureComponent {
{false && Constants.PHASE_SELECTOR !== this.state.currentPhase && (
<FloatingWalletBalance navigation={navigation} />
)}
{this.state.showCameraOverlay && (
{this.state.canUseCamera && this.state.showCameraOverlay && (
<View style={publishStyle.cameraOverlay}>
{this.state.canUseCamera && (
<RNCamera
captureAudio={this.state.videoRecordingMode}
style={publishStyle.fullCamera}
ref={ref => {
this.camera = ref;
}}
type={this.state.cameraType}
flashMode={RNCamera.Constants.FlashMode.off}
androidCameraPermissionOptions={{
title: __('Camera'),
message: __('Please grant access to make use of your camera'),
buttonPositive: __('OK'),
buttonNegative: __('Cancel'),
}}
androidRecordAudioPermissionOptions={{
title: __('Audio'),
message: __('Please grant access to record audio'),
buttonPositive: __('OK'),
buttonNegative: __('Cancel'),
}}
notAuthorizedView={
<View style={publishStyle.fullCentered}>
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
</View>
}
/>
)}
<RNCamera
captureAudio={this.state.videoRecordingMode}
style={publishStyle.fullCamera}
ref={ref => {
this.camera = ref;
}}
type={this.state.cameraType}
flashMode={RNCamera.Constants.FlashMode.off}
androidCameraPermissionOptions={{
title: 'Camera',
message: 'Please grant access to make use of your camera',
buttonPositive: 'OK',
buttonNegative: 'Cancel',
}}
androidRecordAudioPermissionOptions={{
title: 'Audio',
message: 'Please grant access to record audio',
buttonPositive: 'OK',
buttonNegative: 'Cancel',
}}
notAuthorizedView={
<View style={publishStyle.fullCentered}>
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
</View>
}
/>
<View
style={[
publishStyle.cameraControls,
+1 -2
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'; // eslint-disable-line node/no-deprecated-api
import Constants from 'constants';
import SettingsPage from './view';
const select = state => ({
@@ -13,7 +13,6 @@ 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),
});
const perform = dispatch => ({
+1 -19
View File
@@ -51,7 +51,6 @@ class SettingsPage extends React.PureComponent {
navigation,
popDrawerStack,
showNsfw,
showUriBarSuggestions,
setClientSetting,
} = this.props;
@@ -63,7 +62,6 @@ class SettingsPage extends React.PureComponent {
<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>
@@ -81,29 +79,13 @@ class SettingsPage extends React.PureComponent {
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Show mature content</Text>
<Text style={settingsStyle.label}>Show NSFW 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}>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, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
fetchSubscriptions: callback => dispatch(doFetchMySubscriptions(callback)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
getSync: password => dispatch(doGetSync(password)),
notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
+58 -53
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { Lbry, doPreferenceGet } from 'lbry-redux';
import { Lbry } from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
@@ -16,6 +16,8 @@ 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';
@@ -38,6 +40,12 @@ class SplashScreen extends React.PureComponent {
subscriptionsFetched: false,
};
componentWillMount() {
if (NativeModules.DaemonServiceControl) {
NativeModules.DaemonServiceControl.startService();
}
}
updateStatus() {
Lbry.status().then(status => {
this._updateStatusCallback(status);
@@ -52,7 +60,7 @@ class SplashScreen extends React.PureComponent {
});
navigation.dispatch(resetAction);
const launchUrl = navigation.state.params ? navigation.state.params.launchUrl : this.state.launchUrl;
const launchUrl = navigation.state.params.launchUrl || this.state.launchUrl;
if (launchUrl) {
if (launchUrl.startsWith('lbry://?verify=')) {
let verification = {};
@@ -83,15 +91,16 @@ class SplashScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { emailToVerify, getSync, setEmailToVerify, verifyUserEmail, verifyUserEmailFailure } = this.props;
const { daemonReady, shouldAuthenticate } = this.state;
const { user } = nextProps;
if (daemonReady && shouldAuthenticate && user && user.id) {
if (this.state.daemonReady && this.state.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_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => this.getUserSettings());
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword && walletPassword.trim().length > 0) {
getSync(walletPassword);
}
this.navigateToMain();
});
return;
@@ -104,16 +113,9 @@ class SplashScreen extends React.PureComponent {
getUserSettings = () => {
const { populateSharedUserState } = this.props;
doPreferenceGet(
'shared',
preference => {
populateSharedUserState(preference);
},
error => {
/* failed */
}
);
Lbryio.call('user_settings', 'get').then(settings => {
populateSharedUserState(settings);
});
};
finishSplashScreen = () => {
@@ -135,18 +137,22 @@ class SplashScreen extends React.PureComponent {
filteredOutpointsSubscribe();
checkSubscriptionsInit();
// 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_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => this.getUserSettings());
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword) {
getSync(walletPassword);
}
this.navigateToMain();
});
} else {
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => authenticate(appVersion, Platform.OS, firebaseToken))
.catch(() => authenticate(appVersion, Platform.OS));
authenticate(appVersion, Platform.OS);
});
}
});
@@ -158,10 +164,7 @@ class SplashScreen extends React.PureComponent {
_updateStatusCallback(status) {
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
const blockchainHeaders = status.blockchain_headers;
const startupStatus = status.startup_status;
const walletStatus = status.wallet;
// At the minimum, wallet should be started and blocks_behind equal to 0 before calling resolve
const hasStarted = startupStatus.stream_manager && startupStatus.wallet && status.wallet.blocks_behind <= 0;
if (hasStarted) {
@@ -175,40 +178,39 @@ class SplashScreen extends React.PureComponent {
isRunning: true,
});
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',
});
// 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 (password) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
// 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();
}
});
// 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();
}
});
return;
}
const blockchainHeaders = status.blockchain_headers;
const walletStatus = status.wallet;
if (blockchainHeaders) {
this.setState({
isDownloadingHeaders: blockchainHeaders.downloading_headers,
@@ -247,7 +249,10 @@ class SplashScreen extends React.PureComponent {
}
componentDidMount() {
NativeModules.Firebase.track('app_launch', null);
if (NativeModules.Firebase) {
NativeModules.Firebase.track('app_launch', null);
}
NativeModules.Firebase.setCurrentScreen('Splash');
this.props.fetchRewardedContent();
+14 -33
View File
@@ -25,7 +25,6 @@ import FileItem from 'component/fileItem';
import Icon from 'react-native-vector-icons/FontAwesome5';
import Link from 'component/link';
import ModalPicker from 'component/modalPicker';
import ModalSuggestedSubscriptions from 'component/modalSuggestedSubscriptions';
import SubscribedChannelList from 'component/subscribedChannelList';
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
import UriBar from 'component/uriBar';
@@ -35,7 +34,6 @@ class SubscriptionsPage extends React.PureComponent {
showingSuggestedSubs: false,
showSortPicker: false,
showTimePicker: false,
showModalSuggestedSubs: false,
orderBy: ['release_time'],
filteredChannels: [],
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting subscriptions by new
@@ -124,7 +122,7 @@ class SubscriptionsPage extends React.PureComponent {
unreadSubscriptions,
navigation,
} = this.props;
const { currentSortByItem, filteredChannels, showModalSuggestedSubs, showSortPicker, showTimePicker } = this.state;
const { currentSortByItem, filteredChannels, showSortPicker, showTimePicker } = this.state;
const numberOfSubscriptions = subscribedChannels ? subscribedChannels.length : 0;
const hasSubscriptions = numberOfSubscriptions > 0;
@@ -153,31 +151,23 @@ class SubscriptionsPage extends React.PureComponent {
</View>
{!this.state.showingSuggestedSubs && hasSubscriptions && (
<View style={subscriptionsStyle.pickerRow}>
<View style={subscriptionsStyle.leftPickerRow}>
<TouchableOpacity
style={subscriptionsStyle.tagSortBy}
onPress={() => this.setState({ showSortPicker: true })}
>
<Text style={subscriptionsStyle.tagSortText}>{currentSortByItem.label.split(' ')[0]}</Text>
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
{Constants.SORT_BY_TOP === currentSortByItem.name && (
<TouchableOpacity
style={subscriptionsStyle.tagSortBy}
onPress={() => this.setState({ showSortPicker: true })}
onPress={() => this.setState({ showTimePicker: true })}
>
<Text style={subscriptionsStyle.tagSortText}>{currentSortByItem.label.split(' ')[0]}</Text>
<Text style={subscriptionsStyle.tagSortText}>{timeItem.label}</Text>
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
{Constants.SORT_BY_TOP === currentSortByItem.name && (
<TouchableOpacity
style={subscriptionsStyle.tagSortBy}
onPress={() => this.setState({ showTimePicker: true })}
>
<Text style={subscriptionsStyle.tagSortText}>{timeItem.label}</Text>
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
)}
</View>
<Link
style={subscriptionsStyle.suggestedLink}
text={'Suggested'}
onPress={() => this.setState({ showModalSuggestedSubs: true })}
/>
)}
</View>
)}
{!this.state.showingSuggestedSubs && hasSubscriptions && !loading && (
@@ -233,9 +223,7 @@ class SubscriptionsPage extends React.PureComponent {
</View>
)}
{!showSortPicker && !showTimePicker && !showModalSuggestedSubs && (
<FloatingWalletBalance navigation={navigation} />
)}
{!showSortPicker && !showTimePicker && <FloatingWalletBalance navigation={navigation} />}
{showSortPicker && (
<ModalPicker
title={__('Sort content by')}
@@ -254,13 +242,6 @@ class SubscriptionsPage extends React.PureComponent {
items={Constants.CLAIM_SEARCH_TIME_ITEMS}
/>
)}
{showModalSuggestedSubs && (
<ModalSuggestedSubscriptions
navigation={navigation}
onOverlayPress={() => this.setState({ showModalSuggestedSubs: false })}
onDonePress={() => this.setState({ showModalSuggestedSubs: false })}
/>
)}
</View>
);
}
+3 -1
View File
@@ -3,6 +3,7 @@ import { doToast } from 'lbry-redux';
import {
doCheckSync,
doGetSync,
doSetDefaultAccount,
doSyncApply,
doUserEmailNew,
doUserEmailToVerify,
@@ -54,11 +55,12 @@ const select = state => ({
const perform = dispatch => ({
addUserEmail: email => dispatch(doUserEmailNew(email)),
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
getSync: password => dispatch(doGetSync(password)),
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,17 +37,11 @@ class SyncVerifyPage extends React.PureComponent {
if (!hasSyncedWallet) {
// fresh account with no sync
const newPassword = this.state.password ? this.state.password : '';
if (newPassword.trim().length === 0) {
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
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 : '');
}
@@ -56,7 +50,7 @@ class SyncVerifyPage extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps;
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting } = this.props;
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting, setDefaultAccount } = this.props;
if (this.state.checkSyncStarted && !getSyncIsPending) {
this.setState({ syncChecked: true });
}
@@ -69,39 +63,32 @@ class SyncVerifyPage extends React.PureComponent {
// password successfully verified
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_WALLET_PASSWORD,
Constants.KEY_FIRST_RUN_PASSWORD,
this.state.password ? this.state.password : ''
);
}
setDefaultAccount(
() => {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
this.finishSync(true);
// unlock the wallet
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
.then(() => navigation.goBack())
.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.',
});
}
);
}
}
}
finishSync = (notifyUnlockFailed = false) => {
const { navigation, notify, setClientSetting } = this.props;
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
// unlock the wallet (if locked)
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();
}
});
};
handleChangeText = text => {
// save the value to the state email
const { onPasswordChanged } = this.props;
+2
View File
@@ -101,6 +101,7 @@ class VerificationScreen extends React.PureComponent {
notify,
addUserPhone,
getSyncIsPending,
setDefaultAccount,
hasSyncedWallet,
setSyncIsPending,
syncApplyIsPending,
@@ -161,6 +162,7 @@ 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'; // eslint-disable-line node/no-deprecated-api
import Constants from 'constants';
import WalletPage from './view';
const select = state => ({
@@ -21,7 +21,7 @@ const select = state => ({
const perform = dispatch => ({
checkSync: () => dispatch(doCheckSync()),
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
getSync: password => dispatch(doGetSync(password)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_WALLET)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
+4 -2
View File
@@ -46,8 +46,10 @@ class WalletPage extends React.PureComponent {
const { deviceWalletSynced, getSync, user } = this.props;
if (deviceWalletSynced && user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword);
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword) {
getSync(walletPassword);
}
});
}
};
+1 -3
View File
@@ -45,7 +45,6 @@ const channelCreatorStyle = StyleSheet.create({
helpText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 12,
color: Colors.DescriptionGrey,
},
channelTitleInput: {
marginBottom: 4,
@@ -105,12 +104,11 @@ const channelCreatorStyle = StyleSheet.create({
avatarImageContainer: {
position: 'absolute',
left: screenWidth / 2 - 80 / 2,
bottom: -8,
bottom: -16,
width: 80,
height: 80,
borderRadius: 160,
overflow: 'hidden',
zIndex: 50,
},
avatarTouchArea: {
width: 80,
-1
View File
@@ -19,7 +19,6 @@ const Colors = {
VeryLightGrey: '#f1f1f1',
White: '#ffffff',
UriDescBlue: '#3971db',
RewardDriverBlue: '#2196f3',
StatsAudio: '#f6a637',
StatsImage: '#ff4a7d',
+1 -29
View File
@@ -322,9 +322,6 @@ const filePageStyle = StyleSheet.create({
saveFileButton: {
marginRight: 8,
},
reportButton: {
marginRight: 8,
},
tagContainer: {
marginLeft: 12,
marginRight: 12,
@@ -348,17 +345,13 @@ const filePageStyle = StyleSheet.create({
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.RewardDriverBlue,
backgroundColor: Colors.BrighterLbryGreen,
flexDirection: 'row',
paddingLeft: 16,
paddingRight: 16,
paddingTop: 12,
paddingBottom: 12,
},
rewardDriverIcon: {
color: Colors.White,
marginRight: 8,
},
rewardDriverText: {
fontFamily: 'Inter-UI-Regular',
color: Colors.White,
@@ -381,27 +374,6 @@ 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,
},
});
export default filePageStyle;
-48
View File
@@ -1,48 +0,0 @@
import { StyleSheet } from 'react-native';
import Colors from './colors';
const modalPickerStyle = StyleSheet.create({
overlay: {
backgroundColor: '#00000055',
flex: 1,
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex: 300,
},
overlayTouchArea: {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
},
container: {
position: 'absolute',
left: 8,
right: 8,
bottom: 8,
borderRadius: 8,
backgroundColor: Colors.White,
overflow: 'hidden',
},
paddedContatiner: {
padding: 12,
},
buttons: {
marginTop: 16,
left: 8,
bottom: 8,
position: 'absolute',
},
doneButton: {
alignSelf: 'flex-start',
backgroundColor: Colors.LbryGreen,
paddingLeft: 16,
paddingRight: 16,
},
});
export default modalPickerStyle;
+1 -6
View File
@@ -297,7 +297,7 @@ const publishStyle = StyleSheet.create({
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.RewardDriverBlue,
backgroundColor: Colors.BrighterLbryGreen,
flexDirection: 'row',
paddingLeft: 16,
paddingRight: 16,
@@ -436,11 +436,6 @@ const publishStyle = StyleSheet.create({
fontSize: 14,
color: Colors.DescriptionGrey,
},
helpText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 12,
color: Colors.DescriptionGrey,
},
publishesFooter: {
marginTop: 2,
marginLeft: 16,
+4 -5
View File
@@ -29,7 +29,10 @@ const rewardStyle = StyleSheet.create({
},
enrollContainer: {
flex: 1,
marginTop: 60,
marginTop: 76,
marginLeft: 16,
marginRight: 16,
marginBottom: 16,
padding: 24,
backgroundColor: Colors.LbryGreen,
},
@@ -247,10 +250,6 @@ const rewardStyle = StyleSheet.create({
fontFamily: 'Inter-UI-Regular',
color: Colors.White,
},
learnMoreLink: {
fontFamily: 'Inter-UI-Regular',
color: Colors.NextLbryGreen,
},
enrollButton: {
backgroundColor: Colors.White,
paddingLeft: 16,
-8
View File
@@ -39,14 +39,6 @@ const settingsStyle = StyleSheet.create({
fontFamily: 'Inter-UI-Regular',
lineHeight: 18,
},
sectionTitle: {
fontFamily: 'Inter-UI-Regular',
fontSize: 20,
marginBottom: 4,
},
sectionDivider: {
marginTop: 24,
},
});
export default settingsStyle;
+1 -20
View File
@@ -13,7 +13,7 @@ const subscriptionsStyle = StyleSheet.create({
suggestedSubsContainer: {
flex: 1,
},
suggestedScrollContent: {
suggestedScrollPadding: {
paddingTop: 8,
},
button: {
@@ -159,7 +159,6 @@ const subscriptionsStyle = StyleSheet.create({
pickerRow: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
marginLeft: 16,
marginRight: 16,
marginTop: 8,
@@ -246,24 +245,6 @@ const subscriptionsStyle = StyleSheet.create({
marginRight: 4,
marginBottom: 4,
},
leftPickerRow: {
flexDirection: 'row',
alignItems: 'center',
},
suggestedLink: {
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
},
modalContainer: {
height: '80%',
backgroundColor: Colors.PageBackground,
},
modalScrollContainer: {
marginBottom: 50,
},
modalSuggestedScrollContent: {
paddingTop: 16,
},
});
export default subscriptionsStyle;
+4 -5
View File
@@ -36,7 +36,7 @@ const uriBarStyle = StyleSheet.create({
},
overlay: {
position: 'absolute',
backgroundColor: 'red',
backgroundColor: 'transparent',
top: 0,
width: '100%',
zIndex: 200,
@@ -54,10 +54,9 @@ const uriBarStyle = StyleSheet.create({
item: {
flexDirection: 'row',
alignItems: 'center',
paddingLeft: 16,
paddingRight: 16,
paddingTop: 12,
paddingBottom: 12,
padding: 12,
paddingTop: 8,
paddingBottom: 8,
},
itemContent: {
marginLeft: 12,
+1 -1
View File
@@ -198,7 +198,7 @@ const walletStyle = StyleSheet.create({
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.RewardDriverBlue,
backgroundColor: Colors.BrighterLbryGreen,
flexDirection: 'row',
padding: 16,
marginLeft: 16,
-18
View File
@@ -1,6 +1,5 @@
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
@@ -291,23 +290,6 @@ 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 = '';