Skip to content

Commit

Permalink
Merge branch 'main' into fix/44165-missing-header-iou-distance
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Jul 10, 2024
2 parents 4bef669 + c973e62 commit d7b441c
Show file tree
Hide file tree
Showing 584 changed files with 17,851 additions and 6,688 deletions.
11 changes: 7 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const restrictedImportPaths = [
'',
"For 'useWindowDimensions', please use '@src/hooks/useWindowDimensions' instead.",
"For 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable', please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from '@components/Pressable' instead.",
"For 'StatusBar', please use '@src/libs/StatusBar' instead.",
"For 'StatusBar', please use '@libs/StatusBar' instead.",
"For 'Text', please use '@components/Text' instead.",
"For 'ScrollView', please use '@components/ScrollView' instead.",
].join('\n'),
Expand Down Expand Up @@ -59,8 +59,12 @@ const restrictedImportPaths = [
},
{
name: 'expensify-common',
importNames: ['Device'],
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.",
importNames: ['Device', 'ExpensiMark'],
message: [
'',
"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.",
"For 'ExpensiMark', please use '@libs/Parser' instead.",
].join('\n'),
},
];

Expand Down Expand Up @@ -109,7 +113,6 @@ module.exports = {
},
rules: {
// TypeScript specific rules
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/prefer-enum-initializers': 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/bumpVersion/bumpVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (!semanticVersionLevel || !versionUpdater.isValidSemverLevel(semanticVersionL
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
}

