Skip to content

Commit

Permalink
Merge branch 'keycommand-v3' of github.com:azimgd/expensify-app into …
Browse files Browse the repository at this point in the history
…keycommand-v3
  • Loading branch information
azimgd committed Apr 20, 2023
1 parent 921f619 commit 54c94df
Show file tree
Hide file tree
Showing 28 changed files with 159 additions and 33 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
Expand Down Expand Up @@ -121,6 +127,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
Expand Down Expand Up @@ -178,6 +190,12 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}
fetch-depth: 0

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Decrypt Developer ID Certificate
Expand All @@ -192,7 +210,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Build desktop app for testing
run: npm run desktop-build-internal -- --publish always
run: npm run desktop-build-adhoc -- --publish always
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
Expand All @@ -214,6 +232,12 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Configure AWS Credentials
Expand All @@ -223,7 +247,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Build web for testing
run: npm run build-staging
run: npm run build-adhoc

- name: Build docs
run: npm run storybook-build
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001030202
versionName "1.3.2-2"
versionCode 1001030203
versionName "1.3.2-3"
}

splits {
Expand Down
50 changes: 50 additions & 0 deletions assets/images/new-expensify-adhoc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions config/electronBuilder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ const pullRequestNumber = process.env.PULL_REQUEST_NUMBER;
const s3Bucket = {
production: 'expensify-cash',
staging: 'staging-expensify-cash',
internal: 'ad-hoc-expensify-cash',
adhoc: 'ad-hoc-expensify-cash',
};

const s3Path = {
production: '/',
staging: '/',
internal: process.env.PULL_REQUEST_NUMBER
adhoc: process.env.PULL_REQUEST_NUMBER
? `/desktop/${pullRequestNumber}/`
: '/',
};

const macIcon = {
production: './desktop/icon.png',
staging: './desktop/icon-stg.png',
internal: './desktop/icon-stg.png',
adhoc: './desktop/icon-adhoc.png',
};

const isCorrectElectronEnv = ['production', 'staging', 'internal'].includes(
const isCorrectElectronEnv = ['production', 'staging', 'adhoc'].includes(
process.env.ELECTRON_ENV,
);

Expand Down
3 changes: 2 additions & 1 deletion config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const envToLogoSuffixMap = {
production: '',
staging: '-stg',
dev: '-dev',
adhoc: '-adhoc',
};

function mapEnvToLogoSuffix(envFile) {
Expand Down Expand Up @@ -120,7 +121,7 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
// React Native JavaScript environment requires the global __DEV__ variable to be accessible.
// react-native-render-html uses variable to log exclusively during development.
// See https://reactnative.dev/docs/javascript-environment
__DEV__: /staging|prod/.test(envFile) === false,
__DEV__: /staging|prod|adhoc/.test(envFile) === false,
}),

// This allows us to interactively inspect JS bundle contents
Expand Down
Binary file added desktop/icon-adhoc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const mainWindow = (() => {
if (__DEV__) {
console.debug('CONFIG: ', CONFIG);
app.dock.setIcon(`${__dirname}/../icon-dev.png`);
app.setName('New Expensify');
app.setName('New Expensify Dev');
}

app.on('will-finish-launching', () => {
Expand Down
4 changes: 2 additions & 2 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ platform :android do

desc "Build app for testing"
lane :build_internal do
ENV["ENVFILE"]=".env.staging"
ENV["ENVFILE"]=".env.adhoc"

gradle(
project_dir: './android',
Expand Down Expand Up @@ -118,7 +118,7 @@ platform :ios do
desc "Build app for testing"
lane :build_internal do
require 'securerandom'
ENV["ENVFILE"]=".env.staging"
ENV["ENVFILE"]=".env.adhoc"

keychain_password = SecureRandom.uuid

Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.2.2</string>
<string>1.3.2.3</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.2.2</string>
<string>1.3.2.3</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.

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.3.2-2",
"version": "1.3.2-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.",
Expand All @@ -19,10 +19,11 @@
"web-server": "webpack-dev-server --open --config config/webpack/webpack.dev.js",
"build": "webpack --config config/webpack/webpack.common.js --env envFile=.env.production",
"build-staging": "webpack --config config/webpack/webpack.common.js --env envFile=.env.staging",
"build-adhoc": "webpack --config config/webpack/webpack.common.js --env envFile=.env.adhoc",
"desktop": "scripts/set-pusher-suffix.sh && node desktop/start.js",
"desktop-build": "scripts/build-desktop.sh production",
"desktop-build-staging": "scripts/build-desktop.sh staging",
"desktop-build-internal": "scripts/build-desktop.sh internal",
"desktop-build-adhoc": "scripts/build-desktop.sh adhoc",
"ios-build": "fastlane ios build",
"android-build": "fastlane android build",
"android-build-e2e": "bundle exec fastlane android build_e2e",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export ELECTRON_ENV=${1:-development}

if [[ "$ELECTRON_ENV" == "staging" ]]; then
ENV_FILE=".env.staging"
elif [[ "$ELECTRON_ENV" == "internal" ]]; then
ENV_FILE=".env.staging"
elif [[ "$ELECTRON_ENV" == "adhoc" ]]; then
ENV_FILE=".env.adhoc"
elif [[ "$ELECTRON_ENV" == "production" ]]; then
ENV_FILE=".env.production"
else
Expand Down
5 changes: 5 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const PLATFORM_IOS = 'iOS';
const ANDROID_PACKAGE_NAME = 'com.expensify.chat';
const USA_COUNTRY_NAME = 'United States';
const CURRENT_YEAR = new Date().getFullYear();
const PULL_REQUEST_NUMBER = lodashGet(Config, 'PULL_REQUEST_NUMBER', '');

const keyModifierControl = lodashGet(KeyCommand, 'constants.keyModifierControl', 'keyModifierControl');
const keyModifierCommand = lodashGet(KeyCommand, 'constants.keyModifierCommand', 'keyModifierCommand');
Expand Down Expand Up @@ -66,6 +67,8 @@ const CONST = {
RESERVED_FIRST_NAMES: ['Expensify', 'Concierge'],
},

PULL_REQUEST_NUMBER,

CALENDAR_PICKER: {
// Numbers were arbitrarily picked.
MIN_YEAR: CURRENT_YEAR - 100,
Expand Down Expand Up @@ -358,6 +361,7 @@ const CONST = {
PDF_VIEWER_URL: '/pdf/web/viewer.html',
CLOUDFRONT_DOMAIN_REGEX: /^https:\/\/\w+\.cloudfront\.net/i,
EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`,
CONCIERGE_ICON_URL: `${CLOUDFRONT_URL}/images/icons/concierge_2022.png`,
UPWORK_URL: 'https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22',
GITHUB_URL: 'https://github.com/Expensify/App',
TERMS_URL: `${USE_EXPENSIFY_URL}/terms`,
Expand Down Expand Up @@ -750,6 +754,7 @@ const CONST = {
DEV: 'development',
STAGING: 'staging',
PRODUCTION: 'production',
ADHOC: 'adhoc',
},

// Used to delay the initial fetching of reportActions when the app first inits or reconnects (e.g. returning
Expand Down
7 changes: 6 additions & 1 deletion src/components/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import styles from '../styles/styles';
import * as StyleUtils from '../styles/StyleUtils';
import Text from './Text';
import CONST from '../CONST';

const propTypes = {
/** Is Success type */
Expand All @@ -18,6 +19,9 @@ const propTypes = {
/** Text to display in the Badge */
text: PropTypes.string.isRequired,

/** Text to display in the Badge */
environment: PropTypes.string,

/** Styles for Badge */
// eslint-disable-next-line react/forbid-prop-types
badgeStyles: PropTypes.arrayOf(PropTypes.object),
Expand All @@ -32,6 +36,7 @@ const defaultProps = {
pressable: false,
badgeStyles: [],
onPress: undefined,
environment: CONST.ENVIRONMENT.DEV,
};

const Badge = (props) => {
Expand All @@ -40,7 +45,7 @@ const Badge = (props) => {
const wrapperStyles = ({pressed}) => ([
styles.badge,
styles.ml2,
StyleUtils.getBadgeColorStyle(props.success, props.error, pressed),
StyleUtils.getBadgeColorStyle(props.success, props.error, pressed, props.environment === CONST.ENVIRONMENT.ADHOC),
...props.badgeStyles,
]);

Expand Down
12 changes: 9 additions & 3 deletions src/components/EnvironmentBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import CONST from '../CONST';
import withEnvironment, {environmentPropTypes} from './withEnvironment';
import Badge from './Badge';
import styles from '../styles/styles';
import * as Environment from '../libs/Environment/Environment';
import pkg from '../../package.json';

const ENVIRONMENT_SHORT_FORM = {
[CONST.ENVIRONMENT.DEV]: 'DEV',
[CONST.ENVIRONMENT.STAGING]: 'STG',
[CONST.ENVIRONMENT.PRODUCTION]: 'PROD',
[CONST.ENVIRONMENT.ADHOC]: 'ADHOC',
};

const EnvironmentBadge = (props) => {
Expand All @@ -16,12 +19,15 @@ const EnvironmentBadge = (props) => {
return null;
}

const text = Environment.isInternalTestBuild() ? `v${pkg.version} PR:${CONST.PULL_REQUEST_NUMBER}` : ENVIRONMENT_SHORT_FORM[props.environment];

return (
<Badge
success={props.environment === CONST.ENVIRONMENT.STAGING}
error={props.environment !== CONST.ENVIRONMENT.STAGING}
text={ENVIRONMENT_SHORT_FORM[props.environment]}
success={props.environment === CONST.ENVIRONMENT.STAGING || props.environment === CONST.ENVIRONMENT.ADHOC}
error={props.environment !== CONST.ENVIRONMENT.STAGING && props.environment !== CONST.ENVIRONMENT.ADHOC}
text={text}
badgeStyles={[styles.alignSelfCenter]}
environment={props.environment}
/>
);
};
Expand Down
2 changes: 2 additions & 0 deletions src/components/ExpensifyCashLogo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import ProductionLogo from '../../assets/images/new-expensify.svg';
import DevLogo from '../../assets/images/new-expensify-dev.svg';
import StagingLogo from '../../assets/images/new-expensify-stg.svg';
import AdhocLogo from '../../assets/images/new-expensify-adhoc.svg';
import CONST from '../CONST';
import withEnvironment, {environmentPropTypes} from './withEnvironment';

Expand All @@ -20,6 +21,7 @@ const logoComponents = {
[CONST.ENVIRONMENT.DEV]: DevLogo,
[CONST.ENVIRONMENT.STAGING]: StagingLogo,
[CONST.ENVIRONMENT.PRODUCTION]: ProductionLogo,
[CONST.ENVIRONMENT.ADHOC]: AdhocLogo,
};

const ExpensifyCashLogo = (props) => {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ApiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Environment.getEnvironment()
return;
}

const defaultToggleState = ENV_NAME === CONST.ENVIRONMENT.STAGING;
const defaultToggleState = ENV_NAME === CONST.ENVIRONMENT.STAGING || ENV_NAME === CONST.ENVIRONMENT.ADHOC;
shouldUseStagingServer = lodashGet(val, 'shouldUseStagingServer', defaultToggleState);
},
});
Expand Down
Loading

0 comments on commit 54c94df

Please sign in to comment.