From e8607be23ddc8b94ee70195c8194cec0e9051574 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Sat, 5 Feb 2022 02:47:51 +0530 Subject: [PATCH 01/19] Separate padding from TextInput styles --- src/components/TextInput/index.js | 2 +- src/components/TextInput/index.native.js | 2 +- src/styles/styles.js | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/TextInput/index.js b/src/components/TextInput/index.js index f58681846897..d52211a55e3c 100644 --- a/src/components/TextInput/index.js +++ b/src/components/TextInput/index.js @@ -8,7 +8,7 @@ const TextInput = forwardRef((props, ref) => ( // eslint-disable-next-line react/jsx-props-no-spreading {...props} innerRef={ref} - inputStyle={[styles.baseTextInput, styles.textInputDesktop]} + inputStyle={[styles.baseTextInput, styles.baseTextInputPaddingHorizontal, styles.textInputDesktop]} /> )); diff --git a/src/components/TextInput/index.native.js b/src/components/TextInput/index.native.js index b03865ce4a47..66c9015ca03d 100644 --- a/src/components/TextInput/index.native.js +++ b/src/components/TextInput/index.native.js @@ -12,7 +12,7 @@ const TextInput = forwardRef((props, ref) => ( // eslint-disable-next-line react/jsx-props-no-multi-spaces autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType} innerRef={ref} - inputStyle={[styles.baseTextInput]} + inputStyle={[styles.baseTextInput, styles.baseTextInputPaddingHorizontal]} /> )); diff --git a/src/styles/styles.js b/src/styles/styles.js index 9d3207277e8d..11fc16051b31 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -682,11 +682,14 @@ const styles = { color: themeColors.text, paddingTop: 23, paddingBottom: 8, - paddingHorizontal: 11, borderWidth: 0, borderRadius: variables.componentBorderRadiusNormal, }, + baseTextInputPaddingHorizontal: { + paddingHorizontal: 11, + }, + textInputAndIconContainer: { zIndex: -1, flexDirection: 'row', From d4139158c2776bbbe34dcdc0125e8756fc915c51 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Sat, 5 Feb 2022 02:48:43 +0530 Subject: [PATCH 02/19] Add FormHelp and new props to TextInput --- src/components/FormHelp.js | 34 +++++++++++++++++++ .../TextInput/baseTextInputPropTypes.js | 8 +++++ 2 files changed, 42 insertions(+) create mode 100644 src/components/FormHelp.js diff --git a/src/components/FormHelp.js b/src/components/FormHelp.js new file mode 100644 index 000000000000..f519f10ab135 --- /dev/null +++ b/src/components/FormHelp.js @@ -0,0 +1,34 @@ +import _ from 'underscore'; +import React from 'react'; +import {View} from 'react-native'; +import PropTypes from 'prop-types'; +import styles from '../styles/styles'; + +const propTypes = { + /** Content of FormHelp */ + // eslint-disable-next-line react/forbid-prop-types + children: PropTypes.any.isRequired, +}; + +const FormHelp = (props) => { + if (_.isEmpty(props.children)) { + return null; + } + + return ( + + {props.children} + + ); +}; + +FormHelp.propTypes = propTypes; +FormHelp.displayName = 'FormHelp'; +export default FormHelp; diff --git a/src/components/TextInput/baseTextInputPropTypes.js b/src/components/TextInput/baseTextInputPropTypes.js index cdb3a2cb1056..6791ea9598a8 100644 --- a/src/components/TextInput/baseTextInputPropTypes.js +++ b/src/components/TextInput/baseTextInputPropTypes.js @@ -45,6 +45,12 @@ const propTypes = { /** Saves a draft of the input value when used in a form */ shouldSaveDraft: PropTypes.bool, + + /** Maximum charactor allowed */ + maxLength: PropTypes.number, + + /** Hint text to display below the TextInput */ + hint: PropTypes.string, }; const defaultProps = { @@ -66,6 +72,8 @@ const defaultProps = { defaultValue: undefined, forceActiveLabel: false, shouldSaveDraft: false, + maxLength: null, + hint: '', }; export {propTypes, defaultProps}; From 7889b38f017075d6f440f13f02440da40ecae299 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Sat, 5 Feb 2022 02:50:26 +0530 Subject: [PATCH 03/19] Implement counter and add hint to TextInput --- src/components/TextInput/BaseTextInput.js | 27 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index c4a2693b5d44..f65a5fbca87a 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -10,9 +10,10 @@ import themeColors from '../../styles/themes/default'; import styles from '../../styles/styles'; import Icon from '../Icon'; import * as Expensicons from '../Icon/Expensicons'; -import InlineErrorText from '../InlineErrorText'; +import Text from '../Text'; import * as styleConst from './styleConst'; import TextInputWithName from '../TextInputWithName'; +import FormHelp from '../FormHelp'; class BaseTextInput extends Component { constructor(props) { @@ -146,6 +147,9 @@ class BaseTextInput extends Component { // eslint-disable-next-line react/forbid-foreign-prop-types const inputProps = _.omit(this.props, _.keys(baseTextInputPropTypes.propTypes)); const hasLabel = Boolean(this.props.label.length); + const inputHelpText = this.props.errorText || this.props.hint; + const formHelpStyles = this.props.errorText ? styles.formError : styles.formHelp; + return ( - {!_.isEmpty(this.props.errorText) && ( - - {this.props.errorText} - - )} + + {!_.isEmpty(inputHelpText) && ( + {inputHelpText} + )} + {!_.isNull(this.props.maxLength) && ( + <> + + + {this.value.length} + / + {this.props.maxLength} + + + )} + ); } From 4c2c727360247bb59153f92513d0ec72f5d744ba Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 8 Feb 2022 10:37:21 -0700 Subject: [PATCH 04/19] Run tests and lint on merge into main --- .github/workflows/lint.yml | 2 ++ .github/workflows/preDeploy.yml | 41 +++++++++++++++++++++++++++++++-- .github/workflows/test.yml | 2 ++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aeecd6682dcd..20a1601e9870 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,8 @@ name: Lint JavaScript on: + workflow_dispatch: + branches-ignore: [staging, production] pull_request: types: [opened, synchronize] branches-ignore: [staging, production] diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index 776b14e78863..d753af3c5c76 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -5,6 +5,43 @@ on: branches: [main] jobs: + confirmPassingBuild: + runs-on: ubuntu-latest + + steps: + - name: Run lint + id: lint + uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main + with: + WORKFLOW: lint.yml + + - name: Run tests + id: tests + uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main + with: + WORKFLOW: test.yml + + # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all + # the other workflows with the same change + - uses: 8398a7/action-slack@v3 + name: Job failed Slack notification + if: ${{ failure() }} + with: + status: custom + fields: workflow, repo + custom_payload: | + { + channel: '#announce', + attachments: [{ + color: "#DB4545", + pretext: ``, + text: `💥 ${process.env.AS_REPO} failed on ${process.env.AS_WORKFLOW} workflow 💥`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + chooseDeployActions: runs-on: ubuntu-latest outputs: @@ -167,10 +204,10 @@ jobs: number: ${{ steps.getMergedPullRequest.outputs.number }} body: | @${{ steps.getMergedPullRequest.outputs.author }}, Great job getting your first Expensify/App pull request over the finish line! :tada: - + I know there's a lot of information in our [contributing guidelines](https://github.com/Expensify/App/blob/main/CONTRIBUTING.md), so here are some points to take note of :memo:: - 1. Now that your first PR has been merged, you can be hired for another issue. Once you've completed a few issues, you may be eligible to work on more than one job at a time. + 1. Now that your first PR has been merged, you can be hired for another issue. Once you've completed a few issues, you may be eligible to work on more than one job at a time. 2. Once your PR is deployed to our staging servers, it will undergo quality assurance (QA) testing. If we find that it doesn't work as expected or causes a regression, you'll be responsible for fixing it. Typically, we would revert this PR and give you another chance to create a similar PR without causing a regression. 3. Once your PR is deployed to _production_, we start a 7-day timer :alarm_clock:. After it has been on production for 7 days without causing any regressions, then we pay out the Upwork job. :moneybag: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5aa6504102ef..db9562ac6a92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ name: Jest Unit Tests on: + workflow_dispatch: + branches-ignore: [staging, production] pull_request: types: [opened, synchronize] branches-ignore: [staging, production] From 7d1a87d0ca44df65ef873caca33db17eb98f9f5a Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Wed, 9 Feb 2022 20:09:45 +0530 Subject: [PATCH 05/19] Revert "Separate padding from TextInput styles" This reverts commit e8607be23ddc8b94ee70195c8194cec0e9051574. --- src/components/TextInput/index.js | 2 +- src/components/TextInput/index.native.js | 2 +- src/styles/styles.js | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/TextInput/index.js b/src/components/TextInput/index.js index d52211a55e3c..f58681846897 100644 --- a/src/components/TextInput/index.js +++ b/src/components/TextInput/index.js @@ -8,7 +8,7 @@ const TextInput = forwardRef((props, ref) => ( // eslint-disable-next-line react/jsx-props-no-spreading {...props} innerRef={ref} - inputStyle={[styles.baseTextInput, styles.baseTextInputPaddingHorizontal, styles.textInputDesktop]} + inputStyle={[styles.baseTextInput, styles.textInputDesktop]} /> )); diff --git a/src/components/TextInput/index.native.js b/src/components/TextInput/index.native.js index 66c9015ca03d..b03865ce4a47 100644 --- a/src/components/TextInput/index.native.js +++ b/src/components/TextInput/index.native.js @@ -12,7 +12,7 @@ const TextInput = forwardRef((props, ref) => ( // eslint-disable-next-line react/jsx-props-no-multi-spaces autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType} innerRef={ref} - inputStyle={[styles.baseTextInput, styles.baseTextInputPaddingHorizontal]} + inputStyle={[styles.baseTextInput]} /> )); diff --git a/src/styles/styles.js b/src/styles/styles.js index 11fc16051b31..9d3207277e8d 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -682,14 +682,11 @@ const styles = { color: themeColors.text, paddingTop: 23, paddingBottom: 8, + paddingHorizontal: 11, borderWidth: 0, borderRadius: variables.componentBorderRadiusNormal, }, - baseTextInputPaddingHorizontal: { - paddingHorizontal: 11, - }, - textInputAndIconContainer: { zIndex: -1, flexDirection: 'row', From 3cb8964b6d88455d40e705ab9d64cb702a50e33c Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Wed, 9 Feb 2022 20:11:16 +0530 Subject: [PATCH 06/19] Fix: padding for the formhelp text --- src/components/FormHelp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FormHelp.js b/src/components/FormHelp.js index f519f10ab135..9a674176d816 100644 --- a/src/components/FormHelp.js +++ b/src/components/FormHelp.js @@ -21,7 +21,7 @@ const FormHelp = (props) => { styles.mt1, styles.flexRow, styles.justifyContentBetween, - styles.baseTextInputPaddingHorizontal, + styles.ph3, ]} > {props.children} From 00930f3e36b80f93ab87f2494bc75bf0be07f85b Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 9 Feb 2022 09:15:17 -0700 Subject: [PATCH 07/19] Make chooseDeployActions depend on confirmPassingBuild --- .github/workflows/preDeploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index d753af3c5c76..36290206cbb1 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -44,6 +44,7 @@ jobs: chooseDeployActions: runs-on: ubuntu-latest + needs: confirmPassingBuild outputs: mergedPullRequest: ${{ steps.getMergedPullRequest.outputs.number }} isStagingDeployLocked: ${{ steps.isStagingDeployLocked.outputs.IS_LOCKED }} From 1154088ce41486589c15b5dd2c2aa20f3f65de9c Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Thu, 10 Feb 2022 00:11:23 +0530 Subject: [PATCH 08/19] refactor and remove extra component --- src/components/FormHelp.js | 34 ------------------- src/components/TextInput/BaseTextInput.js | 40 ++++++++++++++--------- 2 files changed, 24 insertions(+), 50 deletions(-) delete mode 100644 src/components/FormHelp.js diff --git a/src/components/FormHelp.js b/src/components/FormHelp.js deleted file mode 100644 index 9a674176d816..000000000000 --- a/src/components/FormHelp.js +++ /dev/null @@ -1,34 +0,0 @@ -import _ from 'underscore'; -import React from 'react'; -import {View} from 'react-native'; -import PropTypes from 'prop-types'; -import styles from '../styles/styles'; - -const propTypes = { - /** Content of FormHelp */ - // eslint-disable-next-line react/forbid-prop-types - children: PropTypes.any.isRequired, -}; - -const FormHelp = (props) => { - if (_.isEmpty(props.children)) { - return null; - } - - return ( - - {props.children} - - ); -}; - -FormHelp.propTypes = propTypes; -FormHelp.displayName = 'FormHelp'; -export default FormHelp; diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index f65a5fbca87a..df7a717cc7fc 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -13,7 +13,6 @@ import * as Expensicons from '../Icon/Expensicons'; import Text from '../Text'; import * as styleConst from './styleConst'; import TextInputWithName from '../TextInputWithName'; -import FormHelp from '../FormHelp'; class BaseTextInput extends Component { constructor(props) { @@ -224,21 +223,30 @@ class BaseTextInput extends Component { - - {!_.isEmpty(inputHelpText) && ( - {inputHelpText} - )} - {!_.isNull(this.props.maxLength) && ( - <> - - - {this.value.length} - / - {this.props.maxLength} - - - )} - + {(!_.isEmpty(inputHelpText) || !_.isNull(this.props.maxLength)) && ( + + {!_.isEmpty(inputHelpText) && ( + {inputHelpText} + )} + {!_.isNull(this.props.maxLength) && ( + <> + + + {this.value.length} + / + {this.props.maxLength} + + + )} + + )} ); } From d648f6b09ae8515b2934830c5ad285b77b22872b Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Thu, 10 Feb 2022 00:12:31 +0530 Subject: [PATCH 09/19] typo fixed --- src/components/TextInput/baseTextInputPropTypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/baseTextInputPropTypes.js b/src/components/TextInput/baseTextInputPropTypes.js index 6791ea9598a8..c96ccb9fd2db 100644 --- a/src/components/TextInput/baseTextInputPropTypes.js +++ b/src/components/TextInput/baseTextInputPropTypes.js @@ -46,7 +46,7 @@ const propTypes = { /** Saves a draft of the input value when used in a form */ shouldSaveDraft: PropTypes.bool, - /** Maximum charactor allowed */ + /** Maximum characters allowed */ maxLength: PropTypes.number, /** Hint text to display below the TextInput */ From 1228648c98ed96ad9fc47b0ea87915ded09b6d1d Mon Sep 17 00:00:00 2001 From: Nathalie Kuoch Date: Thu, 10 Feb 2022 16:45:45 +0100 Subject: [PATCH 10/19] Make sure we round properly wallet transfer fee and balance for display --- src/libs/PaymentUtils.js | 6 +++--- tests/unit/PaymentUtilsTest.js | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 tests/unit/PaymentUtilsTest.js diff --git a/src/libs/PaymentUtils.js b/src/libs/PaymentUtils.js index 674bffc9b8c5..3e48fd1bce67 100644 --- a/src/libs/PaymentUtils.js +++ b/src/libs/PaymentUtils.js @@ -94,15 +94,15 @@ function formatPaymentMethods(bankAccountList, cardList, payPalMeUsername = '', } /** - * @param {Number} currentBalance + * @param {Number} currentBalance, in cents * @param {String} methodType - * @returns {Number} + * @returns {Number} the fee, in cents */ function calculateWalletTransferBalanceFee(currentBalance, methodType) { const transferMethodTypeFeeStructure = methodType === CONST.WALLET.TRANSFER_METHOD_TYPE.INSTANT ? CONST.WALLET.TRANSFER_METHOD_TYPE_FEE.INSTANT : CONST.WALLET.TRANSFER_METHOD_TYPE_FEE.ACH; - const calculateFee = (currentBalance * transferMethodTypeFeeStructure.RATE) / 100; + const calculateFee = Math.ceil(currentBalance * (transferMethodTypeFeeStructure.RATE / 100)); return Math.max(calculateFee, transferMethodTypeFeeStructure.MINIMUM_FEE); } diff --git a/tests/unit/PaymentUtilsTest.js b/tests/unit/PaymentUtilsTest.js new file mode 100644 index 000000000000..d4524027353a --- /dev/null +++ b/tests/unit/PaymentUtilsTest.js @@ -0,0 +1,9 @@ +import CONST from '../../src/CONST'; + +const paymentUtils = require('../../src/libs/PaymentUtils'); + +describe('PaymentUtils', () => { + it('Test rounding wallet transfer instant fee', () => { + expect(paymentUtils.calculateWalletTransferBalanceFee(2100, CONST.WALLET.TRANSFER_METHOD_TYPE.INSTANT)).toBe(32); + }); +}); From 921dd2266fa7f3bd19d7610712092b08794a341d Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Thu, 10 Feb 2022 21:59:30 +0530 Subject: [PATCH 11/19] Fix: styling --- src/components/TextInput/BaseTextInput.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index df7a717cc7fc..c574365dd4ff 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -76,13 +76,13 @@ class BaseTextInput extends Component { } onFocus(event) { - if (this.props.onFocus) { this.props.onFocus(event); } + if (this.props.onFocus) {this.props.onFocus(event);} this.setState({isFocused: true}); this.activateLabel(); } onBlur(event) { - if (this.props.onBlur) { this.props.onBlur(event); } + if (this.props.onBlur) {this.props.onBlur(event);} this.setState({isFocused: false}); this.deactivateLabel(); } @@ -181,7 +181,7 @@ class BaseTextInput extends Component { { - if (typeof this.props.innerRef === 'function') { this.props.innerRef(ref); } + if (typeof this.props.innerRef === 'function') {this.props.innerRef(ref);} this.input = ref; }} // eslint-disable-next-line @@ -236,14 +236,11 @@ class BaseTextInput extends Component { {inputHelpText} )} {!_.isNull(this.props.maxLength) && ( - <> - - - {this.value.length} - / - {this.props.maxLength} - - + + {this.value.length} + / + {this.props.maxLength} + )} )} From f08bdc56cf9572c027bbed7352303790938d242e Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Thu, 10 Feb 2022 22:28:40 +0530 Subject: [PATCH 12/19] Fix: Linting issues --- src/components/TextInput/BaseTextInput.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index c574365dd4ff..a2b96380f1a6 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -76,13 +76,13 @@ class BaseTextInput extends Component { } onFocus(event) { - if (this.props.onFocus) {this.props.onFocus(event);} + if (this.props.onFocus) { this.props.onFocus(event); } this.setState({isFocused: true}); this.activateLabel(); } onBlur(event) { - if (this.props.onBlur) {this.props.onBlur(event);} + if (this.props.onBlur) { this.props.onBlur(event); } this.setState({isFocused: false}); this.deactivateLabel(); } @@ -181,7 +181,7 @@ class BaseTextInput extends Component { { - if (typeof this.props.innerRef === 'function') {this.props.innerRef(ref);} + if (typeof this.props.innerRef === 'function') { this.props.innerRef(ref); } this.input = ref; }} // eslint-disable-next-line From 8533a172b90730a26131081297079c9058537862 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Thu, 10 Feb 2022 13:16:46 -0800 Subject: [PATCH 13/19] Fix electron build --- config/electron.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config/electron.config.js b/config/electron.config.js index fa127435d093..14079e6e9a36 100644 --- a/config/electron.config.js +++ b/config/electron.config.js @@ -29,5 +29,6 @@ module.exports = { './dist/**/*', './desktop/*.js', './src/libs/checkForUpdates.js', + './src/CONST/ENVIRONMENT.js', ], }; From e1c55ddf9e65caf8925e10666a024a6c692dc37f Mon Sep 17 00:00:00 2001 From: OSBotify Date: Thu, 10 Feb 2022 22:22:18 +0000 Subject: [PATCH 14/19] Update version to 1.1.38-3 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e92dbfb43ed4..7a4f3101c0b2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -152,8 +152,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001013802 - versionName "1.1.38-2" + versionCode 1001013803 + versionName "1.1.38-3" } splits { abi { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 670e2460056a..8912f6cecde7 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -31,7 +31,7 @@ CFBundleVersion - 1.1.38.2 + 1.1.38.3 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 5d41a3ba8c71..d4d030ed5edf 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.1.38.2 + 1.1.38.3 diff --git a/package-lock.json b/package-lock.json index c97c6cf25f73..713cd80a22e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.38-2", + "version": "1.1.38-3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2d7cb535562f..af2ff72d806d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.38-2", + "version": "1.1.38-3", "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.", From 5ccbe699160f7592f0d187147bbf5718e17b5763 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Thu, 10 Feb 2022 15:25:10 -0800 Subject: [PATCH 15/19] Fix desktop CORS issue when using web proxy --- desktop/main.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 1ba82346db5c..43962026e227 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -150,17 +150,18 @@ const mainWindow = (() => { /* * The default origin of our Electron app is app://- instead of https://new.expensify.com or https://staging.new.expensify.com * This causes CORS errors because the referer and origin headers are wrong and the API responds with an Access-Control-Allow-Origin that doesn't match app://- + * The same issue happens when using the web proxy to communicate with the staging or production API on dev. * * To fix this, we'll: * - * 1. Modify headers on any outgoing requests to match the origin of our corresponding web environment. + * 1. Modify headers on any outgoing requests to match the origin of our corresponding web environment (not necessary in case of web proxy, because it already does that) * 2. Modify the Access-Control-Allow-Origin header of the response to match the "real" origin of our Electron app. */ + const validDestinationFilters = {urls: ['https://*.expensify.com/*']}; if (!ELECTRON_ENVIRONMENT.isDev()) { const newDotURL = ELECTRON_ENVIRONMENT.isProd() ? 'https://new.expensify.com' : 'https://staging.new.expensify.com'; // Modify the origin and referer for requests sent to our API - const validDestinationFilters = {urls: ['https://*.expensify.com/*']}; browserWindow.webContents.session.webRequest.onBeforeSendHeaders(validDestinationFilters, (details, callback) => { // eslint-disable-next-line no-param-reassign details.requestHeaders.origin = newDotURL; @@ -177,6 +178,20 @@ const mainWindow = (() => { }); } + if (ELECTRON_ENVIRONMENT.isDev()) { + const dotenv = require('dotenv'); + const path = require('path'); + const devEnvConfig = dotenv.config({path: path.resolve(__dirname, '../.env')}).parsed; + + if (devEnvConfig.USE_WEB_PROXY === 'true') { + browserWindow.webContents.session.webRequest.onHeadersReceived(validDestinationFilters, (details, callback) => { + // eslint-disable-next-line no-param-reassign + details.responseHeaders['access-control-allow-origin'] = ['http://localhost:8080']; + callback({responseHeaders: details.responseHeaders}); + }); + } + } + // Prod and staging overwrite the app name in the electron-builder config, so only update it here for dev if (ELECTRON_ENVIRONMENT.isDev()) { browserWindow.setTitle('New Expensify'); From 5b61dabff6768de2466ebe9cf0760685f5a78078 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 10 Feb 2022 17:05:20 -0700 Subject: [PATCH 16/19] Include GITHUB_TOKEN --- .github/workflows/preDeploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index 36290206cbb1..a7b2ff700709 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -14,12 +14,14 @@ jobs: uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main with: WORKFLOW: lint.yml + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run tests id: tests uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main with: WORKFLOW: test.yml + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all # the other workflows with the same change From a8d5ae7ace01ecccb780391e4f3466d3af915acf Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 10 Feb 2022 17:19:54 -0700 Subject: [PATCH 17/19] Use `OS_BOTIFY_TOKEN` instead of `GITHUB_TOKEN` --- .github/workflows/preDeploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index a7b2ff700709..12e1402b7e4d 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -14,14 +14,14 @@ jobs: uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main with: WORKFLOW: lint.yml - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - name: Run tests id: tests uses: Expensify/App/.github/actions/triggerWorkflowAndWait@main with: WORKFLOW: test.yml - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} # This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all # the other workflows with the same change From b9b8e7c379960a7687faaffec4289d133f191499 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 10 Feb 2022 17:34:19 -0700 Subject: [PATCH 18/19] Remove uneeded branches-ignore --- .github/workflows/lint.yml | 1 - .github/workflows/test.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 20a1601e9870..55291ac96980 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,6 @@ name: Lint JavaScript on: workflow_dispatch: - branches-ignore: [staging, production] pull_request: types: [opened, synchronize] branches-ignore: [staging, production] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db9562ac6a92..c0d466fb3767 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,6 @@ name: Jest Unit Tests on: workflow_dispatch: - branches-ignore: [staging, production] pull_request: types: [opened, synchronize] branches-ignore: [staging, production] From f9577a90f0652d2a154d6a9b688a9ae02e0f5dca Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Thu, 10 Feb 2022 16:47:18 -0800 Subject: [PATCH 19/19] Do not skip test and lint for workflow_dispatch --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 20a1601e9870..12a6448268d8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ on: jobs: lint: - if: github.actor != 'OSBotify' + if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db9562ac6a92..0424f33fe56c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ on: jobs: test: - if: github.actor != 'OSBotify' + if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2