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 30, 2022
2 parents 3738f1f + 0bde3f8 commit 2180ca4
Show file tree
Hide file tree
Showing 40 changed files with 535 additions and 116 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: Pull Request number for correct placement of apps
required: true
pull_request_target:
types: [opened, synchronize]
types: [opened, synchronize, labeled]
branches: ['*ci-test/**']

env:
Expand All @@ -17,19 +17,32 @@ jobs:
validateActor:
runs-on: ubuntu-latest
outputs:
IS_TEAM_MEMBER: ${{ fromJSON(steps.isUserDeployer.outputs.isTeamMember) }}
READY_TO_BUILD: ${{steps.readyToBuild.outputs.READY_TO_BUILD}}
steps:
- id: isUserDeployer
- id: isUserTeamMember
uses: tspascoal/get-user-teams-membership@baf2e6adf4c3b897bd65a7e3184305c165aec872
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
username: ${{ github.actor }}
team: mobile-deployers
team: expensify-expensify
- name: Remove label if it was added by an unauthorized user
if: ${{ !fromJSON(steps.isUserTeamMember.outputs.isTeamMember) && github.event.label.name == 'Ready To Build' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: 'Ready To Build'
- name: Throw exception if label was added by an unauthorized user
if: ${{ !fromJSON(steps.isUserTeamMember.outputs.isTeamMember) && github.event.label.name == 'Ready To Build' }}
run: |
echo "The 'Ready To Build' label was added by an unauthorized user"
exit 1
- id: readyToBuild
name: Set READY_TO_BUILD flag
run: echo "READY_TO_BUILD=${{ fromJSON(steps.isUserTeamMember.outputs.isTeamMember) || contains(github.event.pull_request.labels.*.name, 'Ready To Build') }}" >> "$GITHUB_OUTPUT"

getBranchRef:
runs-on: ubuntu-latest
needs: validateActor
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
outputs:
REF: ${{steps.getHeadRef.outputs.REF}}
steps:
Expand All @@ -49,7 +62,7 @@ jobs:
android:
name: Build and deploy Android for testing
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
runs-on: ubuntu-latest
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
Expand Down Expand Up @@ -99,7 +112,7 @@ jobs:
iOS:
name: Build and deploy iOS for testing
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-12
Expand Down Expand Up @@ -155,7 +168,7 @@ jobs:
desktop:
name: Build and deploy Desktop for testing
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-12
Expand Down Expand Up @@ -192,7 +205,7 @@ jobs:
web:
name: Build and deploy Web
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }}
if: ${{ needs.validateActor.outputs.READY_TO_BUILD == 'true' }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ storybook-static
.jest-cache

# E2E test reports
tests/e2e/.results/
tests/e2e/results/
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 1001024301
versionName "1.2.43-1"
versionCode 1001024600
versionName "1.2.46-0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ private void createAndRegisterNotificationChannel(@NonNull Context context) {
* @param bitmap The bitmap image to modify.
*/
public Bitmap getCroppedBitmap(Bitmap bitmap) {
// Convert hardware bitmap to software bitmap so it can be drawn on the canvas
bitmap = bitmap.copy(Config.ARGB_8888, true);

Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
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.43</string>
<string>1.2.46</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.43.1</string>
<string>1.2.46.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.43</string>
<string>1.2.46</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.43.1</string>
<string>1.2.46.0</string>
</dict>
</plist>
16 changes: 8 additions & 8 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.2.43-1",
"version": "1.2.46-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 @@ -38,7 +38,7 @@
"analyze-packages": "ANALYZE_BUNDLE=true webpack --config config/webpack/webpack.common.js --env envFile=.env.production",
"symbolicate:android": "npx metro-symbolicate android/app/build/generated/sourcemaps/react/release/index.android.bundle.map",
"symbolicate:ios": "npx metro-symbolicate main.jsbundle.map",
"test:e2e": "node tests/e2e/testRunner.js"
"test:e2e": "node tests/e2e/testRunner.js --development"
},
"dependencies": {
"@expensify/react-native-web": "0.18.9",
Expand Down Expand Up @@ -104,7 +104,7 @@
"react-native-pdf": "^6.6.2",
"react-native-performance": "^2.0.0",
"react-native-permissions": "^3.0.1",
"react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#7f09b2c15ffae320d769788f75bdf8948714bb10",
"react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#77cc9d42c474a693755941b10ee4c2d6f50e5346",
"react-native-plaid-link-sdk": "^7.2.0",
"react-native-reanimated": "3.0.0-rc.6",
"react-native-render-html": "6.3.1",
Expand Down
105 changes: 105 additions & 0 deletions scripts/android-repackage-app-bundle-and-sign.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/bash

###
# Takes an android app that has been built with the debug keystore,
# and re-packages it with an alternative JS bundle to run.
# It then signs the APK again, so you can simply install the app on a device.
# This is useful if you quickly want to test changes to the JS code with a
# release app, without having to rebuild the whole app.
#
# There are many outdated resources on how to re-sign an app. The main
# flow and commands have been taken from:
# - https://gist.github.com/floyd-fuh/7f7408b560672ece3ea78348559d47b6#file-repackage_apk_for_burp-py-L276-L319
#
# This script uses `apktool` instead of manually unzipping and zipping the app.
# Only with apktool it worked without any errors, so you need to install it.
###

BUILD_TOOLS=$ANDROID_SDK_ROOT/build-tools/31.0.0
APK=$1
NEW_BUNDLE_FILE=$2
OUTPUT_APK=$3

### Helper function to use echo but print text in bold
echo_bold() {
echo -e "\033[1m$*\033[0m"
}

### Validating inputs

if [ -z "$APK" ] || [ -z "$NEW_BUNDLE_FILE" ] || [ -z "$OUTPUT_APK" ]; then
echo "Usage: $0 <apk> <new-bundle-file> <output-apk>"
exit 1
fi
APK=$(realpath "$APK")
if [ ! -f "$APK" ]; then
echo "APK not found: $APK"
exit 1
fi
NEW_BUNDLE_FILE=$(realpath "$NEW_BUNDLE_FILE")
if [ ! -f "$NEW_BUNDLE_FILE" ]; then
echo "Bundle file not found: $NEW_BUNDLE_FILE"
exit 1
fi
OUTPUT_APK=$(realpath "$OUTPUT_APK")
# check if "apktool" command is available
if ! command -v apktool &> /dev/null
then
echo "apktool could not be found. Please install it."
exit 1
fi
# check if "jarsigner" command is available
if ! command -v jarsigner &> /dev/null
then
echo "jarsigner could not be found. Please install it."
exit 1
fi

KEYSTORE="$(realpath ./android/app/debug.keystore)"
ORIGINAL_WD=$(pwd)

### Copy apk to a temp dir

TMP_DIR=$(mktemp -d)
cp "$APK" "$TMP_DIR"
cd "$TMP_DIR" || exit

### Dissemble app

echo_bold "Dissembling app..."
apktool d "$APK" -o app > /dev/null

### Copy new bundle into assets

echo_bold "Copying new bundle into assets..."
rm app/assets/index.android.bundle
cp "$NEW_BUNDLE_FILE" app/assets/index.android.bundle

### Reassemble app

echo_bold "Reassembling app..."
apktool b app -o app.apk > /dev/null

### Do jarsigner

echo_bold "Signing app..."
jarsigner -verbose -keystore "$KEYSTORE" -storepass android -keypass android app.apk androiddebugkey

### Do zipalign

echo_bold "Zipaligning app..."
"$BUILD_TOOLS"/zipalign -p -v 4 app.apk app-aligned.apk

### Do apksigner

echo_bold "Signing app with apksigner..."
"$BUILD_TOOLS"/apksigner sign --v4-signing-enabled true --ks "$KEYSTORE" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android app-aligned.apk

### Copy back to original location

echo_bold "Copying back to original location..."
cp app-aligned.apk "$OUTPUT_APK"
echo "Done. Repacked app is at $OUTPUT_APK"
rm -rf "$TMP_DIR"
cd "$ORIGINAL_WD" || exit

6 changes: 3 additions & 3 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,11 @@ const CONST = {
ADD_PAYMENT_MENU_POSITION_X: 356,
EMOJI_PICKER_SIZE: {
WIDTH: 320,
HEIGHT: 400,
HEIGHT: 390,
},
NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 298,
NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 288,
EMOJI_PICKER_ITEM_HEIGHT: 32,
EMOJI_PICKER_HEADER_HEIGHT: 38,
EMOJI_PICKER_HEADER_HEIGHT: 32,
COMPOSER_MAX_HEIGHT: 125,
CHAT_FOOTER_MIN_HEIGHT: 65,
CHAT_SKELETON_VIEW: {
Expand Down
6 changes: 4 additions & 2 deletions src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const defaultProps = {
bankAccounts: [],
isLoading: false,
error: '',
errors: {},
},
selectedPlaidAccountID: '',
plaidLinkToken: '',
Expand Down Expand Up @@ -112,6 +113,7 @@ class AddPlaidBankAccount extends React.Component {
label: `${account.addressName} ${account.mask}`,
}));
const {icon, iconSize} = getBankIcon();
const plaidDataErrorMessage = !_.isEmpty(this.props.plaidData.errors) ? _.chain(this.props.plaidData.errors).values().first().value() : this.props.plaidData.error;

// Plaid Link view
if (!plaidBankAccounts.length) {
Expand All @@ -123,9 +125,9 @@ class AddPlaidBankAccount extends React.Component {
<ActivityIndicator color={themeColors.spinner} size="large" />
</View>
)}
{Boolean(this.props.plaidData.error) && (
{Boolean(plaidDataErrorMessage) && (
<Text style={[styles.formError, styles.mh5]}>
{this.props.plaidData.error}
{plaidDataErrorMessage}
</Text>
)}
{Boolean(token) && (
Expand Down
2 changes: 2 additions & 0 deletions src/components/DatePicker/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import _ from 'underscore';
import TextInput from '../TextInput';
import CONST from '../../CONST';
import {propTypes, defaultProps} from './datepickerPropTypes';
import styles from '../../styles/styles';

class DatePicker extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -49,6 +50,7 @@ class DatePicker extends React.Component {
placeholder={this.props.placeholder}
errorText={this.props.errorText}
containerStyles={this.props.containerStyles}
textInputContainerStyles={this.state.isPickerVisible ? [styles.borderColorFocus] : []}
onPress={this.showPicker}
editable={false}
disabled={this.props.disabled}
Expand Down
1 change: 1 addition & 0 deletions src/components/DatePicker/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class DatePicker extends React.Component {
placeholder={this.props.placeholder}
errorText={this.props.errorText}
containerStyles={this.props.containerStyles}
textInputContainerStyles={this.state.isPickerVisible ? [styles.borderColorFocus] : []}
onPress={this.showPicker}
editable={false}
disabled={this.props.disabled}
Expand Down
Loading

0 comments on commit 2180ca4

Please sign in to comment.