Skip to content

Commit

Permalink
Merge branch 'Expensify:main' into arrow-feature-signed
Browse files Browse the repository at this point in the history
  • Loading branch information
JediWattson authored Dec 14, 2022
2 parents 704753a + 11cf564 commit 428aaab
Show file tree
Hide file tree
Showing 28 changed files with 128 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
const json = `[${sanitizedOutput}]`.replace('},]', '}]')

// Escape backslashes in commit messages that end with a backslash
.replace('\\"}', '\\\\"}');

return JSON.parse(json);
});
}
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
const json = `[${sanitizedOutput}]`.replace('},]', '}]')

// Escape backslashes in commit messages that end with a backslash
.replace('\\"}', '\\\\"}');

return JSON.parse(json);
});
}
Expand Down
6 changes: 5 additions & 1 deletion .github/libs/GitUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
const json = `[${sanitizedOutput}]`.replace('},]', '}]')

// Escape backslashes in commit messages that end with a backslash
.replace('\\"}', '\\\\"}');

return JSON.parse(json);
});
}
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/buildActions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ for ((i=0; i < ${#GITHUB_ACTIONS[@]}; i++)); do

# Build the action in the background
ncc build "$ACTION" -o "$ACTION_DIR" &
ASYNC_BUILDS[$i]=$!
ASYNC_BUILDS[i]=$!
done

for ((i=0; i < ${#GITHUB_ACTIONS[@]}; i++)); do
ACTION=${GITHUB_ACTIONS[$i]}
ACTION_DIR=$(dirname "$ACTION")

# Wait for the background build to finish
wait ${ASYNC_BUILDS[$i]}
wait "${ASYNC_BUILDS[$i]}"

# Prepend the warning note to the top of the compiled file
OUTPUT_FILE="$ACTION_DIR/index.js"
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/validateActionsAndWorkflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ info 'Validating actions and workflows against their JSON schemas...'
for ((i=0; i < ${#ACTIONS[@]}; i++)); do
ACTION=${ACTIONS[$i]}
ajv -s ./tempSchemas/github-action.json -d "$ACTION" --strict=false &
ASYNC_PROCESSES[$i]=$!
ASYNC_PROCESSES[i]=$!
done

for ((i=0; i < ${#WORKFLOWS[@]}; i++)); do
Expand All @@ -48,12 +48,12 @@ for ((i=0; i < ${#WORKFLOWS[@]}; i++)); do
fi

ajv -s ./tempSchemas/github-workflow.json -d "$WORKFLOW" --strict=false &
ASYNC_PROCESSES[${#ACTIONS[@]} + $i]=$!
ASYNC_PROCESSES[${#ACTIONS[@]} + i]=$!
done

# Wait for the background builds to finish
for PID in "${ASYNC_PROCESSES[@]}"; do
wait $PID
wait "$PID"
RESULT=$?
if [[ $RESULT != 0 ]]; then
EXIT_CODE=$RESULT
Expand Down
63 changes: 51 additions & 12 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Build and deploy apps for testing

on:
workflow_dispatch:
inputs:
PULL_REQUEST_NUMBER:
description: Pull Request number for correct placement of apps
required: true
pull_request_target:
types: [opened, synchronize]
branches: ['*ci-test/**']
Expand All @@ -22,16 +26,38 @@ jobs:
username: ${{ github.actor }}
team: mobile-deployers

getBranchRef:
runs-on: ubuntu-latest
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
outputs:
REF: ${{steps.getHeadRef.outputs.REF}}
steps:
- name: Checkout
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Check if pull request number is correct
if: ${{ github.event_name == 'workflow_dispatch' }}
id: getHeadRef
run: |
set -e
gh pr checkout ${{ github.event.inputs.PULL_REQUEST_NUMBER }}
echo "REF=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

android:
name: Build and deploy Android for testing
needs: validateActor
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
runs-on: ubuntu-latest
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
steps:
# This action checks-out the repository, so the workflow can access it.
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.head_ref || needs.getBranchRef.outputs.REF }}

- uses: Expensify/App/.github/actions/composite/setupNode@main

Expand Down Expand Up @@ -64,7 +90,6 @@ jobs:
S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ad-hoc-expensify-cash
S3_REGION: us-east-1
PULL_REQUEST_NUMBER: ${{ github.event.number }}

- uses: actions/upload-artifact@v3
with:
Expand All @@ -73,14 +98,16 @@ jobs:

iOS:
name: Build and deploy iOS for testing
needs: validateActor
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-12
steps:
# This action checks-out the repository, so the workflow can access it.
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.head_ref || needs.getBranchRef.outputs.REF }}

- uses: Expensify/App/.github/actions/composite/setupNode@main

Expand Down Expand Up @@ -119,7 +146,6 @@ jobs:
S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ad-hoc-expensify-cash
S3_REGION: us-east-1
PULL_REQUEST_NUMBER: ${{ github.event.number }}

- uses: actions/upload-artifact@v3
with:
Expand All @@ -128,13 +154,16 @@ jobs:

desktop:
name: Build and deploy Desktop for testing
needs: validateActor
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-12
steps:
# This action checks-out the repository, so the workflow can access it.
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
ref: ${{ github.head_ref || needs.getBranchRef.outputs.REF }}
fetch-depth: 0

- uses: Expensify/App/.github/actions/composite/setupNode@main
Expand All @@ -159,17 +188,18 @@ jobs:
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}

postGithubComment:
runs-on: ubuntu-latest
name: Post a GitHub comment with app download links for testing
needs: [android, ios, desktop]
needs: [getBranchRef, android, ios, desktop]
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
ref: ${{ github.event.pull_request.head.ref }}
ref: ${{ github.head_ref || needs.getBranchRef.outputs.REF }}

- uses: actions/download-artifact@v3

Expand All @@ -186,14 +216,23 @@ jobs:
content_ios="${content_ios//$'\n'/'%0A'}"
content_ios="${content_ios//$'\r'/'%0D'}"
echo "ios_paths=$content_ios" >> "$GITHUB_OUTPUT"
# This step removes previous comments with links connected to the PR
- name: maintain-comment
uses: actions-cool/maintain-one-comment@de04bd2a3750d86b324829a3ff34d47e48e16f4b
with:
token: ${{ secrets.OS_BOTIFY_TOKEN }}
body-include: 'Use the links below to test this build in android and iOS. Happy testing!'
number: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
delete: true

- name: Publish links to apps for download
run: |
gh pr comment --body \
":test_tube::test_tube: Use the links below to test this build in android and iOS. Happy testing! :test_tube::test_tube:
| android :robot: | iOS :apple: | desktop :computer: |
| ------------- | ------------- | ------------- |
| ${{fromJson(steps.set_var.outputs.android_paths).html_path}} | ${{fromJson(steps.set_var.outputs.ios_paths).html_path}} | https://ad-hoc-expensify-cash.us-east-1.amazonaws.com/desktop/${{github.event.number}}/NewExpensify.dmg |
| ![Android](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${{fromJson(steps.set_var.outputs.android_paths).html_path}}) | ![iOS](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${{fromJson(steps.set_var.outputs.ios_paths).html_path}}) | ![desktop](https://ad-hoc-expensify-cash.us-east-1.amazonaws.com/desktop/${{github.event.number}}/NewExpensify.dmg) |"
| ${{fromJson(steps.set_var.outputs.android_paths).html_path}} | ${{fromJson(steps.set_var.outputs.ios_paths).html_path}} | https://ad-hoc-expensify-cash.us-east-1.amazonaws.com/desktop/$PULL_REQUEST_NUMBER/NewExpensify.dmg |
| ![Android](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${{fromJson(steps.set_var.outputs.android_paths).html_path}}) | ![iOS](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${{fromJson(steps.set_var.outputs.ios_paths).html_path}}) | ![desktop](https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://ad-hoc-expensify-cash.us-east-1.amazonaws.com/desktop/$PULL_REQUEST_NUMBER/NewExpensify.dmg) |"
env:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
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 1001023800
versionName "1.2.38-0"
versionCode 1001023900
versionName "1.2.39-0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion contributingGuides/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ This is the most common scenario for contributors. The Expensify team posts new
#### Proposing a job that Expensify hasn't posted
It’s possible that you found a new bug or new feature that we haven’t posted as a job to the [GitHub repository](https://github.com/Expensify/App/issues?q=is%3Aissue). This is an opportunity to propose a job, and (optionally) a solution for that job. If it's a valid job proposal that we choose to implement by deploying it to production — either internally or via an external contributor — then we will compensate you $250 for identifying and proposing the bug or feature. If the bug or feature is fixed by a PR that is not associated with your proposal, then you will not be eligible for the corresponding compensation unless you can find the PR that fixed it and prove your proposal came first.
- Note: If you get assigned the job you proposed **and** you complete the job, this $250 for identifying the improvement is *in addition to* the reward you will be paid for completing the job.
- Note about proposed bugs or features: Expensify has the right not to pay the $250 reward if the suggested bug or feature is already planned. Currently, Expensify plans to implement all features of the old Expensify app in New Expensify.
- Note about proposed bugs or features: Expensify has the right not to pay the $250 reward if the suggested bug has already been reported or the feature request is already planned. Following, if more than one contributor proposes the same bug, the contributor who posted it first is the one who is eligible for the bonus.
- Note: whilst you may optionally propose a solution for that job on Slack, solutions are ultimately reviewed in GitHub. The onus is on you to propose the solution on GitHub, and/or ensure the issue creator will include a link to your proposal.

Please follow these steps to propose a job:
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ platform :ios do
region: ENV['S3_REGION'],

ipa: lane_context[SharedValues::IPA_OUTPUT_PATH],
app_directory: "android/#{ENV['PULL_REQUEST_NUMBER']}",
app_directory: "ios/#{ENV['PULL_REQUEST_NUMBER']}",
)

sh("echo '{\"ipa_path\": \"#{lane_context[SharedValues::S3_IPA_OUTPUT_PATH]}\",\"html_path\": \"#{lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}\"}' > ../ios_paths.json")
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.38</string>
<string>1.2.39</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.38.0</string>
<string>1.2.39.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.38</string>
<string>1.2.39</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.38.0</string>
<string>1.2.39.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions 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": "new.expensify",
"version": "1.2.38-0",
"version": "1.2.39-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
35 changes: 7 additions & 28 deletions src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class Form extends React.Component {

this.inputRefs = {};
this.touchedInputs = {};
this.childPosition = {};

this.setTouchedInput = this.setTouchedInput.bind(this);
this.validate = this.validate.bind(this);
Expand Down Expand Up @@ -109,21 +108,6 @@ class Form extends React.Component {
return _.first(_.keys(hasStateErrors ? this.state.erorrs : this.props.formState.errorFields));
}

setPosition(element, position) {
// Some elements might not have props defined, e.g. Text
if (!element.props) {
return;
}

if (!element.props.inputID && element.props.children) {
_.forEach(element.props.children, (child) => {
this.setPosition(child, position);
});
} else {
this.childPosition[element.props.inputID] = position;
}
}

submit() {
// Return early if the form is already submitting to avoid duplicate submission
if (this.props.formState.isLoading) {
Expand Down Expand Up @@ -268,16 +252,7 @@ class Form extends React.Component {
ref={el => this.form = el}
>
<View style={[this.props.style]}>
{_.map(this.childrenWrapperWithProps(this.props.children), child => (
<View
key={child.key}
onLayout={(event) => {
this.setPosition(child, event.nativeEvent.layout.y);
}}
>
{child}
</View>
))}
{this.childrenWrapperWithProps(this.props.children)}
{this.props.isSubmitButtonVisible && (
<FormAlertWithSubmitButton
buttonText={this.props.submitButtonText}
Expand All @@ -289,12 +264,16 @@ class Form extends React.Component {
const errors = !_.isEmpty(this.state.errors) ? this.state.errors : this.props.formState.errorFields;
const focusKey = _.find(_.keys(this.inputRefs), key => _.keys(errors).includes(key));
const focusInput = this.inputRefs[focusKey];
this.form.scrollTo({y: this.childPosition[focusKey], animated: false});
if (focusInput.focus && typeof focusInput.focus === 'function') {
focusInput.focus();
}

// We substract 10 to scroll slightly above the input
if (focusInput.measureLayout && typeof focusInput.measureLayout === 'function') {
focusInput.measureLayout(this.form, (x, y) => this.form.scrollTo({y: y - 10, animated: false}));
}
}}
containerStyles={[styles.mh0, styles.mt5]}
containerStyles={[styles.mh0, styles.mt5, styles.flex1]}
enabledWhenOffline={this.props.enabledWhenOffline}
isDangerousAction={this.props.isDangerousAction}
/>
Expand Down
Loading

0 comments on commit 428aaab

Please sign in to comment.