Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd9873ccc7 | ||
|
|
9b25eec646 | ||
|
|
22cd556e13 | ||
|
|
68bee32dde | ||
|
|
cc2b3b845d | ||
|
|
b6df5ee97c | ||
|
|
ddd8d49a62 | ||
|
|
e6ee26f94c | ||
|
|
2bf67d31e8 | ||
|
|
9ec5ac5d60 | ||
|
|
9080913811 | ||
|
|
eca6af122b | ||
|
|
b258654d60 |
No files matched your search
Generated
+10
-7
@@ -5640,8 +5640,8 @@
|
||||
}
|
||||
},
|
||||
"lbry-redux": {
|
||||
"version": "github:lbryio/lbry-redux#f06e1e64a8587a183bd7333f628fca821fe81fa4",
|
||||
"from": "github:lbryio/lbry-redux#f06e1e64a8587a183bd7333f628fca821fe81fa4",
|
||||
"version": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
||||
"from": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
||||
"requires": {
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"reselect": "^3.0.0",
|
||||
@@ -5649,8 +5649,8 @@
|
||||
}
|
||||
},
|
||||
"lbryinc": {
|
||||
"version": "github:lbryio/lbryinc#02d8571cd7fafd00d1a60f133d884eb8c5f1a306",
|
||||
"from": "github:lbryio/lbryinc#02d8571cd7fafd00d1a60f133d884eb8c5f1a306",
|
||||
"version": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||
"from": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||
"requires": {
|
||||
"reselect": "^3.0.0"
|
||||
}
|
||||
@@ -8402,9 +8402,12 @@
|
||||
}
|
||||
},
|
||||
"react-navigation-drawer": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-2.2.2.tgz",
|
||||
"integrity": "sha512-KcFH7RRzT1XuREkTbNMCqfy7nK7yenzpGKvqp1dTvAE+DIyHHpf+Po959lsmITlt/njQBn+QxvdX1FZ9we3lNA=="
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-1.4.0.tgz",
|
||||
"integrity": "sha512-ZyWBozcjB2aZ7vwCALv90cYA2NpDjM+WALaiYRshvPvue8l7cqynePbHK8GhlMGyJDwZqp4MxQmu8u1XAKp3Bw==",
|
||||
"requires": {
|
||||
"react-native-tab-view": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"react-navigation-redux-helpers": {
|
||||
"version": "3.0.2",
|
||||
|
||||
+3
-3
@@ -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#f06e1e64a8587a183bd7333f628fca821fe81fa4",
|
||||
"lbryinc": "lbryio/lbryinc#02d8571cd7fafd00d1a60f133d884eb8c5f1a306",
|
||||
"lbry-redux": "lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
||||
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
@@ -34,7 +34,7 @@
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||
"react-navigation": "^3.11.0",
|
||||
"react-navigation-drawer": "^2.2.2",
|
||||
"react-navigation-drawer": "^1.4.0",
|
||||
"react-navigation-redux-helpers": "^3.0.2",
|
||||
"react-navigation-stack": "^1.8.1",
|
||||
"react-redux": "^5.0.3",
|
||||
|
||||
@@ -214,7 +214,7 @@ const drawer = createDrawerNavigator(
|
||||
},
|
||||
},
|
||||
{
|
||||
drawerWidth: 300,
|
||||
drawerWidth: 280,
|
||||
drawerBackgroundColor: 'transparent',
|
||||
headerMode: 'none',
|
||||
backBehavior: 'none',
|
||||
@@ -272,6 +272,7 @@ class AppWithNavigationState extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.emailVerifyCheckInterval = null;
|
||||
this.syncGetInterval = null;
|
||||
this.state = {
|
||||
emailVerifyDone: false,
|
||||
verifyPending: false,
|
||||
@@ -301,10 +302,10 @@ class AppWithNavigationState extends React.Component {
|
||||
Linking.addEventListener('url', this._handleUrl);
|
||||
|
||||
// call /sync/get with interval
|
||||
setInterval(() => {
|
||||
this.syncGetInterval = setInterval(() => {
|
||||
this.setState({ syncHashChanged: false }); // reset local state
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
dispatch(doGetSync(walletPassword));
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
|
||||
});
|
||||
}, SYNC_GET_INTERVAL);
|
||||
}
|
||||
@@ -321,15 +322,27 @@ class AppWithNavigationState extends React.Component {
|
||||
|
||||
getUserSettings = () => {
|
||||
const { dispatch } = this.props;
|
||||
doPreferenceGet('shared', null, null, preference => {
|
||||
dispatch(doPopulateSharedUserState(preference));
|
||||
});
|
||||
doPreferenceGet(
|
||||
'shared',
|
||||
preference => {
|
||||
dispatch(doPopulateSharedUserState(preference));
|
||||
},
|
||||
error => {
|
||||
/* failed */
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.removeEventListener('hardwareBackPress');
|
||||
Linking.removeEventListener('url', this._handleUrl);
|
||||
if (this.emailVerifyCheckInterval > -1) {
|
||||
clearInterval(this.emailVerifyCheckInterval);
|
||||
}
|
||||
if (this.syncGetInterval > -1) {
|
||||
clearInterval(this.syncGetInterval);
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
||||
@@ -20,7 +20,7 @@ const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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 Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -142,20 +143,21 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
createChannelError: undefined,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = channelClaim => {
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
addingChannel: false,
|
||||
currentSelectedValue: channelName,
|
||||
showCreateChannel: false,
|
||||
});
|
||||
logPublish(channelClaim);
|
||||
|
||||
if (onChannelChange) {
|
||||
onChannelChange(channelName);
|
||||
}
|
||||
|
||||
// sync wallet
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => getSync(password));
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import claimListStyle from 'styles/claimList';
|
||||
import discoverStyle from 'styles/discover';
|
||||
import moment from 'moment';
|
||||
|
||||
const horizontalLimit = 7;
|
||||
const horizontalLimit = 10;
|
||||
const softLimit = 500;
|
||||
|
||||
class ClaimList extends React.PureComponent {
|
||||
|
||||
@@ -10,13 +10,15 @@ import {
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectShortUrlForUri,
|
||||
} from 'lbry-redux';
|
||||
import { selectRewardContentClaimIds } from 'lbryinc';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import FileItem from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
|
||||
@@ -40,10 +40,12 @@ class FileItem extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const {
|
||||
blackListedOutpoints,
|
||||
claim,
|
||||
title,
|
||||
thumbnail,
|
||||
fileInfo,
|
||||
filteredOutpoints,
|
||||
metadata,
|
||||
isResolvingUri,
|
||||
rewardedContentClaimIds,
|
||||
@@ -58,7 +60,17 @@ class FileItem extends React.PureComponent {
|
||||
} = this.props;
|
||||
|
||||
if (claim && claim.value_type === 'channel') {
|
||||
// don't display channels in the lists on the Explore page
|
||||
// don't display channels in the lists on the Your tags page
|
||||
return null;
|
||||
}
|
||||
|
||||
let shouldHide = false;
|
||||
if (blackListedOutpoints || filteredOutpoints) {
|
||||
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
|
||||
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||
}
|
||||
if (shouldHide) {
|
||||
// don't display blacklisted or filtered outpoints on the Your tags page
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class FileRewardsDriver extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={filePageStyle.rewardIcon} />
|
||||
<Icon name="award" size={16} style={filePageStyle.rewardDriverIcon} />
|
||||
<Text style={filePageStyle.rewardDriverText}>Earn some credits to access this content.</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
|
||||
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
|
||||
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
||||
{(!isNaN(balance) || balance === 0) && (
|
||||
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 0, true)}</Text>
|
||||
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class ModalTagSelector extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||
<View style={modalTagSelectorStyle.container}>
|
||||
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
|
||||
<View style={modalTagSelectorStyle.titleRow}>
|
||||
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
|
||||
</View>
|
||||
@@ -75,7 +75,7 @@ export default class ModalTagSelector extends React.PureComponent {
|
||||
<View style={modalTagSelectorStyle.buttons}>
|
||||
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
|
||||
</View>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ import {
|
||||
selectSearchState as selectSearch,
|
||||
selectSearchValue,
|
||||
selectSearchSuggestions,
|
||||
SETTINGS,
|
||||
} from 'lbry-redux';
|
||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import UriBar from './view';
|
||||
|
||||
const select = state => {
|
||||
@@ -16,6 +18,7 @@ const select = state => {
|
||||
query: selectSearchValue(state),
|
||||
currentRoute: selectCurrentRoute(state),
|
||||
suggestions: selectSearchSuggestions(state),
|
||||
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ class UriBarItem extends React.PureComponent {
|
||||
icon = <Icon name="search" size={18} />;
|
||||
break;
|
||||
|
||||
case SEARCH_TYPES.TAG:
|
||||
icon = <Icon name="hashtag" size={18} />;
|
||||
break;
|
||||
|
||||
case SEARCH_TYPES.FILE:
|
||||
default:
|
||||
icon = <Icon name="file" size={18} />;
|
||||
@@ -37,6 +41,7 @@ class UriBarItem extends React.PureComponent {
|
||||
{type === SEARCH_TYPES.SEARCH && `Search for '${value}'`}
|
||||
{type === SEARCH_TYPES.CHANNEL && `View the @${shorthand} channel`}
|
||||
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
|
||||
{type === SEARCH_TYPES.TAG && `Explore the '${value}' tag`}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { Dimensions, FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import UriBarItem from './internal/uri-bar-item';
|
||||
@@ -14,6 +14,8 @@ class UriBar extends React.PureComponent {
|
||||
|
||||
textInput = null;
|
||||
|
||||
keyboardDidShowListener = null;
|
||||
|
||||
keyboardDidHideListener = null;
|
||||
|
||||
state = {
|
||||
@@ -21,17 +23,19 @@ class UriBar extends React.PureComponent {
|
||||
currentValue: null,
|
||||
inputText: null,
|
||||
focused: false,
|
||||
|
||||
// TODO: Add a setting to enable / disable direct search?
|
||||
directSearch: true,
|
||||
keyboardHeight: 0,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
|
||||
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
||||
this.setSelection();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.keyboardDidShowListener) {
|
||||
this.keyboardDidShowListener.remove();
|
||||
}
|
||||
if (this.keyboardDidHideListener) {
|
||||
this.keyboardDidHideListener.remove();
|
||||
}
|
||||
@@ -49,25 +53,28 @@ class UriBar extends React.PureComponent {
|
||||
handleChangeText = text => {
|
||||
const newValue = text || '';
|
||||
clearTimeout(this.state.changeTextTimeout);
|
||||
const { updateSearchQuery, onSearchSubmitted, navigation } = this.props;
|
||||
const { updateSearchQuery, onSearchSubmitted, showUriBarSuggestions, navigation } = this.props;
|
||||
|
||||
let timeout = setTimeout(() => {
|
||||
if (text.trim().length === 0) {
|
||||
// don't do anything if the text is empty
|
||||
return;
|
||||
}
|
||||
updateSearchQuery(text);
|
||||
|
||||
updateSearchQuery(text);
|
||||
|
||||
if (!text.startsWith('lbry://')) {
|
||||
// not a URI input, so this is a search, perform a direct search
|
||||
if (onSearchSubmitted) {
|
||||
onSearchSubmitted(text);
|
||||
} else {
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text } });
|
||||
let timeout = -1;
|
||||
if (!showUriBarSuggestions) {
|
||||
timeout = setTimeout(() => {
|
||||
if (text.trim().length === 0) {
|
||||
// don't do anything if the text is empty
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, UriBar.INPUT_TIMEOUT);
|
||||
|
||||
if (!text.startsWith('lbry://')) {
|
||||
// not a URI input, so this is a search, perform a direct search
|
||||
if (onSearchSubmitted) {
|
||||
onSearchSubmitted(text);
|
||||
} else {
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text } });
|
||||
}
|
||||
}
|
||||
}, UriBar.INPUT_TIMEOUT);
|
||||
}
|
||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
||||
};
|
||||
|
||||
@@ -86,18 +93,34 @@ class UriBar extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value } });
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_SEARCH,
|
||||
key: 'searchPage',
|
||||
params: { searchQuery: value },
|
||||
});
|
||||
} else if (SEARCH_TYPES.TAG === type) {
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_TAG,
|
||||
key: 'tagPage',
|
||||
params: {
|
||||
tag: value.toLowerCase(),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const uri = normalizeURI(value);
|
||||
navigateToUri(navigation, uri);
|
||||
}
|
||||
};
|
||||
|
||||
_keyboardDidShow = evt => {
|
||||
this.setState({ keyboardHeight: evt.endCoordinates.height });
|
||||
};
|
||||
|
||||
_keyboardDidHide = () => {
|
||||
if (this.textInput) {
|
||||
this.textInput.blur();
|
||||
}
|
||||
this.setState({ focused: false });
|
||||
this.setState({ focused: false, keyboardHeight: 0 });
|
||||
};
|
||||
|
||||
setSelection() {
|
||||
@@ -152,16 +175,18 @@ class UriBar extends React.PureComponent {
|
||||
selectedItemCount,
|
||||
selectionMode,
|
||||
suggestions,
|
||||
showUriBarSuggestions,
|
||||
value,
|
||||
} = this.props;
|
||||
if (this.state.currentValue === null) {
|
||||
this.setState({ currentValue: value });
|
||||
}
|
||||
|
||||
let style = [uriBarStyle.overlay, belowOverlay ? null : uriBarStyle.overlayElevated];
|
||||
|
||||
// TODO: Add optional setting to enable URI / search bar suggestions
|
||||
/* if (this.state.focused) { style.push(uriBarStyle.inFocus); } */
|
||||
let style = [
|
||||
uriBarStyle.overlay,
|
||||
belowOverlay ? null : uriBarStyle.overlayElevated,
|
||||
this.state.focused && showUriBarSuggestions ? uriBarStyle.inFocus : null,
|
||||
];
|
||||
|
||||
// TODO: selectionModeActions should be dynamically created / specified
|
||||
return (
|
||||
@@ -248,20 +273,21 @@ class UriBar extends React.PureComponent {
|
||||
onSubmitEditing={this.handleSubmitEditing}
|
||||
/>
|
||||
)}
|
||||
{this.state.focused && !this.state.directSearch && (
|
||||
<View style={uriBarStyle.suggestions}>
|
||||
<FlatList
|
||||
style={uriBarStyle.suggestionList}
|
||||
data={suggestions}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
keyExtractor={(item, value) => item.value}
|
||||
renderItem={({ item }) => (
|
||||
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
|
||||
)}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
{this.state.focused && showUriBarSuggestions && (
|
||||
<FlatList
|
||||
style={[
|
||||
uriBarStyle.suggestions,
|
||||
{ height: Dimensions.get('window').height - this.state.keyboardHeight - 60 },
|
||||
]}
|
||||
data={suggestions}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
keyExtractor={(item, value) => `${item.value}-${item.type}`}
|
||||
renderItem={({ item }) => (
|
||||
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
+3
-1
@@ -32,7 +32,7 @@ const Constants = {
|
||||
ABOUT_TAB: 'about',
|
||||
|
||||
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
|
||||
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword',
|
||||
KEY_WALLET_PASSWORD: 'firstRunPassword',
|
||||
KEY_FIRST_USER_AUTH: 'firstUserAuth',
|
||||
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
|
||||
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
|
||||
@@ -138,6 +138,8 @@ const Constants = {
|
||||
MORE_PLACEHOLDER: '_more',
|
||||
|
||||
TRUE_STRING: 'true',
|
||||
|
||||
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
||||
};
|
||||
|
||||
export default Constants;
|
||||
|
||||
+58
-30
@@ -4,6 +4,8 @@ import { Provider, connect } from 'react-redux';
|
||||
import { AppRegistry, Text, View, NativeModules } from 'react-native';
|
||||
import {
|
||||
Lbry,
|
||||
buildSharedStateMiddleware,
|
||||
blockedReducer,
|
||||
claimsReducer,
|
||||
contentReducer,
|
||||
fileReducer,
|
||||
@@ -13,20 +15,24 @@ import {
|
||||
searchReducer,
|
||||
tagsReducer,
|
||||
walletReducer,
|
||||
sharedStateSubscriber,
|
||||
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,
|
||||
@@ -34,6 +40,7 @@ import AppWithNavigationState, {
|
||||
reactNavigationMiddleware,
|
||||
} from 'component/AppNavigator';
|
||||
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
@@ -43,7 +50,6 @@ import formReducer from 'redux/reducers/form';
|
||||
import drawerReducer from 'redux/reducers/drawer';
|
||||
import settingsReducer from 'redux/reducers/settings';
|
||||
import thunk from 'redux-thunk';
|
||||
import isEqual from 'utils/deep-equal';
|
||||
|
||||
const globalExceptionHandler = (error, isFatal) => {
|
||||
if (error && NativeModules.Firebase) {
|
||||
@@ -82,6 +88,7 @@ function enableBatching(reducer) {
|
||||
|
||||
const compressor = createCompressor();
|
||||
const authFilter = createFilter('auth', ['authToken']);
|
||||
const blockedFilter = createFilter('blocked', ['blockedChannels']);
|
||||
const contentFilter = createFilter('content', ['positions']);
|
||||
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
|
||||
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']);
|
||||
@@ -90,10 +97,18 @@ const tagsFilter = createFilter('tags', ['followedTags']);
|
||||
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
||||
|
||||
const v4PersistOptions = {
|
||||
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
||||
whitelist: ['auth', 'blocked', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
||||
// Order is important. Needs to be compressed last or other transforms can't
|
||||
// read the data
|
||||
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
||||
transforms: [
|
||||
authFilter,
|
||||
blockedFilter,
|
||||
saveClaimsFilter,
|
||||
subscriptionsFilter,
|
||||
settingsFilter,
|
||||
walletFilter,
|
||||
compressor,
|
||||
],
|
||||
debounce: 10000,
|
||||
storage: FilesystemStorage,
|
||||
};
|
||||
@@ -106,6 +121,7 @@ const persistOptions = Object.assign({}, v4PersistOptions, {
|
||||
const reducers = persistCombineReducers(persistOptions, {
|
||||
auth: authReducer,
|
||||
blacklist: blacklistReducer,
|
||||
blocked: blockedReducer,
|
||||
claims: claimsReducer,
|
||||
content: contentReducer,
|
||||
costInfo: costInfoReducer,
|
||||
@@ -128,8 +144,45 @@ const reducers = persistCombineReducers(persistOptions, {
|
||||
wallet: walletReducer,
|
||||
});
|
||||
|
||||
/**
|
||||
* source: the reducer name
|
||||
* property: the property in the reducer-specific state
|
||||
* transform: optional method to modify the value to be stored
|
||||
*/
|
||||
const sharedStateActions = [
|
||||
LBRYINC_ACTIONS.CHANNEL_SUBSCRIBE,
|
||||
LBRYINC_ACTIONS.CHANNEL_UNSUBSCRIBE,
|
||||
LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
|
||||
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
|
||||
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
||||
];
|
||||
const sharedStateFilters = {
|
||||
tags: { source: 'tags', property: 'followedTags' },
|
||||
subscriptions: {
|
||||
source: 'subscriptions',
|
||||
property: 'subscriptions',
|
||||
transform: function(value) {
|
||||
return value.map(({ uri }) => uri);
|
||||
},
|
||||
},
|
||||
blocked: { source: 'blocked', property: 'blockedChannels' },
|
||||
};
|
||||
|
||||
const sharedStateCallback = ({ dispatch, getState }) => {
|
||||
const state = getState();
|
||||
const syncEnabled = makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state);
|
||||
const emailVerified = selectUserVerifiedEmail(state);
|
||||
if (syncEnabled && emailVerified) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
|
||||
dispatch(doGetSync(password))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const sharedStateMiddleware = buildSharedStateMiddleware(sharedStateActions, sharedStateFilters, sharedStateCallback);
|
||||
|
||||
const bulkThunk = createBulkThunkMiddleware();
|
||||
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
|
||||
const middleware = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
const composeEnhancers = compose;
|
||||
@@ -148,31 +201,6 @@ const persistor = persistStore(store, persistOptions, err => {
|
||||
});
|
||||
window.persistor = persistor;
|
||||
|
||||
/**
|
||||
* source: the reducer name
|
||||
* property: the property in the reducer-specific state
|
||||
* transform: optional method to modify the value to be stored
|
||||
*/
|
||||
const sharedStateFilters = {
|
||||
tags: { source: 'tags', property: 'followedTags' },
|
||||
subscriptions: {
|
||||
source: 'subscriptions',
|
||||
property: 'subscriptions',
|
||||
transform: function(value) {
|
||||
return value.map(({ uri }) => uri);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
store.subscribe(() => {
|
||||
try {
|
||||
const state = store.getState();
|
||||
sharedStateSubscriber(state, sharedStateFilters, '0.1');
|
||||
} catch (e) {
|
||||
// handle gracefully?
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Find i18n module that is compatible with react-native
|
||||
global.__ = str => str;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ const perform = dispatch => ({
|
||||
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
||||
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
updateChannel: params => dispatch(doUpdateChannel(params)),
|
||||
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { navigateToUri, uploadImageAsset } from 'utils/helper';
|
||||
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
import Button from 'component/button';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||
@@ -32,9 +32,11 @@ import channelIconStyle from 'styles/channelIcon';
|
||||
import seedrandom from 'seedrandom';
|
||||
|
||||
export default class ChannelCreator extends React.PureComponent {
|
||||
scrollView = null;
|
||||
|
||||
state = {
|
||||
autoStyle: null,
|
||||
canSave: false,
|
||||
canSave: true,
|
||||
claimId: null,
|
||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||
currentPhase: null,
|
||||
@@ -161,9 +163,6 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
if (!fetchingChannels) {
|
||||
fetchChannelListMine();
|
||||
}
|
||||
if (balance >= 0.1) {
|
||||
this.setState({ canSave: true });
|
||||
}
|
||||
|
||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
@@ -400,6 +399,16 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
website,
|
||||
} = this.state;
|
||||
|
||||
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
|
||||
notify({
|
||||
message: 'Creating a channel requires credits. Press the blue bar to get some for free.',
|
||||
});
|
||||
if (this.scrollView) {
|
||||
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
|
||||
notify({ message: 'Your channel name contains invalid characters.' });
|
||||
return;
|
||||
@@ -431,7 +440,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
createChannelError: undefined,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = channelClaim => {
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
addingChannel: false,
|
||||
@@ -448,8 +457,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
notify({ message: 'The channel was successfully created.' });
|
||||
this.showChannelList();
|
||||
|
||||
// sync wallet
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => getSync(password));
|
||||
logPublish(channelClaim);
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
@@ -539,9 +547,9 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleNewChannelPress = () => {
|
||||
const { balance, pushDrawerStack } = this.props;
|
||||
const { pushDrawerStack } = this.props;
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||
this.setState({ canSave: balance >= 0.1, currentPhase: Constants.PHASE_CREATE });
|
||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
||||
};
|
||||
|
||||
handleCreateCancel = () => {
|
||||
@@ -559,7 +567,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
resetChannelCreator = () => {
|
||||
this.setState({
|
||||
canSave: false,
|
||||
canSave: true,
|
||||
claimId: null,
|
||||
editMode: false,
|
||||
displayName: null,
|
||||
@@ -621,7 +629,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||
this.setState({
|
||||
canSave: balance >= 0.1,
|
||||
canSave: true,
|
||||
claimId: channel.claim_id,
|
||||
currentPhase: Constants.PHASE_CREATE,
|
||||
displayName: value && value.title ? value.title : channel.name.substring(1),
|
||||
@@ -852,7 +860,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
)}
|
||||
|
||||
{currentPhase === Constants.PHASE_CREATE && (
|
||||
<ScrollView style={channelCreatorStyle.createChannelContainer}>
|
||||
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
|
||||
<View style={channelCreatorStyle.imageSelectors}>
|
||||
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
|
||||
<Image
|
||||
@@ -897,7 +905,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
{balance < 0.1 && <ChannelRewardsDriver navigation={navigation} />}
|
||||
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
|
||||
|
||||
<View style={channelCreatorStyle.card}>
|
||||
<View style={channelCreatorStyle.textInputLayout}>
|
||||
@@ -1057,7 +1065,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
||||
<Button
|
||||
style={channelCreatorStyle.createButton}
|
||||
disabled={!canSave || uploadingImage || !newChannelName || newChannelName.trim().length === 0}
|
||||
disabled={!canSave || uploadingImage}
|
||||
text={editMode ? 'Update' : 'Create'}
|
||||
onPress={this.handleCreateChannelClick}
|
||||
/>
|
||||
|
||||
+38
-12
@@ -508,6 +508,20 @@ 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;
|
||||
@@ -933,6 +947,30 @@ class FilePage extends React.PureComponent {
|
||||
</View>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
|
||||
<View style={filePageStyle.largeButtonsRow}>
|
||||
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
|
||||
<Icon name={'share-alt'} size={20} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>Share</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity
|
||||
style={filePageStyle.largeButton}
|
||||
onPress={() => this.setState({ showTipView: true })}
|
||||
>
|
||||
<Icon name={'gift'} size={20} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>Tip</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity
|
||||
style={filePageStyle.largeButton}
|
||||
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
|
||||
>
|
||||
<Icon name={'flag'} size={20} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>Report</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<View style={filePageStyle.channelRow}>
|
||||
<View style={filePageStyle.publishInfo}>
|
||||
{channelName && (
|
||||
@@ -969,18 +1007,6 @@ class FilePage extends React.PureComponent {
|
||||
onPress={this.onSaveFilePressed}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
style={[filePageStyle.actionButton, filePageStyle.reportButton]}
|
||||
theme={'light'}
|
||||
icon={'flag'}
|
||||
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
|
||||
/>
|
||||
<Button
|
||||
style={[filePageStyle.actionButton, filePageStyle.tipButton]}
|
||||
theme={'light'}
|
||||
icon={'gift'}
|
||||
onPress={() => this.setState({ showTipView: true })}
|
||||
/>
|
||||
{channelName && (
|
||||
<SubscribeButton
|
||||
style={filePageStyle.actionButton}
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
doAuthenticate,
|
||||
doCheckSync,
|
||||
doGetSync,
|
||||
doSetDefaultAccount,
|
||||
doSyncApply,
|
||||
doUserEmailNew,
|
||||
doUserResendVerificationEmail,
|
||||
@@ -41,12 +40,11 @@ const select = state => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
||||
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
|
||||
@@ -62,7 +62,14 @@ class WalletPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
|
||||
const {
|
||||
onPasswordChanged,
|
||||
onWalletViewLayout,
|
||||
getSyncIsPending,
|
||||
hasSyncedWallet,
|
||||
syncApplyIsPending,
|
||||
syncApplyStarted,
|
||||
} = this.props;
|
||||
|
||||
let content;
|
||||
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
|
||||
@@ -72,11 +79,11 @@ class WalletPage extends React.PureComponent {
|
||||
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
|
||||
</View>
|
||||
);
|
||||
} else if (syncApplyIsPending) {
|
||||
} else if (syncApplyStarted || syncApplyIsPending) {
|
||||
content = (
|
||||
<View style={firstRunStyle.centered}>
|
||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
||||
<Text style={firstRunStyle.paragraph}>Validating password...</Text>
|
||||
<Text style={firstRunStyle.paragraph}>{syncApplyIsPending ? 'Validating password' : 'Synchronizing'}...</Text>
|
||||
</View>
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -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';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
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 ('true' !== firstUserAuth) {
|
||||
if (firstUserAuth !== 'true') {
|
||||
// first_user_auth
|
||||
NativeModules.Firebase.track('first_user_auth', null);
|
||||
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
|
||||
@@ -44,31 +44,39 @@ class WelcomePage extends React.PureComponent {
|
||||
}
|
||||
|
||||
startAuthenticating = () => {
|
||||
const { authenticate } = this.props;
|
||||
this.setState({ authenticationStarted: true, authenticationFailed: false });
|
||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||
Lbry.status()
|
||||
.then(info => {
|
||||
this.setState({ sdkStarted: true });
|
||||
|
||||
authenticate(appVersion, Platform.OS);
|
||||
})
|
||||
.catch(error => {
|
||||
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
|
||||
this.setState({ authenticationFailed: true });
|
||||
|
||||
// sdk_start_failed
|
||||
NativeModules.Firebase.track('sdk_start_failed', null);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.startAuthenticating();
|
||||
this.setState({ statusTries: this.state.statusTries + 1 });
|
||||
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
|
||||
}
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => this.performAuthenticate(appVersion, firebaseToken))
|
||||
.catch(() => {
|
||||
this.performAuthenticate(appVersion); /* proceed without firebase */
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
performAuthenticate(appVersion, firebaseToken) {
|
||||
const { authenticate } = this.props;
|
||||
Lbry.status()
|
||||
.then(info => {
|
||||
this.setState({ sdkStarted: true });
|
||||
|
||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||
})
|
||||
.catch(error => {
|
||||
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
|
||||
this.setState({ authenticationFailed: true });
|
||||
|
||||
// sdk_start_failed
|
||||
NativeModules.Firebase.track('sdk_start_failed', null);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.startAuthenticating();
|
||||
this.setState({ statusTries: this.state.statusTries + 1 });
|
||||
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { authenticating, authToken, onWelcomePageLayout } = this.props;
|
||||
|
||||
|
||||
+35
-26
@@ -66,7 +66,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
|
||||
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props;
|
||||
const { notify, isApplyingSync, setClientSetting } = this.props;
|
||||
|
||||
if (this.state.emailSubmitted && !emailNewPending) {
|
||||
this.setState({ emailSubmitted: false });
|
||||
@@ -81,32 +81,33 @@ class FirstRunScreen extends React.PureComponent {
|
||||
|
||||
if (this.state.syncApplyStarted && !syncApplyIsPending) {
|
||||
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
|
||||
notify({ message: syncApplyErrorMessage, syncApplyStarted: false, isError: true });
|
||||
this.setState({ showBottomContainer: true });
|
||||
notify({ message: syncApplyErrorMessage, isError: true });
|
||||
this.setState({ showBottomContainer: true, syncApplyStarted: false });
|
||||
} else {
|
||||
// password successfully verified
|
||||
NativeModules.UtilityModule.setSecureValue(
|
||||
Constants.KEY_FIRST_RUN_PASSWORD,
|
||||
Constants.KEY_WALLET_PASSWORD,
|
||||
this.state.walletPassword ? this.state.walletPassword : ''
|
||||
);
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
||||
.then(() => this.closeFinalPage())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
Lbry.wallet_status().then(status => {
|
||||
// unlock the wallet
|
||||
if (status.is_locked) {
|
||||
Lbry.wallet_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' }).then(
|
||||
unlocked => {
|
||||
if (unlocked) {
|
||||
this.closeFinalPage();
|
||||
} else {
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// wallet not locked. close final page
|
||||
this.closeFinalPage();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +133,9 @@ class FirstRunScreen extends React.PureComponent {
|
||||
const { navigation } = this.props;
|
||||
const resetAction = StackActions.reset({
|
||||
index: 0,
|
||||
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUri } })],
|
||||
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUrl } })],
|
||||
});
|
||||
navigation.dispatch(resetAction);
|
||||
setTimeout(() => navigation.dispatch(resetAction), 1000);
|
||||
}
|
||||
|
||||
handleLeftButtonPressed = () => {
|
||||
@@ -298,13 +299,20 @@ class FirstRunScreen extends React.PureComponent {
|
||||
const { getSync, setClientSetting } = this.props;
|
||||
if (NativeModules.UtilityModule) {
|
||||
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
|
||||
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
||||
// fresh account, new password set
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
|
||||
if (newPassword.trim().length === 0) {
|
||||
// blank password. Do not encrypt
|
||||
getSync(newPassword);
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
this.closeFinalPage();
|
||||
});
|
||||
} else {
|
||||
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
|
||||
// fresh account, new password set
|
||||
getSync(newPassword);
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
this.closeFinalPage();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -367,6 +375,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
hasSyncedWallet={hasSyncedWallet}
|
||||
getSyncIsPending={getSyncIsPending}
|
||||
syncApplyIsPending={syncApplyIsPending}
|
||||
syncApplyStarted={this.state.syncApplyStarted}
|
||||
onWalletViewLayout={this.onWalletViewLayout}
|
||||
onPasswordChanged={this.onWalletPasswordChanged}
|
||||
/>
|
||||
|
||||
@@ -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, uploadImageAsset } from 'utils/helper';
|
||||
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
|
||||
const languages = {
|
||||
en: 'English',
|
||||
@@ -76,8 +76,10 @@ const languages = {
|
||||
class PublishPage extends React.PureComponent {
|
||||
camera = null;
|
||||
|
||||
scrollView = null;
|
||||
|
||||
state = {
|
||||
canPublish: false,
|
||||
canPublish: true,
|
||||
canUseCamera: false,
|
||||
documentPickerOpen: false,
|
||||
editMode: false,
|
||||
@@ -186,7 +188,6 @@ class PublishPage extends React.PureComponent {
|
||||
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
||||
this.setState(
|
||||
{
|
||||
canPublish: balance >= 0.1,
|
||||
loadingVideos: true,
|
||||
},
|
||||
() => {
|
||||
@@ -319,7 +320,7 @@ class PublishPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
handlePublishPressed = () => {
|
||||
const { notify, publish, updatePublishForm } = this.props;
|
||||
const { balance, notify, publish, updatePublishForm } = this.props;
|
||||
const {
|
||||
editMode,
|
||||
bid,
|
||||
@@ -340,6 +341,16 @@ class PublishPage extends React.PureComponent {
|
||||
uri,
|
||||
} = this.state;
|
||||
|
||||
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
|
||||
notify({
|
||||
message: 'Publishing content requires credits. Press the blue bar to get some for free.',
|
||||
});
|
||||
if (this.scrollView) {
|
||||
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!title || title.trim().length === 0) {
|
||||
notify({ message: 'Please provide a title' });
|
||||
return;
|
||||
@@ -360,7 +371,7 @@ class PublishPage extends React.PureComponent {
|
||||
filePath: currentMedia ? currentMedia.filePath : null,
|
||||
bid: bid || 0.1,
|
||||
title: title || '',
|
||||
thumbnail,
|
||||
thumbnail: thumbnail || '',
|
||||
description: description || '',
|
||||
language,
|
||||
license,
|
||||
@@ -384,6 +395,11 @@ 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.`,
|
||||
});
|
||||
@@ -961,7 +977,7 @@ class PublishPage extends React.PureComponent {
|
||||
this.updateThumbnailUriForMedia(currentMedia);
|
||||
}
|
||||
content = (
|
||||
<ScrollView style={publishStyle.publishDetails}>
|
||||
<ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
|
||||
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
|
||||
<FastImage
|
||||
style={publishStyle.mainThumbnail}
|
||||
@@ -980,7 +996,7 @@ class PublishPage extends React.PureComponent {
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
{!this.state.canPublish && <PublishRewardsDriver navigation={navigation} />}
|
||||
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
|
||||
|
||||
<View style={publishStyle.card}>
|
||||
<View style={publishStyle.textInputLayout}>
|
||||
@@ -1190,7 +1206,7 @@ class PublishPage extends React.PureComponent {
|
||||
<View style={publishStyle.rightActionButtons}>
|
||||
<Button
|
||||
style={publishStyle.publishButton}
|
||||
disabled={!this.state.canPublish || this.state.uploadThumbnailStarted}
|
||||
disabled={this.state.uploadThumbnailStarted}
|
||||
text={this.state.editMode ? 'Save changes' : 'Publish'}
|
||||
onPress={this.handlePublishPressed}
|
||||
/>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/a
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectCurrentRoute, selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import SettingsPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -13,6 +13,7 @@ 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 => ({
|
||||
|
||||
@@ -51,6 +51,7 @@ class SettingsPage extends React.PureComponent {
|
||||
navigation,
|
||||
popDrawerStack,
|
||||
showNsfw,
|
||||
showUriBarSuggestions,
|
||||
setClientSetting,
|
||||
} = this.props;
|
||||
|
||||
@@ -62,6 +63,7 @@ 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>
|
||||
@@ -79,13 +81,29 @@ class SettingsPage extends React.PureComponent {
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Show NSFW content</Text>
|
||||
<Text style={settingsStyle.label}>Show mature content</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch value={showNsfw} onValueChange={value => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.sectionDivider} />
|
||||
<Text style={settingsStyle.sectionTitle}>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>
|
||||
|
||||
@@ -23,14 +23,14 @@ const select = state => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
||||
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
|
||||
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
|
||||
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
||||
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),
|
||||
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
|
||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||
fetchSubscriptions: callback => dispatch(doFetchMySubscriptions(callback)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
|
||||
+48
-47
@@ -38,12 +38,6 @@ class SplashScreen extends React.PureComponent {
|
||||
subscriptionsFetched: false,
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
if (NativeModules.DaemonServiceControl) {
|
||||
NativeModules.DaemonServiceControl.startService();
|
||||
}
|
||||
}
|
||||
|
||||
updateStatus() {
|
||||
Lbry.status().then(status => {
|
||||
this._updateStatusCallback(status);
|
||||
@@ -58,7 +52,7 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
navigation.dispatch(resetAction);
|
||||
|
||||
const launchUrl = navigation.state.params.launchUrl || this.state.launchUrl;
|
||||
const launchUrl = navigation.state.params ? navigation.state.params.launchUrl : this.state.launchUrl;
|
||||
if (launchUrl) {
|
||||
if (launchUrl.startsWith('lbry://?verify=')) {
|
||||
let verification = {};
|
||||
@@ -89,14 +83,15 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { emailToVerify, getSync, setEmailToVerify, verifyUserEmail, verifyUserEmailFailure } = this.props;
|
||||
const { daemonReady, shouldAuthenticate } = this.state;
|
||||
const { user } = nextProps;
|
||||
|
||||
if (this.state.daemonReady && this.state.shouldAuthenticate && user && user.id) {
|
||||
if (daemonReady && shouldAuthenticate && user && user.id) {
|
||||
this.setState({ shouldAuthenticate: false }, () => {
|
||||
// user is authenticated, navigate to the main view
|
||||
if (user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword);
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => this.getUserSettings());
|
||||
this.navigateToMain();
|
||||
});
|
||||
return;
|
||||
@@ -110,9 +105,15 @@ class SplashScreen extends React.PureComponent {
|
||||
getUserSettings = () => {
|
||||
const { populateSharedUserState } = this.props;
|
||||
|
||||
doPreferenceGet('shared', null, null, preference => {
|
||||
populateSharedUserState(preference);
|
||||
});
|
||||
doPreferenceGet(
|
||||
'shared',
|
||||
preference => {
|
||||
populateSharedUserState(preference);
|
||||
},
|
||||
error => {
|
||||
/* failed */
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
finishSplashScreen = () => {
|
||||
@@ -134,19 +135,18 @@ class SplashScreen extends React.PureComponent {
|
||||
filteredOutpointsSubscribe();
|
||||
checkSubscriptionsInit();
|
||||
|
||||
// get user settings interval
|
||||
this.getUserSettings();
|
||||
|
||||
if (user && user.id && user.has_verified_email) {
|
||||
// user already authenticated
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword);
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => this.getUserSettings());
|
||||
this.navigateToMain();
|
||||
});
|
||||
} else {
|
||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||
this.setState({ shouldAuthenticate: true });
|
||||
authenticate(appVersion, Platform.OS);
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => authenticate(appVersion, Platform.OS, firebaseToken))
|
||||
.catch(() => authenticate(appVersion, Platform.OS));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -175,31 +175,35 @@ class SplashScreen extends React.PureComponent {
|
||||
isRunning: true,
|
||||
});
|
||||
|
||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
|
||||
if (walletStatus.is_locked) {
|
||||
this.setState({
|
||||
message: 'Unlocking account',
|
||||
details: 'Decrypting wallet',
|
||||
});
|
||||
Lbry.wallet_status().then(secureWalletStatus => {
|
||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
|
||||
if ((secureWalletStatus.is_encrypted && !secureWalletStatus.is_locked) || secureWalletStatus.is_locked) {
|
||||
this.setState({
|
||||
message: 'Unlocking account',
|
||||
details: 'Decrypting wallet',
|
||||
});
|
||||
|
||||
// unlock the wallet and then finish the splash screen
|
||||
Lbry.account_unlock({ password: password || '' })
|
||||
.then(() => {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
})
|
||||
.catch(() => this.handleAccountUnlockFailed());
|
||||
} else {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
}
|
||||
// unlock the wallet and then finish the splash screen
|
||||
Lbry.wallet_unlock({ password: password || '' }).then(unlocked => {
|
||||
if (unlocked) {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
} else {
|
||||
this.handleAccountUnlockFailed();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return;
|
||||
@@ -243,10 +247,7 @@ class SplashScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('app_launch', null);
|
||||
}
|
||||
|
||||
NativeModules.Firebase.track('app_launch', null);
|
||||
NativeModules.Firebase.setCurrentScreen('Splash');
|
||||
|
||||
this.props.fetchRewardedContent();
|
||||
|
||||
@@ -3,7 +3,6 @@ import { doToast } from 'lbry-redux';
|
||||
import {
|
||||
doCheckSync,
|
||||
doGetSync,
|
||||
doSetDefaultAccount,
|
||||
doSyncApply,
|
||||
doUserEmailNew,
|
||||
doUserEmailToVerify,
|
||||
@@ -55,12 +54,11 @@ const select = state => ({
|
||||
const perform = dispatch => ({
|
||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
|
||||
@@ -37,11 +37,17 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
if (!hasSyncedWallet) {
|
||||
// fresh account with no sync
|
||||
const newPassword = this.state.password ? this.state.password : '';
|
||||
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
||||
if (newPassword.trim().length === 0) {
|
||||
getSync(newPassword);
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
navigation.goBack();
|
||||
});
|
||||
} else {
|
||||
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
|
||||
getSync(newPassword);
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
navigation.goBack();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
syncApply(syncHash, syncData, this.state.password ? this.state.password : '');
|
||||
}
|
||||
@@ -50,7 +56,7 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps;
|
||||
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting, setDefaultAccount } = this.props;
|
||||
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting } = this.props;
|
||||
if (this.state.checkSyncStarted && !getSyncIsPending) {
|
||||
this.setState({ syncChecked: true });
|
||||
}
|
||||
@@ -63,17 +69,12 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
// password successfully verified
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.setSecureValue(
|
||||
Constants.KEY_FIRST_RUN_PASSWORD,
|
||||
Constants.KEY_WALLET_PASSWORD,
|
||||
this.state.password ? this.state.password : ''
|
||||
);
|
||||
}
|
||||
setDefaultAccount(
|
||||
() => this.finishSync(true),
|
||||
err => {
|
||||
// fail silently and still finish
|
||||
this.finishSync();
|
||||
}
|
||||
);
|
||||
|
||||
this.finishSync(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,15 +85,17 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet (if locked)
|
||||
Lbry.status().then(status => {
|
||||
if (status.wallet.is_locked) {
|
||||
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
|
||||
.then(() => navigation.goBack())
|
||||
.catch(err => {
|
||||
Lbry.wallet_status().then(status => {
|
||||
if (status.is_locked) {
|
||||
Lbry.wallet_unlock({ password: this.state.password ? this.state.password : '' }).then(unlocked => {
|
||||
if (unlocked) {
|
||||
navigation.goBack();
|
||||
} else {
|
||||
if (notifyUnlockFailed) {
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
navigation.goBack();
|
||||
}
|
||||
|
||||
@@ -101,7 +101,6 @@ class VerificationScreen extends React.PureComponent {
|
||||
notify,
|
||||
addUserPhone,
|
||||
getSyncIsPending,
|
||||
setDefaultAccount,
|
||||
hasSyncedWallet,
|
||||
setSyncIsPending,
|
||||
syncApplyIsPending,
|
||||
@@ -162,7 +161,6 @@ class VerificationScreen extends React.PureComponent {
|
||||
notify={notify}
|
||||
setEmailVerificationPhase={this.setEmailVerificationPhase}
|
||||
setClientSetting={setClientSetting}
|
||||
setDefaultAccount={setDefaultAccount}
|
||||
setSyncIsPending={setSyncIsPending}
|
||||
syncApplyIsPending={syncApplyIsPending}
|
||||
syncApplyErrorMessage={syncApplyErrorMessage}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||
import { selectBalance } from 'lbry-redux';
|
||||
import { doCheckSync, doGetSync, selectUser, selectHasSyncedWallet } from 'lbryinc';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import WalletPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -21,7 +21,7 @@ const select = state => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_WALLET)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
|
||||
@@ -46,7 +46,7 @@ class WalletPage extends React.PureComponent {
|
||||
|
||||
const { deviceWalletSynced, getSync, user } = this.props;
|
||||
if (deviceWalletSynced && user && user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ const Colors = {
|
||||
VeryLightGrey: '#f1f1f1',
|
||||
White: '#ffffff',
|
||||
UriDescBlue: '#3971db',
|
||||
RewardDriverBlue: '#2196f3',
|
||||
|
||||
StatsAudio: '#f6a637',
|
||||
StatsImage: '#ff4a7d',
|
||||
|
||||
+26
-1
@@ -348,13 +348,17 @@ const filePageStyle = StyleSheet.create({
|
||||
},
|
||||
rewardDriverCard: {
|
||||
alignItems: 'center',
|
||||
backgroundColor: Colors.BrighterLbryGreen,
|
||||
backgroundColor: Colors.RewardDriverBlue,
|
||||
flexDirection: 'row',
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
paddingTop: 12,
|
||||
paddingBottom: 12,
|
||||
},
|
||||
rewardDriverIcon: {
|
||||
color: Colors.White,
|
||||
marginRight: 8,
|
||||
},
|
||||
rewardDriverText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
color: Colors.White,
|
||||
@@ -377,6 +381,27 @@ 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;
|
||||
@@ -297,7 +297,7 @@ const publishStyle = StyleSheet.create({
|
||||
},
|
||||
rewardDriverCard: {
|
||||
alignItems: 'center',
|
||||
backgroundColor: Colors.BrighterLbryGreen,
|
||||
backgroundColor: Colors.RewardDriverBlue,
|
||||
flexDirection: 'row',
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
|
||||
@@ -39,6 +39,14 @@ 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;
|
||||
@@ -36,7 +36,7 @@ const uriBarStyle = StyleSheet.create({
|
||||
},
|
||||
overlay: {
|
||||
position: 'absolute',
|
||||
backgroundColor: 'transparent',
|
||||
backgroundColor: 'red',
|
||||
top: 0,
|
||||
width: '100%',
|
||||
zIndex: 200,
|
||||
@@ -54,9 +54,10 @@ const uriBarStyle = StyleSheet.create({
|
||||
item: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
padding: 12,
|
||||
paddingTop: 8,
|
||||
paddingBottom: 8,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
paddingTop: 12,
|
||||
paddingBottom: 12,
|
||||
},
|
||||
itemContent: {
|
||||
marginLeft: 12,
|
||||
|
||||
@@ -198,7 +198,7 @@ const walletStyle = StyleSheet.create({
|
||||
},
|
||||
rewardDriverCard: {
|
||||
alignItems: 'center',
|
||||
backgroundColor: Colors.BrighterLbryGreen,
|
||||
backgroundColor: Colors.RewardDriverBlue,
|
||||
flexDirection: 'row',
|
||||
padding: 16,
|
||||
marginLeft: 16,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
@@ -290,6 +291,23 @@ export function __(str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
export function logPublish(claimResult) {
|
||||
// eslint-disable-next-line no-undef
|
||||
if (!__DEV__) {
|
||||
const { permanent_url: uri, claim_id: claimId, txid, nout, signing_channel: signingChannel } = claimResult;
|
||||
let channelClaimId;
|
||||
if (signingChannel) {
|
||||
channelClaimId = signingChannel.claim_id;
|
||||
}
|
||||
const outpoint = `${txid}:${nout}`;
|
||||
const params = { uri, claim_id: claimId, outpoint };
|
||||
if (channelClaimId) {
|
||||
params['channel_claim_id'] = channelClaimId;
|
||||
}
|
||||
Lbryio.call('event', 'publish', params);
|
||||
}
|
||||
}
|
||||
|
||||
export function uploadImageAsset(filePath, success, failure) {
|
||||
const makeid = () => {
|
||||
let text = '';
|
||||
|
||||
Reference in new issue
Block a user