Skip to content

Commit

Permalink
Merge branch 'main' into Rory-FixLoadingSpinnerRaceCondition
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/libs/actions/Policy.js
  • Loading branch information
roryabraham committed Oct 8, 2021
2 parents cf625d1 + a860c59 commit 7846d77
Show file tree
Hide file tree
Showing 14 changed files with 206 additions and 64 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001010600
versionName "1.1.6-0"
versionCode 1001010700
versionName "1.1.7-0"
}
splits {
abi {
Expand Down
1 change: 1 addition & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const includeModules = [
'react-native-onyx',
'react-native-gesture-handler',
'react-native-flipper',
'react-native-google-places-autocomplete',
].join('|');

const webpackConfig = {
Expand Down
7 changes: 5 additions & 2 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ platform :ios do

build_app(
workspace: "./ios/NewExpensify.xcworkspace",
scheme: "NewExpensify"
scheme: "NewExpensify",
export_options: {
manageAppVersionAndBuildNumber: false
}
)

begin
Expand Down Expand Up @@ -150,7 +153,7 @@ platform :ios do
api_key_path: "./ios/ios-fastlane-json-key.json",

# Skip HTMl report verification
force: true,
force: true,

# VERSION will be set to the full build_number e.g. '1.0.92.0'
build_number: ENV["VERSION"],
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.6</string>
<string>1.1.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.6.0</string>
<string>1.1.7.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.6</string>
<string>1.1.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.6.0</string>
<string>1.1.7.0</string>
</dict>
</plist>
22 changes: 19 additions & 3 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.1.6-0",
"version": "1.1.7-0",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down Expand Up @@ -81,6 +81,7 @@
"react-native-config": "^1.4.0",
"react-native-document-picker": "^5.1.0",
"react-native-gesture-handler": "1.9.0",
"react-native-google-places-autocomplete": "^2.4.1",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-picker": "^4.0.3",
"react-native-keyboard-spacer": "^0.4.1",
Expand Down Expand Up @@ -209,7 +210,7 @@
"runnerConfig": "tests/e2e/config.json",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/expensify.cash.app",
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/new expensify.app",
"build": "xcodebuild -workspace ios/NewExpensify.xcworkspace -scheme NewExpensify -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"type": "ios.simulator",
"name": "iPhone 11"
Expand Down
121 changes: 121 additions & 0 deletions src/components/AddressSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import _ from 'underscore';
import React from 'react';
import PropTypes from 'prop-types';
import {LogBox} from 'react-native';
import {GooglePlacesAutocomplete} from 'react-native-google-places-autocomplete';
import CONFIG from '../CONFIG';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import styles from '../styles/styles';
import ExpensiTextInput from './ExpensiTextInput';

// The error that's being thrown below will be ignored until we fork the
// react-native-google-places-autocomplete repo and replace the
// VirtualizedList component with a VirtualizedList-backed instead
LogBox.ignoreLogs(['VirtualizedLists should never be nested']);

const propTypes = {
/** The label to display for the field */
label: PropTypes.string.isRequired,

/** The value to set the field to initially */
value: PropTypes.string,

/** A callback function when the value of this field has changed */
onChangeText: PropTypes.func.isRequired,

/** Customize the ExpensiTextInput container */
containerStyles: PropTypes.arrayOf(PropTypes.object),

...withLocalizePropTypes,
};
const defaultProps = {
value: '',
containerStyles: null,
};

class AddressSearch extends React.Component {
constructor(props) {
super(props);
this.googlePlacesRef = React.createRef();
}

componentDidMount() {
this.googlePlacesRef.current?.setAddressText(this.props.value);
}

getAddressComponent(object, field, nameType) {
return _.chain(object.address_components)
.find(component => _.contains(component.types, field))
.get(nameType)
.value();
}

/**
* @param {Object} details See https://developers.google.com/maps/documentation/places/web-service/details#PlaceDetailsResponses
*/
saveLocationDetails = (details) => {
if (details.address_components) {
// Gather the values from the Google details
const streetNumber = this.getAddressComponent(details, 'street_number', 'long_name');
const streetName = this.getAddressComponent(details, 'route', 'long_name');
const city = this.getAddressComponent(details, 'locality', 'long_name');
const state = this.getAddressComponent(details, 'administrative_area_level_1', 'short_name');
const zipCode = this.getAddressComponent(details, 'postal_code', 'long_name');

// Trigger text change events for each of the individual fields being saved on the server
this.props.onChangeText('addressStreet', `${streetNumber} ${streetName}`);
this.props.onChangeText('addressCity', city);
this.props.onChangeText('addressState', state);
this.props.onChangeText('addressZipCode', zipCode);
}
}

render() {
return (
<GooglePlacesAutocomplete
ref={this.googlePlacesRef}
fetchDetails
keepResultsAfterBlur
suppressDefaultStyles
enablePoweredByContainer={false}
onPress={(data, details) => this.saveLocationDetails(details)}
query={{
key: 'AIzaSyC4axhhXtpiS-WozJEsmlL3Kg3kXucbZus',
language: this.props.preferredLocale,
}}
requestUrl={{
useOnPlatform: 'web',
url: `${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}api?command=Proxy_GooglePlaces&proxyUrl=`,
}}
textInputProps={{
InputComp: ExpensiTextInput,
label: this.props.label,
containerStyles: this.props.containerStyles,
}}
styles={{
textInputContainer: [styles.flexColumn],
listView: [
styles.borderTopRounded,
styles.borderBottomRounded,
styles.mt1,
styles.overflowAuto,
styles.borderLeft,
styles.borderRight,
],
row: [
styles.pv4,
styles.ph3,
styles.overflowAuto,
],
description: [styles.googleSearchText],
separator: [styles.googleSearchSeperator],
}}
/>
);
}
}

AddressSearch.propTypes = propTypes;
AddressSearch.defaultProps = defaultProps;

export default withLocalize(AddressSearch);
2 changes: 1 addition & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ export default {
pleaseEnterUniqueLogin: 'That user is already a member of this workspace.',
genericFailureMessage: 'An error occurred inviting the user to the workspace, please try again.',
systemUserError: ({email}) => `Sorry, you cannot invite ${email} to a workspace.`,
welcomeNote: ({workspaceName}) => `You have been invited to the ${workspaceName} workspace! Download the Expensify mobile app to start tracking your expenses.`,
welcomeNote: ({workspaceName}) => `You have been invited to ${workspaceName}! Download the Expensify mobile app to start tracking your expenses.`,
},
editor: {
nameInputLabel: 'Name',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ export default {
pleaseEnterUniqueLogin: 'Ese usuario ya es miembro de este espacio de trabajo.',
genericFailureMessage: 'Se produjo un error al invitar al usuario al espacio de trabajo. Vuelva a intentarlo..',
systemUserError: ({email}) => `Lo sentimos, no puedes invitar a ${email} a un espacio de trabajo.`,
welcomeNote: ({workspaceName}) => `¡Has sido invitado a la ${workspaceName} Espacio de trabajo! Descargue la aplicación móvil Expensify para comenzar a rastrear sus gastos.`,
welcomeNote: ({workspaceName}) => `¡Has sido invitado a ${workspaceName}! Descargue la aplicación móvil Expensify para comenzar a rastrear sus gastos.`,
},
editor: {
nameInputLabel: 'Nombre',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function create(name = '', shouldAutomaticallyReroute = true) {
const policyID = lodashGet(res, 'policyID');
if (shouldAutomaticallyReroute) {
Navigation.dismissModal();
Navigation.navigate(ROUTES.getWorkspaceCardRoute(policyID));
Navigation.navigate(policyID ? ROUTES.getWorkspaceCardRoute(policyID) : ROUTES.HOME);
}
return Promise.resolve(policyID);
});
Expand Down
52 changes: 5 additions & 47 deletions src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ import TextLink from '../../components/TextLink';
import StatePicker from '../../components/StatePicker';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import {
isValidAddress, isValidDate, isValidZipCode, isRequiredFulfilled, isValidPhoneWithSpecialChars, isValidURL,
isValidDate, isRequiredFulfilled, isValidURL, isValidPhoneWithSpecialChars,
} from '../../libs/ValidationUtils';
import compose from '../../libs/compose';
import ONYXKEYS from '../../ONYXKEYS';
import ExpensiPicker from '../../components/ExpensiPicker';
import * as ReimbursementAccountUtils from '../../libs/ReimbursementAccountUtils';
import reimbursementAccountPropTypes from './reimbursementAccountPropTypes';
import ReimbursementAccountForm from './ReimbursementAccountForm';
import AddressSearch from '../../components/AddressSearch';

const propTypes = {
/** Bank account currently in setup */
Expand Down Expand Up @@ -69,10 +70,6 @@ class CompanyStep extends React.Component {
// These fields need to be filled out in order to submit the form
this.requiredFields = [
'companyName',
'addressStreet',
'addressCity',
'addressState',
'addressZipCode',
'website',
'companyTaxID',
'incorporationDate',
Expand All @@ -84,9 +81,6 @@ class CompanyStep extends React.Component {

// Map a field to the key of the error's translation
this.errorTranslationKeys = {
addressStreet: 'bankAccount.error.addressStreet',
addressCity: 'bankAccount.error.addressCity',
addressZipCode: 'bankAccount.error.zipCode',
companyName: 'bankAccount.error.companyName',
companyPhone: 'bankAccount.error.phoneNumber',
website: 'bankAccount.error.website',
Expand Down Expand Up @@ -125,13 +119,6 @@ class CompanyStep extends React.Component {
*/
validate() {
const errors = {};
if (!isValidAddress(this.state.addressStreet)) {
errors.addressStreet = true;
}

if (!isValidZipCode(this.state.addressZipCode)) {
errors.addressZipCode = true;
}

if (!isValidURL(this.state.website)) {
errors.website = true;
Expand Down Expand Up @@ -193,40 +180,11 @@ class CompanyStep extends React.Component {
disabled={shouldDisableCompanyName}
errorText={this.getErrorText('companyName')}
/>
<ExpensiTextInput
<AddressSearch
label={this.props.translate('common.companyAddress')}
containerStyles={[styles.mt4]}
onChangeText={value => this.clearErrorAndSetValue('addressStreet', value)}
value={this.state.addressStreet}
errorText={this.getErrorText('addressStreet')}
/>
<Text style={[styles.mutedTextLabel, styles.mt1]}>{this.props.translate('common.noPO')}</Text>
<View style={[styles.flexRow, styles.mt4]}>
<View style={[styles.flex2, styles.mr2]}>
<ExpensiTextInput
label={this.props.translate('common.city')}
onChangeText={value => this.clearErrorAndSetValue('addressCity', value)}
value={this.state.addressCity}
errorText={this.getErrorText('addressCity')}
translateX={-14}
/>
</View>
<View style={[styles.flex1]}>
<StatePicker
onChange={value => this.clearErrorAndSetValue('addressState', value)}
value={this.state.addressState}
hasError={this.getErrors().addressState}
/>
</View>
</View>
<ExpensiTextInput
label={this.props.translate('common.zip')}
containerStyles={[styles.mt4]}
keyboardType={CONST.KEYBOARD_TYPE.NUMERIC}
onChangeText={value => this.clearErrorAndSetValue('addressZipCode', value)}
value={this.state.addressZipCode}
errorText={this.getErrorText('addressZipCode')}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.ZIP_CODE}
value={`${this.state.addressStreet} ${this.state.addressCity} ${this.state.addressState} ${this.state.addressZipCode}`}
onChangeText={(fieldName, value) => this.clearErrorAndSetValue(fieldName, value)}
/>
<ExpensiTextInput
label={this.props.translate('common.phoneNumber')}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/Payments/PaymentMethodList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {FlatList, Text} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import styles from '../../../styles/styles';
import MenuItem from '../../../components/MenuItem';
import compose from '../../../libs/compose';
Expand Down Expand Up @@ -87,7 +88,7 @@ class PaymentMethodList extends Component {
bankAccount.accountNumber.slice(-4)
}`
: null;
const {icon, iconSize} = getBankIcon(bankAccount.additionalData.bankName);
const {icon, iconSize} = getBankIcon(lodashGet(bankAccount, 'additionalData.bankName', ''));
combinedPaymentMethods.push({
type: MENU_ITEM,
title: bankAccount.addressName,
Expand Down
Loading

0 comments on commit 7846d77

Please sign in to comment.