Skip to content

Commit

Permalink
Merge pull request #2 from Expensify/master
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
tugbadogan authored Mar 15, 2021
2 parents 43ad727 + c816a13 commit c452e2e
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 253 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001000249
versionName "1.0.2-49"
versionCode 1001000252
versionName "1.0.2-52"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.2.49</string>
<string>1.0.2.52</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCashTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.2.49</string>
<string>1.0.2.52</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expensify.cash",
"version": "1.0.2-49",
"version": "1.0.2-52",
"author": "Expensify, Inc.",
"homepage": "https://expensify.cash",
"description": "Expensify.cash is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
13 changes: 0 additions & 13 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function isAuthTokenRequired(command) {
'Graphite_Timer',
'Authenticate',
'GetAccountStatus',
'SetGithubUsername',
'SetPassword',
'User_SignUp',
'ResendValidateCode',
Expand Down Expand Up @@ -540,17 +539,6 @@ function ResendValidateCode(parameters) {
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.githubUsername
* @returns {Promise}
*/
function SetGithubUsername(parameters) {
const commandName = 'SetGithubUsername';
requireParameters(['email', 'githubUsername'], parameters, commandName);
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.password
Expand Down Expand Up @@ -654,7 +642,6 @@ export {
Report_TogglePinned,
Report_UpdateLastRead,
ResendValidateCode,
SetGithubUsername,
SetNameValuePair,
SetPassword,
UpdateAccount,
Expand Down
26 changes: 0 additions & 26 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ function fetchAccountDetails(login) {
});
Onyx.merge(ONYXKEYS.ACCOUNT, {
accountExists: response.accountExists,
canAccessExpensifyCash: response.canAccessExpensifyCash,
requiresTwoFactorAuth: response.requiresTwoFactorAuth,
});

Expand Down Expand Up @@ -183,30 +182,6 @@ function signIn(password, twoFactorAuthCode) {
});
}

/**
* Puts the github username into Onyx so that it can be used when creating accounts or logins
*
* @param {String} username
*/
function setGitHubUsername(username) {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: '', loading: true});

API.SetGithubUsername({email: credentials.login, githubUsername: username})
.then((response) => {
if (response.jsonCode === 200) {
Onyx.merge(ONYXKEYS.CREDENTIALS, {githubUsername: username});
Onyx.merge(ONYXKEYS.ACCOUNT, {canAccessExpensifyCash: true});
return;
}

// This request can fail if an invalid GitHub username was entered
Onyx.merge(ONYXKEYS.ACCOUNT, {error: 'Please enter a valid GitHub username'});
})
.finally(() => {
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false});
});
}

/**
* Resend the validation link to the user that is validating their account
* this happens in the createAccount() flow
Expand Down Expand Up @@ -259,7 +234,6 @@ function setPassword(password, validateCode) {

export {
fetchAccountDetails,
setGitHubUsername,
setPassword,
signIn,
signOut,
Expand Down
9 changes: 7 additions & 2 deletions src/pages/iou/IOUBillPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from 'react';
import IOUModal from './IOUModal';
import ScreenWrapper from '../../components/ScreenWrapper';

export default props => (
// eslint-disable-next-line react/jsx-props-no-spreading
<IOUModal {...props} hasMultipleParticipants />
<ScreenWrapper>
{() => (
// eslint-disable-next-line react/jsx-props-no-spreading
<IOUModal {...props} hasMultipleParticipants />
)}
</ScreenWrapper>
);
2 changes: 1 addition & 1 deletion src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class IOUModal extends Component {
<Header title={this.getTitleForStep()} />
<View style={[styles.reportOptions, styles.flexRow]}>
<TouchableOpacity
onCloseButtonPress={Navigation.dismissModal}
onPress={Navigation.dismissModal}
style={[styles.touchableButtonImage]}
>
<Icon src={Close} />
Expand Down
9 changes: 7 additions & 2 deletions src/pages/iou/IOURequestPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from 'react';
import IOUModal from './IOUModal';
import ScreenWrapper from '../../components/ScreenWrapper';

export default props => (
// eslint-disable-next-line react/jsx-props-no-spreading
<IOUModal {...props} />
<ScreenWrapper>
{() => (
// eslint-disable-next-line react/jsx-props-no-spreading
<IOUModal {...props} />
)}
</ScreenWrapper>
);
119 changes: 102 additions & 17 deletions src/pages/settings/PaymentsPage.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,109 @@
import React from 'react';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import Navigation from '../../libs/Navigation/Navigation';
import {Pressable, TextInput, View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import CONST from '../../CONST';
import ONYXKEYS from '../../ONYXKEYS';
import ROUTES from '../../ROUTES';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import Text from '../../components/Text';
import ScreenWrapper from '../../components/ScreenWrapper';
import NameValuePair from '../../libs/actions/NameValuePair';
import {fetch} from '../../libs/actions/User';
import Navigation from '../../libs/Navigation/Navigation';
import styles from '../../styles/styles';

const propTypes = {
payPalMeUsername: PropTypes.string,
};

const defaultProps = {
payPalMeUsername: '',
};

class PaymentsPage extends React.Component {
constructor(props) {
super(props);

this.state = {
payPalMeUsername: props.payPalMeUsername,
};
this.setPayPalMeUsername = this.setPayPalMeUsername.bind(this);
}

componentDidMount() {
fetch();
}

componentDidUpdate(prevProps) {
if (prevProps.payPalMeUsername !== this.props.payPalMeUsername) {
// Suppressing because this is within a conditional, and hence we won't run into an infinite loop
// eslint-disable-next-line react/no-did-update-set-state
this.setState({payPalMeUsername: this.props.payPalMeUsername});
}
}

/**
* Sets the payPalMeUsername for the current user
*/
setPayPalMeUsername() {
NameValuePair.set(CONST.NVP.PAYPAL_ME_ADDRESS, this.state.payPalMeUsername, ONYXKEYS.NVP_PAYPAL_ME_ADDRESS);
}

render() {
return (
<ScreenWrapper>
{() => (
<>
<HeaderWithCloseButton
title="Payments"
shouldShowBackButton
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS)}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<View style={[styles.flex1, styles.p5]}>
<View style={[styles.flex1]}>
<Text style={[styles.textP, styles.mb4]}>
Enter your username to get paid back via PayPal.
</Text>
<Text style={[styles.formLabel]} numberOfLines={1}>
PayPal.me/
</Text>
<TextInput
style={[styles.textInput]}
value={this.state.payPalMeUsername}
placeholder="Your PayPal username"
onChangeText={text => this.setState({payPalMeUsername: text})}
/>
</View>
<Pressable
onPress={this.setPayPalMeUsername}
style={({hovered}) => [
styles.button,
styles.buttonSuccess,
styles.mt3,
hovered && styles.buttonSuccessHovered,
]}
>
<Text style={[styles.buttonText, styles.buttonSuccessText]}>
Add PayPal Account
</Text>
</Pressable>
</View>
</>

const PaymentsPage = () => (
<ScreenWrapper>
{() => (
<>
<HeaderWithCloseButton
title="Payments"
shouldShowBackButton
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS)}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
</>
)}
</ScreenWrapper>
);
)}
</ScreenWrapper>
);
}
}

PaymentsPage.propTypes = propTypes;
PaymentsPage.defaultProps = defaultProps;
PaymentsPage.displayName = 'PaymentsPage';

export default PaymentsPage;
export default withOnyx({
payPalMeUsername: {
key: ONYXKEYS.NVP_PAYPAL_ME_ADDRESS,
},
})(PaymentsPage);
Loading

0 comments on commit c452e2e

Please sign in to comment.