Skip to content

Commit 5a2602c

Browse files
committed
Reset amount on reset button click
1 parent 8042286 commit 5a2602c

File tree

771 files changed

+28480
-6601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

771 files changed

+28480
-6601
lines changed

.eslintrc.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const restrictedImportPaths = [
88
'',
99
"For 'useWindowDimensions', please use '@src/hooks/useWindowDimensions' instead.",
1010
"For 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable', please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from '@components/Pressable' instead.",
11-
"For 'StatusBar', please use '@src/libs/StatusBar' instead.",
11+
"For 'StatusBar', please use '@libs/StatusBar' instead.",
1212
"For 'Text', please use '@components/Text' instead.",
1313
"For 'ScrollView', please use '@components/ScrollView' instead.",
1414
].join('\n'),
@@ -59,8 +59,12 @@ const restrictedImportPaths = [
5959
},
6060
{
6161
name: 'expensify-common',
62-
importNames: ['Device'],
63-
message: "Do not import Device directly, it's known to make VSCode's IntelliSense crash. Please import the desired module from `expensify-common/dist/Device` instead.",
62+
importNames: ['Device', 'ExpensiMark'],
63+
message: [
64+
'',
65+
"For 'Device', do not import it directly, it's known to make VSCode's IntelliSense crash. Please import the desired module from `expensify-common/dist/Device` instead.",
66+
"For 'ExpensiMark', please use '@libs/Parser' instead.",
67+
].join('\n'),
6468
},
6569
];
6670