const {version: previousVersion}: PackageJson = JSON.parse(fs.readFileSync('./package.json').toString());
const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json').toString()) as PackageJson;
if (!previousVersion) {
core.setFailed('Error: Could not read package.json');
}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ class SemVer {
do {
const a = this.build[i]
const b = other.build[i]
debug('prerelease compare', i, a, b)
debug('build compare', i, a, b)
if (a === undefined && b === undefined) {
return 0
} else if (b === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import GitUtils from '@github/libs/GitUtils';

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

type PackageJSON = {
type PackageJson = {
version: string;
};

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

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const run = () => {
}

try {
const current: RegressionEntry = JSON.parse(entry);
const current = JSON.parse(entry) as RegressionEntry;

// Extract timestamp, Graphite accepts timestamp in seconds
if (current.metadata?.creationDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function run() {
core.setFailed(`'Error: Invalid input for 'SEMVER_LEVEL': ${semverLevel}`);
}

const {version: currentVersion}: PackageJson = JSON.parse(readFileSync('./package.json', 'utf8'));
const {version: currentVersion} = JSON.parse(readFileSync('./package.json', 'utf8')) as PackageJson;
if (!currentVersion) {
core.setFailed('Error: Could not read package.json');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {CompareResult, PerformanceEntry} from '@callstack/reassure-compare/
import fs from 'fs';

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

Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ jobs:

- name: 🚀 Push tags to trigger staging deploy 🚀
run: git push --tags

- name: Warn deployers if staging deploy failed
if: ${{ failure() }}
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
channel: '#deployer',
attachments: [{
color: "#DB4545",
pretext: `<!subteam^S4TJJ3PSL>`,
text: `💥 NewDot staging deploy failed. 💥`,
}]
}
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

deployProduction:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,6 +83,24 @@ jobs:
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }}

- name: 🚀 Create release to trigger production deploy 🚀
run: gh release create ${{ env.PRODUCTION_VERSION }} --generate-notes
run: gh release create ${{ env.PRODUCTION_VERSION }} --notes '${{ steps.getReleaseBody.outputs.RELEASE_BODY }}'
env:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}

- name: Warn deployers if production deploy failed
if: ${{ failure() }}
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
channel: '#deployer',
attachments: [{
color: "#DB4545",
pretext: `<!subteam^S4TJJ3PSL>`,
text: `💥 NewDot production deploy failed. 💥`,
}]
}
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
4 changes: 2 additions & 2 deletions .github/workflows/reassurePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:
git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1
git switch "$BASELINE_BRANCH"
npm install --force
npx reassure --baseline
NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
git switch --force --detach -
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
git checkout --ours .
npm install --force
npx reassure --branch
NODE_OPTIONS=--experimental-vm-modules npx reassure --branch
- name: Validate output.json
id: validateReassureOutput
Expand Down
66 changes: 61 additions & 5 deletions __mocks__/@react-navigation/native/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,65 @@
import {useIsFocused as realUseIsFocused, useTheme as realUseTheme} from '@react-navigation/native';
/* eslint-disable import/prefer-default-export, import/no-import-module-exports */
import type * as ReactNavigation from '@react-navigation/native';
import createAddListenerMock from '../../../tests/utils/createAddListenerMock';

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

const useTheme = process.env.NODE_ENV === 'test' ? realUseTheme : () => ({});
const realReactNavigation = isJestEnv ? jest.requireActual<typeof ReactNavigation>('@react-navigation/native') : (require('@react-navigation/native') as typeof ReactNavigation);

const useIsFocused = isJestEnv ? realReactNavigation.useIsFocused : () => true;
const useTheme = isJestEnv ? realReactNavigation.useTheme : () => ({});

const {triggerTransitionEnd, addListener} = isJestEnv
? createAddListenerMock()
: {
triggerTransitionEnd: () => {},
addListener: () => {},
};

const useNavigation = () => ({
...realReactNavigation.useNavigation,
navigate: jest.fn(),
getState: () => ({
routes: [],
}),
addListener,
});

type NativeNavigationMock = typeof ReactNavigation & {
triggerTransitionEnd: () => void;
};

export * from '@react-navigation/core';
export {useIsFocused, useTheme};
const Link = realReactNavigation.Link;
const LinkingContext = realReactNavigation.LinkingContext;
const NavigationContainer = realReactNavigation.NavigationContainer;
const ServerContainer = realReactNavigation.ServerContainer;
const DarkTheme = realReactNavigation.DarkTheme;
const DefaultTheme = realReactNavigation.DefaultTheme;
const ThemeProvider = realReactNavigation.ThemeProvider;
const useLinkBuilder = realReactNavigation.useLinkBuilder;
const useLinkProps = realReactNavigation.useLinkProps;
const useLinkTo = realReactNavigation.useLinkTo;
const useScrollToTop = realReactNavigation.useScrollToTop;
export {
// Overriden modules
useIsFocused,
useTheme,
useNavigation,
triggerTransitionEnd,

// Theme modules are left alone
Link,
LinkingContext,
NavigationContainer,
ServerContainer,
DarkTheme,
DefaultTheme,
ThemeProvider,
useLinkBuilder,
useLinkProps,
useLinkTo,
useScrollToTop,
};

export type {NativeNavigationMock};
16 changes: 8 additions & 8 deletions __mocks__/@ua/react-native-airship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ const iOS: Partial<typeof AirshipIOS> = {
},
};

const pushIOS: AirshipPushIOS = jest.fn().mockImplementation(() => ({
const pushIOS = jest.fn().mockImplementation(() => ({
setBadgeNumber: jest.fn(),
setForegroundPresentationOptions: jest.fn(),
setForegroundPresentationOptionsCallback: jest.fn(),
}))();
}))() as AirshipPushIOS;

const pushAndroid: AirshipPushAndroid = jest.fn().mockImplementation(() => ({
const pushAndroid = jest.fn().mockImplementation(() => ({
setForegroundDisplayPredicate: jest.fn(),
}))();
}))() as AirshipPushAndroid;

const push: AirshipPush = jest.fn().mockImplementation(() => ({
const push = jest.fn().mockImplementation(() => ({
iOS: pushIOS,
android: pushAndroid,
enableUserNotifications: () => Promise.resolve(false),
clearNotifications: jest.fn(),
getNotificationStatus: () => Promise.resolve({airshipOptIn: false, systemEnabled: false, airshipEnabled: false}),
getActiveNotifications: () => Promise.resolve([]),
}))();
}))() as AirshipPush;

const contact: AirshipContact = jest.fn().mockImplementation(() => ({
const contact = jest.fn().mockImplementation(() => ({
identify: jest.fn(),
getNamedUserId: () => Promise.resolve(undefined),
reset: jest.fn(),
module: jest.fn(),
}))();
}))() as AirshipContact;

const Airship: Partial<AirshipRoot> = {
addListener: jest.fn(),
Expand Down
1 change: 1 addition & 0 deletions __mocks__/fs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const {fs} = require('memfs');

module.exports = fs;
11 changes: 7 additions & 4 deletions __mocks__/react-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jest.doMock('react-native', () => {
};
};

const reactNativeMock: ReactNativeMock = Object.setPrototypeOf(
const reactNativeMock = Object.setPrototypeOf(
{
NativeModules: {
...ReactNative.NativeModules,
Expand Down Expand Up @@ -86,7 +86,7 @@ jest.doMock('react-native', () => {
},
Dimensions: {
...ReactNative.Dimensions,
addEventListener: jest.fn(),
addEventListener: jest.fn(() => ({remove: jest.fn()})),
get: () => dimensions,
set: (newDimensions: Record<string, number>) => {
dimensions = newDimensions;
Expand All @@ -98,11 +98,14 @@ jest.doMock('react-native', () => {
// so it seems easier to just run the callback immediately in tests.
InteractionManager: {
...ReactNative.InteractionManager,
runAfterInteractions: (callback: () => void) => callback(),
runAfterInteractions: (callback: () => void) => {
callback();
return {cancel: () => {}};
},
},
},
ReactNative,
);
) as ReactNativeMock;

return reactNativeMock;
});
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009000400
versionName "9.0.4-0"
versionCode 1009000512
versionName "9.0.5-12"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
9 changes: 9 additions & 0 deletions assets/images/circular-arrow-backwards.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d7b441c

Please sign in to comment.