Skip to content

Commit

Permalink
Merge pull request #14603 from Expensify/update-staging-from-main
Browse files Browse the repository at this point in the history
Update version to 1.2.60-0 on staging
  • Loading branch information
OSBotify authored Jan 26, 2023
2 parents 1bc6131 + 3cef17d commit 147d609
Show file tree
Hide file tree
Showing 29 changed files with 232 additions and 165 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001025901
versionName "1.2.59-1"
versionCode 1001026000
versionName "1.2.60-0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
7 changes: 7 additions & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
],
},

// We are importing this worker as a string by using asset/source otherwise it will default to loading via an HTTPS request later.
// This causes issues if we have gone offline before the pdfjs web worker is set up as we won't be able to load it from the server.
{
test: new RegExp('node_modules/pdfjs-dist/legacy/build/pdf.worker.js'),
type: 'asset/source',
},

// Rule for react-native-web-webview
{
test: /postMock.html$/,
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.2.59</string>
<string>1.2.60</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.59.1</string>
<string>1.2.60.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.2.59</string>
<string>1.2.60</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.59.1</string>
<string>1.2.60.0</string>
</dict>
</plist>
18 changes: 10 additions & 8 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.2.59-1",
"version": "1.2.60-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 @@ -68,7 +68,7 @@
"babel-polyfill": "^6.26.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+https://github.com/Expensify/expensify-common.git#6657a014d9c295c998d98562806b4df8bc9fd17e",
"expensify-common": "git+https://github.com/Expensify/expensify-common.git#ca07936e09ff4ebbaf4b423f43adfb35e17c799d",
"fbjs": "^3.0.2",
"file-loader": "^6.0.0",
"html-entities": "^1.3.1",
Expand Down
2 changes: 1 addition & 1 deletion react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
project: {
ios: {},
ios: {sourceDir: 'ios'},
android: {},
},
assets: ['./assets/fonts/native'],
Expand Down
1 change: 1 addition & 0 deletions src/components/AddressSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const AddressSearch = (props) => {
>
<View style={styles.w100}>
<GooglePlacesAutocomplete
disableScroll
fetchDetails
suppressDefaultStyles
enablePoweredByContainer={false}
Expand Down
13 changes: 10 additions & 3 deletions src/components/Form.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import lodashGet from 'lodash/get';
import React from 'react';
import {View, ScrollView} from 'react-native';
import {ScrollView, StyleSheet} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
import {withOnyx} from 'react-native-onyx';
Expand All @@ -10,8 +10,10 @@ import * as FormActions from '../libs/actions/FormActions';
import * as ErrorUtils from '../libs/ErrorUtils';
import styles from '../styles/styles';
import FormAlertWithSubmitButton from './FormAlertWithSubmitButton';
import FormSubmit from './FormSubmit';
import SafeAreaConsumer from './SafeAreaConsumer';
import ScrollViewWithContext from './ScrollViewWithContext';
import stylePropTypes from '../styles/stylePropTypes';

const propTypes = {
/** A unique Onyx key identifying the form */
Expand Down Expand Up @@ -67,6 +69,9 @@ const propTypes = {
*/
scrollContextEnabled: PropTypes.bool,

/** Container styles */
style: stylePropTypes,

...withLocalizePropTypes,
};

Expand All @@ -81,6 +86,7 @@ const defaultProps = {
isSubmitActionDangerous: false,
scrollToOverflowEnabled: false,
scrollContextEnabled: false,
style: [],
};

class Form extends React.Component {
Expand Down Expand Up @@ -273,7 +279,7 @@ class Form extends React.Component {

render() {
const scrollViewContent = safeAreaPaddingBottomStyle => (
<View style={[this.props.style, safeAreaPaddingBottomStyle]}>
<FormSubmit style={StyleSheet.flatten([this.props.style, safeAreaPaddingBottomStyle])} onSubmit={this.submit}>
{this.childrenWrapperWithProps(this.props.children)}
{this.props.isSubmitButtonVisible && (
<FormAlertWithSubmitButton
Expand All @@ -298,9 +304,10 @@ class Form extends React.Component {
containerStyles={[styles.mh0, styles.mt5, styles.flex1]}
enabledWhenOffline={this.props.enabledWhenOffline}
isSubmitActionDangerous={this.props.isSubmitActionDangerous}
disablePressOnEnter
/>
)}
</View>
</FormSubmit>
);

return (
Expand Down
6 changes: 5 additions & 1 deletion src/components/FormAlertWithSubmitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const propTypes = {
/** Should the button be enabled when offline */
enabledWhenOffline: PropTypes.bool,

/** Disable press on enter for submit button */
disablePressOnEnter: PropTypes.bool,

/** Whether the form submit action is dangerous */
isSubmitActionDangerous: PropTypes.bool,
};
Expand All @@ -48,6 +51,7 @@ const defaultProps = {
isLoading: false,
onFixTheErrorsLinkPressed: () => {},
enabledWhenOffline: false,
disablePressOnEnter: false,
isSubmitActionDangerous: false,
};

Expand All @@ -70,7 +74,7 @@ const FormAlertWithSubmitButton = props => (
) : (
<Button
success
pressOnEnter
pressOnEnter={!props.disablePressOnEnter}
text={props.buttonText}
onPress={props.onSubmit}
isDisabled={props.isDisabled}
Expand Down
19 changes: 19 additions & 0 deletions src/components/FormSubmit/formSubmitPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import PropTypes from 'prop-types';
import stylePropTypes from '../../styles/stylePropTypes';

const propTypes = {
/* A function to execute when form is submitted with ENTER */
onSubmit: PropTypes.func.isRequired,

/** Children to wrap with FormSubmit. */
children: PropTypes.node.isRequired,

/** Container styles */
style: stylePropTypes,
};

const defaultProps = {
style: [],
};

export {propTypes, defaultProps};
59 changes: 59 additions & 0 deletions src/components/FormSubmit/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import lodashGet from 'lodash/get';
import {View} from 'react-native';
import * as formSubmitPropTypes from './formSubmitPropTypes';

// This is a wrapper component to handle the ENTER key press, and submit the form.
class FormSubmit extends React.Component {
constructor(props) {
super(props);

this.submitForm = this.submitForm.bind(this);
}

/**
* Calls the submit callback when ENTER is pressed on a form element.
* @param {Object} event
*/

submitForm(event) {
// ENTER is pressed with modifier key, do not submit the form
if (event.shiftKey || event.key !== 'Enter') {
return;
}

const tagName = lodashGet(event, 'target.tagName', '');

// ENTER is pressed on INPUT or SELECT element, call the submit callback.
if (tagName === 'INPUT' || tagName === 'SELECT') {
this.props.onSubmit();
return;
}

// Pressing Enter on TEXTAREA element adds a new line. When `dataset.submitOnEnter` prop is passed, call the submit callback.
if (tagName === 'TEXTAREA' && lodashGet(event, 'target.dataset.submitOnEnter', 'false') === 'true') {
this.props.onSubmit();
return;
}

// ENTER is pressed on checkbox element, call the submit callback.
if (lodashGet(event, 'target.role') === 'checkbox') {
this.props.onSubmit();
}
}

render() {
return (

// React-native-web prevents event bubbling on TextInput for key presses
// https://github.com/necolas/react-native-web/blob/fa47f80d34ee6cde2536b2a2241e326f84b633c4/packages/react-native-web/src/exports/TextInput/index.js#L272
// Thus use capture phase.
<View onKeyDownCapture={this.submitForm} style={this.props.style}>{this.props.children}</View>
);
}
}

FormSubmit.propTypes = formSubmitPropTypes.propTypes;
FormSubmit.defaultProps = formSubmitPropTypes.defaultProps;

export default FormSubmit;
11 changes: 11 additions & 0 deletions src/components/FormSubmit/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import {View} from 'react-native';
import * as formSubmitPropTypes from './formSubmitPropTypes';

const FormSubmit = props => <View style={props.style}>{props.children}</View>;

FormSubmit.propTypes = formSubmitPropTypes.propTypes;
FormSubmit.defaultProps = formSubmitPropTypes.defaultProps;
FormSubmit.displayName = 'FormSubmit';

export default FormSubmit;
2 changes: 2 additions & 0 deletions src/components/LocalePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CONST from '../CONST';
import Permissions from '../libs/Permissions';
import * as Localize from '../libs/Localize';
import Picker from './Picker';
import styles from '../styles/styles';

const propTypes = {
/** Indicates which locale the user currently has selected */
Expand Down Expand Up @@ -59,6 +60,7 @@ const LocalePicker = (props) => {
items={_.values(localesToLanguages)}
size={props.size}
value={props.preferredLocale}
containerStyles={[props.size === 'small' && [styles.pickerContainerSmall]]}
/>
);
};
Expand Down
6 changes: 5 additions & 1 deletion src/components/PDFView/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import _ from 'underscore';
import React, {Component} from 'react';
import {View, Dimensions} from 'react-native';
import {Document, Page} from 'react-pdf/dist/esm/entry.webpack';
import {Document, Page, pdfjs} from 'react-pdf/dist/esm/entry.webpack';
import pdfWorkerSource from 'pdfjs-dist/legacy/build/pdf.worker';
import FullScreenLoadingIndicator from '../FullscreenLoadingIndicator';
import styles from '../../styles/styles';
import variables from '../../styles/variables';
Expand All @@ -27,6 +28,9 @@ class PDFView extends Component {
this.initiatePasswordChallenge = this.initiatePasswordChallenge.bind(this);
this.attemptPDFLoad = this.attemptPDFLoad.bind(this);
this.toggleKeyboardOnSmallScreens = this.toggleKeyboardOnSmallScreens.bind(this);

const workerBlob = new Blob([pdfWorkerSource], {type: 'text/javascript'});
pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(workerBlob);
}

componentDidUpdate(prevProps) {
Expand Down
17 changes: 8 additions & 9 deletions src/components/Picker/index.js → src/components/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import React, {PureComponent} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import RNPickerSelect from 'react-native-picker-select';
import Icon from '../Icon';
import * as Expensicons from '../Icon/Expensicons';
import FormHelpMessage from '../FormHelpMessage';
import Text from '../Text';
import styles from '../../styles/styles';
import themeColors from '../../styles/themes/default';
import pickerStyles from './pickerStyles';
import {ScrollContext} from '../ScrollViewWithContext';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import FormHelpMessage from './FormHelpMessage';
import Text from './Text';
import styles from '../styles/styles';
import themeColors from '../styles/themes/default';
import {ScrollContext} from './ScrollViewWithContext';

const propTypes = {
/** Picker label */
Expand Down Expand Up @@ -170,7 +169,7 @@ class Picker extends PureComponent {

// We add a text color to prevent white text on white background dropdown items on Windows
items={_.map(this.props.items, item => ({...item, color: themeColors.pickerOptionsTextColor}))}
style={this.props.size === 'normal' ? pickerStyles(this.props.isDisabled) : styles.pickerSmall}
style={this.props.size === 'normal' ? styles.picker(this.props.isDisabled) : styles.pickerSmall}
useNativeAndroidPickerStyle={false}
placeholder={this.placeholder}
value={this.props.value}
Expand Down
Loading

0 comments on commit 147d609

Please sign in to comment.