@@ -109,7 +113,6 @@ module.exports = {
109113
},
110114
rules: {
111115
// TypeScript specific rules
112-
'@typescript-eslint/no-unsafe-assignment': 'off',
113116
'@typescript-eslint/prefer-enum-initializers': 'error',
114117
'@typescript-eslint/no-var-requires': 'off',
115118
'@typescript-eslint/no-non-null-assertion': 'error',

.github/actions/javascript/bumpVersion/bumpVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (!semanticVersionLevel || !versionUpdater.isValidSemverLevel(semanticVersionL
4949
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
5050
}
5151

52-
const {version: previousVersion}: PackageJson = JSON.parse(fs.readFileSync('./package.json').toString());
52+
const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json').toString()) as PackageJson;
5353
if (!previousVersion) {
5454
core.setFailed('Error: Could not read package.json');
5555
}

.github/actions/javascript/bumpVersion/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ class SemVer {
19281928
do {
19291929
const a = this.build[i]
19301930
const b = other.build[i]
1931-
debug('prerelease compare', i, a, b)
1931+
debug('build compare', i, a, b)
19321932
if (a === undefined && b === undefined) {
19331933
return 0
19341934
} else if (b === undefined) {

.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import GitUtils from '@github/libs/GitUtils';
88

99
type IssuesCreateResponse = Awaited<ReturnType<typeof GithubUtils.octokit.issues.create>>['data'];
1010

11-
type PackageJSON = {
11+
type PackageJson = {
1212
version: string;
1313
};
1414

1515
async function run(): Promise<IssuesCreateResponse | void> {
1616
// Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time
17-
const packageJson: PackageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'));
17+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) as PackageJson;
1818
const newVersionTag = packageJson.version;
1919

2020
try {

.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,27 @@ async function run() {
2121
status: 'completed',
2222
event: isProductionDeploy ? 'release' : 'push',
2323
})
24-
).data.workflow_runs;
24+
).data.workflow_runs
25+
// Note: we filter out cancelled runs instead of looking only for success runs
26+
// because if a build fails on even one platform, then it will have the status 'failure'
27+
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');
28+
29+
// Find the most recent deploy workflow for which at least one of the build jobs finished successfully.
30+
let lastSuccessfulDeploy = completedDeploys.shift();
31+
while (
32+
lastSuccessfulDeploy &&
33+
!(
34+
await GithubUtils.octokit.actions.listJobsForWorkflowRun({
35+
owner: github.context.repo.owner,
36+
repo: github.context.repo.repo,
37+
// eslint-disable-next-line @typescript-eslint/naming-convention
38+
run_id: lastSuccessfulDeploy.id,
39+
filter: 'latest',
40+
})
41+
).data.jobs.some((job) => job.name.startsWith('Build and deploy') && job.conclusion === 'success')
42+
) {
43+
lastSuccessfulDeploy = completedDeploys.shift();
44+
}
2545

2646
const priorTag = completedDeploys[0].head_branch;
2747
console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`);

.github/actions/javascript/getDeployPullRequestList/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11515,7 +11515,22 @@ async function run() {
1151511515
workflow_id: 'platformDeploy.yml',
1151611516
status: 'completed',
1151711517
event: isProductionDeploy ? 'release' : 'push',
11518-
})).data.workflow_runs;
11518+
})).data.workflow_runs
11519+
// Note: we filter out cancelled runs instead of looking only for success runs
11520+
// because if a build fails on even one platform, then it will have the status 'failure'
11521+
.filter((workflowRun) => workflowRun.conclusion !== 'cancelled');
11522+
// Find the most recent deploy workflow for which at least one of the build jobs finished successfully.
11523+
let lastSuccessfulDeploy = completedDeploys.shift();
11524+
while (lastSuccessfulDeploy &&
11525+
!(await GithubUtils_1.default.octokit.actions.listJobsForWorkflowRun({
11526+
owner: github.context.repo.owner,
11527+
repo: github.context.repo.repo,
11528+
// eslint-disable-next-line @typescript-eslint/naming-convention
11529+
run_id: lastSuccessfulDeploy.id,
11530+
filter: 'latest',
11531+
})).data.jobs.some((job) => job.name.startsWith('Build and deploy') && job.conclusion === 'success')) {
11532+
lastSuccessfulDeploy = completedDeploys.shift();
11533+
}
1151911534
const priorTag = completedDeploys[0].head_branch;
1152011535
console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`);
1152111536
const prList = await GitUtils_1.default.getPullRequestsMergedBetween(priorTag ?? '', inputTag);

.github/actions/javascript/getGraphiteString/getGraphiteString.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const run = () => {
3333
}
3434

3535
try {
36-
const current: RegressionEntry = JSON.parse(entry);
36+
const current = JSON.parse(entry) as RegressionEntry;
3737

3838
// Extract timestamp, Graphite accepts timestamp in seconds
3939
if (current.metadata?.creationDate) {

.github/actions/javascript/getPreviousVersion/getPreviousVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function run() {
1111
core.setFailed(`'Error: Invalid input for 'SEMVER_LEVEL': ${semverLevel}`);
1212
}
1313

14-
const {version: currentVersion}: PackageJson = JSON.parse(readFileSync('./package.json', 'utf8'));
14+
const {version: currentVersion} = JSON.parse(readFileSync('./package.json', 'utf8')) as PackageJson;
1515
if (!currentVersion) {
1616
core.setFailed('Error: Could not read package.json');
1717
}

.github/actions/javascript/validateReassureOutput/validateReassureOutput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {CompareResult, PerformanceEntry} from '@callstack/reassure-compare/
33
import fs from 'fs';
44

55
const run = (): boolean => {
6-
const regressionOutput: CompareResult = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8'));
6+
const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')) as CompareResult;
77
const countDeviation = Number(core.getInput('COUNT_DEVIATION', {required: true}));
88
const durationDeviation = Number(core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true}));
99

.github/workflows/deploy.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ jobs:
2828

2929
- name: 🚀 Push tags to trigger staging deploy 🚀
3030
run: git push --tags
31+
32+
- name: Warn deployers if staging deploy failed
33+
if: ${{ failure() }}
34+
uses: 8398a7/action-slack@v3
35+
with:
36+
status: custom
37+
custom_payload: |
38+
{
39+
channel: '#deployer',
40+
attachments: [{
41+
color: "#DB4545",
42+
pretext: `<!subteam^S4TJJ3PSL>`,
43+
text: `💥 NewDot staging deploy failed. 💥`,
44+
}]
45+
}
46+
env:
47+
GITHUB_TOKEN: ${{ github.token }}
48+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
3149

3250
deployProduction:
3351
runs-on: ubuntu-latest
@@ -65,6 +83,24 @@ jobs:
6583
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }}
6684

6785
- name: 🚀 Create release to trigger production deploy 🚀
68-
run: gh release create ${{ env.PRODUCTION_VERSION }} --generate-notes
86+
run: gh release create ${{ env.PRODUCTION_VERSION }} --notes '${{ steps.getReleaseBody.outputs.RELEASE_BODY }}'
6987
env:
7088
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
89+
90+
- name: Warn deployers if production deploy failed
91+
if: ${{ failure() }}
92+
uses: 8398a7/action-slack@v3
93+
with:
94+
status: custom
95+
custom_payload: |
96+
{
97+
channel: '#deployer',
98+
attachments: [{
99+
color: "#DB4545",
100+
pretext: `<!subteam^S4TJJ3PSL>`,
101+
text: `💥 NewDot production deploy failed. 💥`,
102+
}]
103+
}
104+
env:
105+
GITHUB_TOKEN: ${{ github.token }}
106+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

.github/workflows/e2ePerformanceTests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ jobs:
184184

185185
- name: Copy e2e code into zip folder
186186
run: cp tests/e2e/dist/index.js zip/testRunner.ts
187+
188+
- name: Copy profiler binaries into zip folder
189+
run: cp -r node_modules/@perf-profiler/android/cpp-profiler/bin zip/bin
187190

188191
- name: Zip everything in the zip directory up
189192
run: zip -qr App.zip ./zip

.github/workflows/reassurePerformanceTests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ jobs:
4848
git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1
4949
git switch "$BASELINE_BRANCH"
5050
npm install --force
51-
npx reassure --baseline
51+
NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
5252
git switch --force --detach -
5353
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
5454
git checkout --ours .
5555
npm install --force
56-
npx reassure --branch
56+
NODE_OPTIONS=--experimental-vm-modules npx reassure --branch
5757
5858
- name: Validate output.json
5959
id: validateReassureOutput

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
arrowParens: 'always',
77
printWidth: 190,
88
singleAttributePerLine: true,
9+
plugins: [require.resolve('@trivago/prettier-plugin-sort-imports')],
910
/** `importOrder` should be defined in an alphabetical order. */
1011
importOrder: [
1112
'@assets/(.*)$',

Gemfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ GEM
1010
i18n (>= 1.6, < 2)
1111
minitest (>= 5.1)
1212
tzinfo (~> 2.0)
13-
addressable (2.8.6)
14-
public_suffix (>= 2.0.2, < 6.0)
13+
addressable (2.8.7)
14+
public_suffix (>= 2.0.2, < 7.0)
1515
algoliasearch (1.27.5)
1616
httpclient (~> 2.8, >= 2.8.3)
1717
json (>= 1.5.1)
@@ -20,17 +20,17 @@ GEM
2020
artifactory (3.0.17)
2121
atomos (0.1.3)
2222
aws-eventstream (1.3.0)
23-
aws-partitions (1.944.0)
24-
aws-sdk-core (3.197.0)
23+
aws-partitions (1.948.0)
24+
aws-sdk-core (3.199.0)
2525
aws-eventstream (~> 1, >= 1.3.0)
2626
aws-partitions (~> 1, >= 1.651.0)
2727
aws-sigv4 (~> 1.8)
2828
jmespath (~> 1, >= 1.6.1)
29-
aws-sdk-kms (1.85.0)
30-
aws-sdk-core (~> 3, >= 3.197.0)
29+
aws-sdk-kms (1.87.0)
30+
aws-sdk-core (~> 3, >= 3.199.0)
3131
aws-sigv4 (~> 1.1)
32-
aws-sdk-s3 (1.152.3)
33-
aws-sdk-core (~> 3, >= 3.197.0)
32+
aws-sdk-s3 (1.154.0)
33+
aws-sdk-core (~> 3, >= 3.199.0)
3434
aws-sdk-kms (~> 1)
3535
aws-sigv4 (~> 1.8)
3636
aws-sigv4 (1.8.0)
@@ -119,7 +119,7 @@ GEM
119119
faraday_middleware (1.2.0)
120120
faraday (~> 1.0)
121121
fastimage (2.3.1)
122-
fastlane (2.221.0)
122+
fastlane (2.221.1)
123123
CFPropertyList (>= 2.3, < 4.0.0)
124124
addressable (>= 2.8, < 3.0.0)
125125
artifactory (~> 3.0)
Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,65 @@
1-
import {useIsFocused as realUseIsFocused, useTheme as realUseTheme} from '@react-navigation/native';
1+
/* eslint-disable import/prefer-default-export, import/no-import-module-exports */
2+
import type * as ReactNavigation from '@react-navigation/native';
3+
import createAddListenerMock from '../../../tests/utils/createAddListenerMock';
24

3-
// We only want these mocked for storybook, not jest
4-
const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true;
5+
const isJestEnv = process.env.NODE_ENV === 'test';
56

6-
const useTheme = process.env.NODE_ENV === 'test' ? realUseTheme : () => ({});
7+
const realReactNavigation = isJestEnv ? jest.requireActual<typeof ReactNavigation>('@react-navigation/native') : (require('@react-navigation/native') as typeof ReactNavigation);
8+
9+
const useIsFocused = isJestEnv ? realReactNavigation.useIsFocused : () => true;
10+
const useTheme = isJestEnv ? realReactNavigation.useTheme : () => ({});
11+
12+
const {triggerTransitionEnd, addListener} = isJestEnv
13+
? createAddListenerMock()
14+
: {
15+
triggerTransitionEnd: () => {},
16+
addListener: () => {},
17+
};
18+
19+
const useNavigation = () => ({
20+
...realReactNavigation.useNavigation,
21+
navigate: jest.fn(),
22+
getState: () => ({
23+
routes: [],
24+
}),
25+
addListener,
26+
});
27+
28+
type NativeNavigationMock = typeof ReactNavigation & {
29+
triggerTransitionEnd: () => void;
30+
};
731

832
export * from '@react-navigation/core';
9-
export {useIsFocused, useTheme};
33+
const Link = realReactNavigation.Link;
34+
const LinkingContext = realReactNavigation.LinkingContext;
35+
const NavigationContainer = realReactNavigation.NavigationContainer;
36+
const ServerContainer = realReactNavigation.ServerContainer;
37+
const DarkTheme = realReactNavigation.DarkTheme;
38+
const DefaultTheme = realReactNavigation.DefaultTheme;
39+
const ThemeProvider = realReactNavigation.ThemeProvider;
40+
const useLinkBuilder = realReactNavigation.useLinkBuilder;
41+
const useLinkProps = realReactNavigation.useLinkProps;
42+
const useLinkTo = realReactNavigation.useLinkTo;
43+
const useScrollToTop = realReactNavigation.useScrollToTop;
44+
export {
45+
// Overriden modules
46+
useIsFocused,
47+
useTheme,
48+
useNavigation,
49+
triggerTransitionEnd,
50+
51+
// Theme modules are left alone
52+
Link,
53+
LinkingContext,
54+
NavigationContainer,
55+
ServerContainer,
56+
DarkTheme,
57+
DefaultTheme,
58+
ThemeProvider,
59+
useLinkBuilder,
60+
useLinkProps,
61+
useLinkTo,
62+
useScrollToTop,
63+
};
64+
65+
export type {NativeNavigationMock};

__mocks__/@ua/react-native-airship.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ const iOS: Partial<typeof AirshipIOS> = {
1515
},
1616
};
1717

18-
const pushIOS: AirshipPushIOS = jest.fn().mockImplementation(() => ({
18+
const pushIOS = jest.fn().mockImplementation(() => ({
1919
setBadgeNumber: jest.fn(),
2020
setForegroundPresentationOptions: jest.fn(),
2121
setForegroundPresentationOptionsCallback: jest.fn(),
22-
}))();
22+
}))() as AirshipPushIOS;
2323

24-
const pushAndroid: AirshipPushAndroid = jest.fn().mockImplementation(() => ({
24+
const pushAndroid = jest.fn().mockImplementation(() => ({
2525
setForegroundDisplayPredicate: jest.fn(),
26-
}))();
26+
}))() as AirshipPushAndroid;
2727

28-
const push: AirshipPush = jest.fn().mockImplementation(() => ({
28+
const push = jest.fn().mockImplementation(() => ({
2929
iOS: pushIOS,
3030
android: pushAndroid,
3131
enableUserNotifications: () => Promise.resolve(false),
3232
clearNotifications: jest.fn(),
3333
getNotificationStatus: () => Promise.resolve({airshipOptIn: false, systemEnabled: false, airshipEnabled: false}),
3434
getActiveNotifications: () => Promise.resolve([]),
35-
}))();
35+
}))() as AirshipPush;
3636

37-
const contact: AirshipContact = jest.fn().mockImplementation(() => ({
37+
const contact = jest.fn().mockImplementation(() => ({
3838
identify: jest.fn(),
3939
getNamedUserId: () => Promise.resolve(undefined),
4040
reset: jest.fn(),
4141
module: jest.fn(),
42-
}))();
42+
}))() as AirshipContact;
4343

4444
const Airship: Partial<AirshipRoot> = {
4545
addListener: jest.fn(),

__mocks__/fs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
12
const {fs} = require('memfs');
23

34
module.exports = fs;

0 commit comments

Comments
 (0)