Compare commits

..
Author SHA1 Message Date
Akinwale Ariwodola 3bb8ee12eb update copy 2019-10-29 13:35:22 +01:00
Akinwale Ariwodola c3a431b40c wallet sign in driver 2019-10-25 16:26:14 +01:00
16 changed files with 135 additions and 179 deletions

No files matched your search

+2 -2
View File
@@ -5640,8 +5640,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"from": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"version": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
"from": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
"requires": {
"proxy-polyfill": "0.1.6",
"reselect": "^3.0.0",
+1 -1
View File
@@ -12,7 +12,7 @@
"base-64": "^0.1.0",
"@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"lbry-redux": "lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",
+4 -6
View File
@@ -297,18 +297,16 @@ class AppWithNavigationState extends React.Component {
}
componentDidMount() {
const { dispatch, user } = this.props;
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
if (user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
});
}
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
});
}, SYNC_GET_INTERVAL);
}
+1 -1
View File
@@ -32,7 +32,7 @@ class RewardEnrolment extends React.Component {
const { fetching, navigation, unclaimedRewardAmount, user } = this.props;
return (
<View style={rewardStyle.enrollContainer} onPress>
<View style={rewardStyle.enrollContainer}>
<View style={rewardStyle.summaryRow}>
<Icon name="award" size={36} color={Colors.White} />
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} available credits</Text>
+19
View File
@@ -0,0 +1,19 @@
import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { doSetClientSetting } from 'redux/actions/settings';
import { selectUser } from 'lbryinc';
import WalletSignIn from './view';
const select = state => ({
user: selectUser(state),
});
const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
});
export default connect(
select,
perform
)(WalletSignIn);
+48
View File
@@ -0,0 +1,48 @@
import React from 'react';
import { Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import Button from 'component/button';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Link from 'component/link';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
import walletStyle from 'styles/wallet';
class WalletSignIn extends React.Component {
onContinuePressed = () => {
const { navigation, setClientSetting } = this.props;
setClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS, true);
};
onSignInPressed = () => {
const { navigation } = this.props;
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
};
render() {
const { navigation, user } = this.props;
return (
<View style={walletStyle.signInContainer}>
<View style={walletStyle.signInSummaryRow}>
<Text style={walletStyle.signInTitle}>Account Recommended</Text>
</View>
<View style={walletStyle.onboarding}>
<Text style={walletStyle.onboardingText}>
An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced..
{'\n\n'}
Without an account, you assume all responsibility for securing your wallet and LBRY data.{'\n\n'}
</Text>
</View>
<View style={walletStyle.buttonRow}>
<Link style={walletStyle.continueLink} text={'Skip Account'} onPress={this.onContinuePressed} />
<Button style={walletStyle.signInButton} theme={'light'} text={'Sign Up'} onPress={this.onSignInPressed} />
</View>
</View>
);
}
}
export default WalletSignIn;
+1 -4
View File
@@ -5,11 +5,10 @@ import {
doToast,
doUpdatePublishForm,
selectBalance,
selectMyClaims,
selectPublishFormValues,
} from 'lbry-redux';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { doUpdatePublishFormState, doClearPublishFormState, doPendingPublishSuccess } from 'redux/actions/form';
import { doUpdatePublishFormState, doClearPublishFormState } from 'redux/actions/form';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
@@ -19,7 +18,6 @@ const select = state => ({
balance: selectBalance(state),
drawerStack: selectDrawerStack(state),
hasFormState: selectHasPublishFormState(state),
myClaims: selectMyClaims(state),
publishFormState: selectPublishFormState(state),
publishFormValues: selectPublishFormValues(state),
});
@@ -27,7 +25,6 @@ const select = state => ({
const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
clearPublishFormState: () => dispatch(doClearPublishFormState()),
pendingPublishSuccess: pendingClaim => dispatch(doPendingPublishSuccess(pendingClaim)),
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
publish: (success, fail) => dispatch(doPublish(success, fail)),
+2 -4
View File
@@ -17,12 +17,10 @@ import {
import { FlatGrid } from 'react-native-super-grid';
import {
isNameValid,
batchActions,
buildURI,
normalizeURI,
parseURI,
regexInvalidURI,
ACTIONS,
CLAIM_VALUES,
LICENSES,
MATURE_TAGS,
@@ -396,11 +394,11 @@ class PublishPage extends React.PureComponent {
};
handlePublishSuccess = data => {
const { clearPublishFormState, navigation, notify, pendingPublishSuccess } = this.props;
const { clearPublishFormState, navigation, notify } = this.props;
const pendingClaim = data.outputs[0];
logPublish(pendingClaim);
pendingPublishSuccess(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.`,
-4
View File
@@ -3,9 +3,7 @@ import {
doAbandonClaim,
doCheckPendingPublishes,
doFetchClaimListMine,
doToast,
selectMyClaimUrisWithoutChannels,
selectPendingClaims,
selectIsFetchingClaimListMine,
} from 'lbry-redux';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
@@ -15,14 +13,12 @@ import PublishesPage from './view';
const select = state => ({
uris: selectMyClaimUrisWithoutChannels(state),
fetching: selectIsFetchingClaimListMine(state),
pendingClaims: selectPendingClaims(state),
});
const perform = dispatch => ({
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
notify: data => dispatch(doToast(data)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_PUBLISHES)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
});
+2 -11
View File
@@ -54,8 +54,6 @@ class PublishesPage extends React.PureComponent {
};
addOrRemoveItem = (uri, claim) => {
const { pendingClaims } = this.state;
const { selectedClaimsMap } = this.state;
let selectedUris = [...this.state.selectedUris];
@@ -174,15 +172,8 @@ class PublishesPage extends React.PureComponent {
if (selectionMode) {
this.handleSelectItem(item, claim);
} else {
const { notify, pendingClaims } = this.props;
if (pendingClaims.some(pendingClaim => pendingClaim.claim_id === claim.claim_id)) {
notify({
message: __('This content is currently pending. It will be available in a few minutes.'),
});
} else {
// TODO: when shortUrl is available for my claims, navigate to that URL instead
navigateToUri(navigation, item);
}
// TODO: when shortUrl is available for my claims, navigate to that URL instead
navigateToUri(navigation, item);
}
}}
onLongPress={claim => this.handleItemLongPress(item, claim)}
-4
View File
@@ -14,10 +14,6 @@ const select = state => ({
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
receiveSubscriptionNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS)(state),
receiveRewardNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS)(state),
receiveInterestsNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS)(state),
receiveCreatorNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS)(state),
});
const perform = dispatch => ({
+3 -83
View File
@@ -1,7 +1,7 @@
import React from 'react';
import { SETTINGS } from 'lbry-redux';
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
import { __, navigateBack } from 'utils/helper';
import { navigateBack } from 'utils/helper';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import PageHeader from 'component/pageHeader';
import settingsStyle from 'styles/settings';
@@ -43,16 +43,6 @@ class SettingsPage extends React.PureComponent {
}
}
setNativeBooleanSetting = (key, value) => {
const { setClientSetting } = this.props;
setClientSetting(key, value);
NativeModules.UtilityModule.setNativeBooleanSetting(key, value);
};
getBooleanSetting = (value, defaultValue) => {
return value === null || value === undefined ? defaultValue : value;
};
render() {
const {
backgroundPlayEnabled,
@@ -60,21 +50,14 @@ class SettingsPage extends React.PureComponent {
keepDaemonRunning,
navigation,
popDrawerStack,
receiveSubscriptionNotifications,
receiveRewardNotifications,
receiveInterestsNotifications,
receiveCreatorNotifications,
showNsfw,
showUriBarSuggestions,
setClientSetting,
} = this.props;
// default to true if the setting is null or undefined
const actualKeepDaemonRunning = this.getBooleanSetting(keepDaemonRunning, true);
const actualReceiveSubscriptionNotifications = this.getBooleanSetting(receiveSubscriptionNotifications, true);
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
const actualKeepDaemonRunning =
keepDaemonRunning === null || keepDaemonRunning === undefined ? true : keepDaemonRunning;
return (
<View style={settingsStyle.container}>
@@ -105,69 +88,6 @@ class SettingsPage extends React.PureComponent {
</View>
</View>
<View style={settingsStyle.sectionDivider} />
<Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text>
<Text style={settingsStyle.sectionDescription}>
{__('Choose the notifications you would like to receive.')}
</Text>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>{__('Subscriptions')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
value={actualReceiveSubscriptionNotifications}
onValueChange={value => {
this.setNativeBooleanSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS, value);
}}
/>
</View>
</View>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>{__('Rewards')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
value={actualReceiveRewardNotifications}
onValueChange={value => {
this.setNativeBooleanSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS, value);
}}
/>
</View>
</View>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>{__('Tags you follow')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
value={actualReceiveInterestsNotifications}
onValueChange={value => {
this.setNativeBooleanSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS, value);
}}
/>
</View>
</View>
{false && (
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>{__('Content creator tips')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
value={actualReceiveCreatorNotifications}
onValueChange={value => {
this.setNativeBooleanSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS, value);
}}
/>
</View>
</View>
)}
<View style={settingsStyle.sectionDivider} />
<Text style={settingsStyle.sectionTitle}>Search</Text>
<View style={settingsStyle.row}>
+6 -23
View File
@@ -5,6 +5,7 @@ import WalletAddress from 'component/walletAddress';
import WalletBalance from 'component/walletBalance';
import WalletSend from 'component/walletSend';
import WalletRewardsDriver from 'component/walletRewardsDriver';
import WalletSignIn from 'component/walletSignIn';
import WalletSyncDriver from 'component/walletSyncDriver';
import Button from 'component/button';
import Link from 'component/link';
@@ -66,33 +67,15 @@ class WalletPage extends React.PureComponent {
understandsRisks,
setClientSetting,
navigation,
user,
} = this.props;
if (!understandsRisks) {
const signedIn = user && user.has_verified_email;
if (!signedIn && !understandsRisks) {
return (
<View>
<View style={walletStyle.container}>
<UriBar navigation={navigation} />
<View style={walletStyle.warning}>
<Text style={walletStyle.warningParagraph}>
This is beta software. You may lose any credits that you send to your wallet due to software bugs, deleted
files, or malicious third-party software. You should not use this wallet as your primary wallet.
</Text>
{!hasSyncedWallet && (
<Text style={walletStyle.warningParagraph}>
Since you are not using the LBRY sync service, you will lose all of your credits if you uninstall this
application. Instructions on how to enroll as well as how to backup your wallet manually are available
on the next page.
</Text>
)}
<Text style={walletStyle.warningText}>
If you understand the risks and you wish to continue, please tap the button below.
</Text>
</View>
<Button
text={'I understand the risks'}
style={[walletStyle.button, walletStyle.understand]}
onPress={() => setClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS, true)}
/>
<WalletSignIn navigation={navigation} />
</View>
);
}
-29
View File
@@ -1,5 +1,4 @@
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import { ACTIONS, batchActions, selectMyClaims } from 'lbry-redux';
export const doUpdatePublishFormState = publishFormValue => dispatch =>
dispatch({
@@ -22,31 +21,3 @@ export const doClearChannelFormState = () => dispatch =>
dispatch({
type: Constants.ACTION_CLEAR_CHANNEL_FORM_STATE,
});
export const doPendingPublishSuccess = pendingClaim => (dispatch, getState) => {
const state = getState();
const myClaims = selectMyClaims(state);
const { permanent_url: url } = pendingClaim;
const actions = [
{
type: ACTIONS.PUBLISH_SUCCESS,
},
];
// We have to fake a temp claim until the new pending one is returned by claim_list_mine
// We can't rely on claim_list_mine because there might be some delay before the new claims are returned
// Doing this allows us to show the pending claim immediately, it will get overwritten by the real one
const isMatch = claim => claim.claim_id === pendingClaim.claim_id;
const isEdit = myClaims.some(isMatch);
const myNewClaims = isEdit
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
: myClaims.concat(pendingClaim);
actions.push({
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
data: {
claims: myNewClaims,
},
});
dispatch(batchActions(...actions));
};
-7
View File
@@ -44,13 +44,6 @@ const settingsStyle = StyleSheet.create({
fontSize: 20,
marginBottom: 4,
},
sectionDescription: {
color: '#aaaaaa',
fontFamily: 'Inter-UI-Regular',
fontSize: 12,
lineHeight: 18,
marginBottom: 8,
},
sectionDivider: {
marginTop: 24,
},
+46
View File
@@ -305,6 +305,52 @@ const walletStyle = StyleSheet.create({
fontSize: 16,
marginLeft: 8,
},
buttonRow: {
width: '100%',
position: 'absolute',
alignItems: 'center',
left: 24,
bottom: 24,
flexDirection: 'row',
justifyContent: 'space-between',
},
continueLink: {
fontSize: 14,
fontFamily: 'Inter-UI-Regular',
color: Colors.White,
},
learnMoreLink: {
fontFamily: 'Inter-UI-Regular',
color: Colors.NextLbryGreen,
},
signInButton: {
backgroundColor: Colors.White,
paddingLeft: 16,
paddingRight: 16,
},
signInContainer: {
flex: 1,
marginTop: 60,
padding: 24,
backgroundColor: Colors.LbryGreen,
},
onboarding: {
marginTop: 36,
},
onboardingText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 18,
lineHeight: 28,
color: Colors.White,
},
signInSummaryRow: {
flexDirection: 'row',
},
signInTitle: {
color: Colors.White,
fontFamily: 'Inter-UI-Regular',
fontSize: 28,
},
});
export default walletStyle;