diff --git a/.eslintrc.js b/.eslintrc.js index 85a4e86797b6..39a7c7553261 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,11 @@ const restrictedImportPaths = [ importNames: ['TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'], message: "Please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from 'src/components/Pressable' instead.", }, + { + name: 'awesome-phonenumber', + importNames: ['parsePhoneNumber'], + message: "Please use '@libs/PhoneNumber' instead.", + }, { name: 'react-native-safe-area-context', importNames: ['useSafeAreaInsets', 'SafeAreaConsumer', 'SafeAreaInsetsContext'], diff --git a/Gemfile.lock b/Gemfile.lock index 93dab195ebdd..fcf4f878e2de 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,7 +81,8 @@ GEM declarative (0.0.20) digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) - domain_name (0.6.20231109) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) dotenv (2.8.1) emoji_regex (3.2.3) escape (0.0.4) @@ -261,6 +262,9 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.9.1) unicode-display_width (2.5.0) webrick (1.8.1) word_wrap (1.0.0) @@ -294,4 +298,4 @@ RUBY VERSION ruby 2.6.10p210 BUNDLED WITH - 2.1.4 + 2.4.7 diff --git a/__mocks__/@ua/react-native-airship.js b/__mocks__/@ua/react-native-airship.js index 29be662e96a1..65e7c1a8b97e 100644 --- a/__mocks__/@ua/react-native-airship.js +++ b/__mocks__/@ua/react-native-airship.js @@ -28,6 +28,7 @@ const Airship = { enableUserNotifications: () => Promise.resolve(false), clearNotifications: jest.fn(), getNotificationStatus: () => Promise.resolve({airshipOptIn: false, systemEnabled: false}), + getActiveNotifications: () => Promise.resolve([]), }, contact: { identify: jest.fn(), diff --git a/android/app/build.gradle b/android/app/build.gradle index 40961ac9957d..1338459abdf1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -91,8 +91,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001041304 - versionName "1.4.13-4" + versionCode 1001041400 + versionName "1.4.14-0" } flavorDimensions "default" diff --git a/assets/animations/Fireworks.lottie b/assets/animations/Fireworks.lottie index f5a782c62f3a..142efdcd8fdc 100644 Binary files a/assets/animations/Fireworks.lottie and b/assets/animations/Fireworks.lottie differ diff --git a/assets/animations/ReviewingBankInfo.lottie b/assets/animations/ReviewingBankInfo.lottie index 93addc052e8b..a9974366cae7 100644 Binary files a/assets/animations/ReviewingBankInfo.lottie and b/assets/animations/ReviewingBankInfo.lottie differ diff --git a/contributingGuides/TS_STYLE.md b/contributingGuides/TS_STYLE.md index bc62020ffd54..a583941bf71d 100644 --- a/contributingGuides/TS_STYLE.md +++ b/contributingGuides/TS_STYLE.md @@ -24,6 +24,8 @@ - [1.17 `.tsx`](#tsx) - [1.18 No inline prop types](#no-inline-prop-types) - [1.19 Satisfies operator](#satisfies-operator) + - [1.20 Hooks instead of HOCs](#hooks-instead-of-hocs) + - [1.21 `compose` usage](#compose-usage) - [Exception to Rules](#exception-to-rules) - [Communication Items](#communication-items) - [Migration Guidelines](#migration-guidelines) @@ -124,7 +126,7 @@ type Foo = { -- [1.2](#d-ts-extension) **`d.ts` Extension**: Do not use `d.ts` file extension even when a file contains only type declarations. Only exceptions are `src/types/global.d.ts` and `src/types/modules/*.d.ts` files in which third party packages can be modified using module augmentation. Refer to the [Communication Items](#communication-items) section to learn more about module augmentation. +- [1.2](#d-ts-extension) **`d.ts` Extension**: Do not use `d.ts` file extension even when a file contains only type declarations. Only exceptions are `src/types/global.d.ts` and `src/types/modules/*.d.ts` files in which third party packages and JavaScript's built-in modules (e.g. `window` object) can be modified using module augmentation. Refer to the [Communication Items](#communication-items) section to learn more about module augmentation. > Why? Type errors in `d.ts` files are not checked by TypeScript [^1]. @@ -509,6 +511,102 @@ type Foo = { } satisfies Record; ``` + + +- [1.20](#hooks-instead-of-hocs) **Hooks instead of HOCs**: Replace HOCs usage with Hooks whenever possible. + + > Why? Hooks are easier to use (can be used inside the function component), and don't need nesting or `compose` when exporting the component. It also allows us to remove `compose` completely in some components since it has been bringing up some issues with TypeScript. Read the [`compose` usage](#compose-usage) section for further information about the TypeScript issues with `compose`. + + > Note: Because Onyx doesn't provide a hook yet, in a component that accesses Onyx data with `withOnyx` HOC, please make sure that you don't use other HOCs (if applicable) to avoid HOC nesting. + + ```tsx + // BAD + type ComponentOnyxProps = { + session: OnyxEntry; + }; + + type ComponentProps = WindowDimensionsProps & + WithLocalizeProps & + ComponentOnyxProps & { + someProp: string; + }; + + function Component({windowWidth, windowHeight, translate, session, someProp}: ComponentProps) { + // component's code + } + + export default compose( + withWindowDimensions, + withLocalize, + withOnyx({ + session: { + key: ONYXKEYS.SESSION, + }, + }), + )(Component); + + // GOOD + type ComponentOnyxProps = { + session: OnyxEntry; + }; + + type ComponentProps = ComponentOnyxProps & { + someProp: string; + }; + + function Component({session, someProp}: ComponentProps) { + const {windowWidth, windowHeight} = useWindowDimensions(); + const {translate} = useLocalize(); + // component's code + } + + // There is no hook alternative for withOnyx yet. + export default withOnyx({ + session: { + key: ONYXKEYS.SESSION, + }, + })(Component); + ``` + + + +- [1.21](#compose-usage) **`compose` usage**: Avoid the usage of `compose` function to compose HOCs in TypeScript files. Use nesting instead. + + > Why? `compose` function doesn't work well with TypeScript when dealing with several HOCs being used in a component, many times resulting in wrong types and errors. Instead, nesting can be used to allow a seamless use of multiple HOCs and result in a correct return type of the compoment. Also, you can use [hooks instead of HOCs](#hooks-instead-of-hocs) whenever possible to minimize or even remove the need of HOCs in the component. + + ```ts + // BAD + export default compose( + withCurrentUserPersonalDetails, + withReportOrNotFound(), + withOnyx({ + session: { + key: ONYXKEYS.SESSION, + }, + }), + )(Component); + + // GOOD + export default withCurrentUserPersonalDetails( + withReportOrNotFound()( + withOnyx({ + session: { + key: ONYXKEYS.SESSION, + }, + })(Component), + ), + ); + + // GOOD - alternative to HOC nesting + const ComponentWithOnyx = withOnyx({ + session: { + key: ONYXKEYS.SESSION, + }, + })(Component); + const ComponentWithReportOrNotFound = withReportOrNotFound()(ComponentWithOnyx); + export default withCurrentUserPersonalDetails(ComponentWithReportOrNotFound); + ``` + ## Exception to Rules Most of the rules are enforced in ESLint or checked by TypeScript. If you think your particular situation warrants an exception, post the context in the `#expensify-open-source` Slack channel with your message prefixed with `TS EXCEPTION:`. The internal engineer assigned to the PR should be the one that approves each exception, however all discussion regarding granting exceptions should happen in the public channel instead of the GitHub PR page so that the TS migration team can access them easily. @@ -521,7 +619,7 @@ This rule will apply until the migration is done. After the migration, discussio > Comment in the `#expensify-open-source` Slack channel if any of the following situations are encountered. Each comment should be prefixed with `TS ATTENTION:`. Internal engineers will access each situation and prescribe solutions to each case. Internal engineers should refer to general solutions to each situation that follows each list item. -- I think types definitions in a third party library is incomplete or incorrect +- I think types definitions in a third party library or JavaScript's built-in module are incomplete or incorrect When the library indeed contains incorrect or missing type definitions and it cannot be updated, use module augmentation to correct them. All module augmentation code should be contained in `/src/types/modules/*.d.ts`, each library as a separate file. @@ -540,7 +638,7 @@ declare module "external-library-name" { > This section contains instructions that are applicable during the migration. -- 🚨 DO NOT write new code in TypeScript yet. The only time you write TypeScript code is when the file you're editing has already been migrated to TypeScript by the migration team. This guideline will be updated once it's time for new code to be written in TypeScript. If you're doing a major overhaul or refactoring of particular features or utilities of App and you believe it might be beneficial to migrate relevant code to TypeScript as part of the refactoring, please ask in the #expensify-open-source channel about it (and prefix your message with `TS ATTENTION:`). +- 🚨 DO NOT write new code in TypeScript yet. The only time you write TypeScript code is when the file you're editing has already been migrated to TypeScript by the migration team, or when you need to add new files under `src/libs`, `src/hooks`, `src/styles`, and `src/languages` directories. This guideline will be updated once it's time for new code to be written in TypeScript. If you're doing a major overhaul or refactoring of particular features or utilities of App and you believe it might be beneficial to migrate relevant code to TypeScript as part of the refactoring, please ask in the #expensify-open-source channel about it (and prefix your message with `TS ATTENTION:`). - If you're migrating a module that doesn't have a default implementation (i.e. `index.ts`, e.g. `getPlatform`), convert `index.website.js` to `index.ts`. Without `index.ts`, TypeScript cannot get type information where the module is imported. @@ -579,6 +677,25 @@ object?.foo ?? 'bar'; const y: number = 123; // TS error: Unused '@ts-expect-error' directive. ``` +- The TS issue I'm working on is blocked by another TS issue because of type errors. What should I do? + + In order to proceed with the migration faster, we are now allowing the use of `@ts-expect-error` annotation to temporally suppress those errors and help you unblock your issues. The only requirements is that you MUST add the annotation with a comment explaining that it must be removed when the blocking issue is migrated, e.g.: + + ```tsx + return ( + + ); + ``` + + **You will also need to reference the blocking issue in your PR.** You can find all the TS issues [here](https://github.com/orgs/Expensify/projects/46). + ## Learning Resources ### Quickest way to learn TypeScript diff --git a/docs/articles/expensify-classic/workspace-and-domain-settings/Budgets.md b/docs/articles/expensify-classic/workspace-and-domain-settings/Budgets.md new file mode 100644 index 000000000000..3c5bc0fe2421 --- /dev/null +++ b/docs/articles/expensify-classic/workspace-and-domain-settings/Budgets.md @@ -0,0 +1,56 @@ +--- +title: Budgets +description: Track employee spending across categories and tags by using Expensify's Budgets feature. +--- + +# About +Expensify’s Budgets feature allows you to: +- Set monthly and yearly budgets +- Track spending across categories and tags on an individual and workspace basis +- Get notified when a budget has met specific thresholds + +# How-to +## Category Budgets +1. Navigate to **Settings > Group > [Workspace Name] > Categories** +2. Click the **Edit Rules** button for the category you want to add a budget to +3. Select the **Budget** tab at the top of the modal that opens +4. Click the switch next to **Enable Budget** +5. Once enabled, you will see additional settings to configure: + - **Budget frequency**: you can select if you want this to be a monthly or a yearly budget + - **Total workspace budget**: you can enter an amount if you want to set a budget for the entire workspace + - **Per individual budget**: you can enter an amount if you want to set a budget per person + - **Notification threshold** - this is the % in which you will be notified as the budgets are hit + +## Single-level Tag Budgets +1. Navigate to **Settings > Group > [Workspace Name] > Tags** +2. Click **Edit Budget** next to the tag you want to add a budget to +3. Click the switch next to **Enable Budget** +4. Once enabled, you will see additional settings to configure: + - **Budget frequency**: you can select if you want this to be a monthly or a yearly budget + - **Total workspace budget**: you can enter an amount if you want to set a budget for the entire workspace + - **Per individual budget**: you can enter an amount if you want to set a budget per person + - **Notification threshold** - this is the % in which you will be notified as the budgets are hit + +## Multi-level Tag Budgets +1. Navigate to **Settings > Group > [Workspace Name] > Tags** +2. Click the **Edit Tags** button +3. Click the **Edit Budget** button next to the subtag you want to apply a budget to +4. Click the switch next to **Enable Budget** +5. Once enabled, you will see additional settings to configure: + - **Budget frequency**: you can select if you want this to be a monthly or a yearly budget + - **Total workspace budget**: you can enter an amount if you want to set a budget for the entire workspace + - **Per individual budget**: you can enter an amount if you want to set a budget per person + - **Notification threshold** - this is the % in which you will be notified as the budgets are hit + +# FAQ +## Can I import budgets as a CSV? +At this time, you cannot import budgets via CSV since we don’t import categories or tags from direct accounting integrations. + +## When will I be notified as a budget is hit? +Notifications are sent twice: + - When your notification threshold is hit (i.e, if you set this as 50%, you’ll be notified when 50% of the budget is met) + - When 100% of the budget is met + +## How will I be notified when a budget is hit? +A message will be sent in the #admins room of the Workspace. + diff --git a/docs/articles/new-expensify/get-paid-back/Referral-Program.md b/docs/articles/new-expensify/get-paid-back/Referral-Program.md index 34a35f5dc7c8..6ffb923aeb76 100644 --- a/docs/articles/new-expensify/get-paid-back/Referral-Program.md +++ b/docs/articles/new-expensify/get-paid-back/Referral-Program.md @@ -12,13 +12,16 @@ As a thank you, every time you bring a new customer into New Expensify, you'll g # How to get paid to refer anyone to New Expensify -The sky's the limit for this referral program! Your referral can be anyone - a friend, family member, boss, coworker, neighbor, or even social media follower. We're making it as easy as possible to get that cold hard referral $$$. +The sky's the limit for this referral program! Your referral can be anyone - a friend, family member, boss, coworker, neighbor, or even social media follower. We're making it as easy as possible to get that cold hard $$$. -1. There are a bunch of different ways to kick off a referral in New Expensify: +1. There are a bunch of different ways to refer someone to New Expensify: - Start a chat - Request money - Send money - - @ mention someone + - Split a bill + - Assign them a task + - @ mention them + - Invite them to a room - Add them to a workspace 2. You'll get $250 for each referral as long as: diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index f372dd6f9cba..66cdf8003d63 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.4.13 + 1.4.14 CFBundleSignature ???? CFBundleURLTypes @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.13.4 + 1.4.14.0 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index b8c64b921e23..effadbde9866 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.4.13 + 1.4.14 CFBundleSignature ???? CFBundleVersion - 1.4.13.4 + 1.4.14.0 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 390511397b0e..eebd6ad532d4 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,25 +1,25 @@ PODS: - - Airship (16.11.3): - - Airship/Automation (= 16.11.3) - - Airship/Basement (= 16.11.3) - - Airship/Core (= 16.11.3) - - Airship/ExtendedActions (= 16.11.3) - - Airship/MessageCenter (= 16.11.3) - - Airship/Automation (16.11.3): + - Airship (16.12.1): + - Airship/Automation (= 16.12.1) + - Airship/Basement (= 16.12.1) + - Airship/Core (= 16.12.1) + - Airship/ExtendedActions (= 16.12.1) + - Airship/MessageCenter (= 16.12.1) + - Airship/Automation (16.12.1): - Airship/Core - - Airship/Basement (16.11.3) - - Airship/Core (16.11.3): + - Airship/Basement (16.12.1) + - Airship/Core (16.12.1): - Airship/Basement - - Airship/ExtendedActions (16.11.3): + - Airship/ExtendedActions (16.12.1): - Airship/Core - - Airship/MessageCenter (16.11.3): + - Airship/MessageCenter (16.12.1): - Airship/Core - - Airship/PreferenceCenter (16.11.3): + - Airship/PreferenceCenter (16.12.1): - Airship/Core - - AirshipFrameworkProxy (2.0.8): - - Airship (= 16.11.3) - - Airship/MessageCenter (= 16.11.3) - - Airship/PreferenceCenter (= 16.11.3) + - AirshipFrameworkProxy (2.1.1): + - Airship (= 16.12.1) + - Airship/MessageCenter (= 16.12.1) + - Airship/PreferenceCenter (= 16.12.1) - AppAuth (1.6.2): - AppAuth/Core (= 1.6.2) - AppAuth/ExternalUserAgent (= 1.6.2) @@ -558,8 +558,8 @@ PODS: - React-jsinspector (0.72.4) - React-logger (0.72.4): - glog - - react-native-airship (15.2.6): - - AirshipFrameworkProxy (= 2.0.8) + - react-native-airship (15.3.1): + - AirshipFrameworkProxy (= 2.1.1) - React-Core - react-native-blob-util (0.17.3): - React-Core @@ -777,35 +777,10 @@ PODS: - React-Core - RNReactNativeHapticFeedback (1.14.0): - React-Core - - RNReanimated (3.5.4): - - DoubleConversion - - FBLazyVector - - glog - - hermes-engine - - RCT-Folly - - RCTRequired - - RCTTypeSafety - - React-callinvoker + - RNReanimated (3.6.1): + - RCT-Folly (= 2021.07.22.00) - React-Core - - React-Core/DevSupport - - React-Core/RCTWebSocket - - React-CoreModules - - React-cxxreact - - React-hermes - - React-jsi - - React-jsiexecutor - - React-jsinspector - - React-RCTActionSheet - - React-RCTAnimation - - React-RCTAppDelegate - - React-RCTBlob - - React-RCTImage - - React-RCTLinking - - React-RCTNetwork - - React-RCTSettings - - React-RCTText - ReactCommon/turbomodule/core - - Yoga - RNScreens (3.21.0): - React-Core - React-RCTImage @@ -1160,8 +1135,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - Airship: c70eed50e429f97f5adb285423c7291fb7a032ae - AirshipFrameworkProxy: 7bc4130c668c6c98e2d4c60fe4c9eb61a999be99 + Airship: 2f4510b497a8200780752a5e0304a9072bfffb6d + AirshipFrameworkProxy: ea1b6c665c798637b93c465b5e505be3011f1d9d AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570 boost: 57d2868c099736d80fcd648bf211b4431e51a558 BVLinearGradient: 421743791a59d259aec53f4c58793aad031da2ca @@ -1224,7 +1199,7 @@ SPEC CHECKSUMS: React-jsiexecutor: c7f826e40fa9cab5d37cab6130b1af237332b594 React-jsinspector: aaed4cf551c4a1c98092436518c2d267b13a673f React-logger: da1ebe05ae06eb6db4b162202faeafac4b435e77 - react-native-airship: 5d19f4ba303481cf4101ff9dee9249ef6a8a6b64 + react-native-airship: 6ded22e4ca54f2f80db80b7b911c2b9b696d9335 react-native-blob-util: 99f4d79189252f597fe0d810c57a3733b1b1dea6 react-native-cameraroll: 8ffb0af7a5e5de225fd667610e2979fc1f0c2151 react-native-config: 7cd105e71d903104e8919261480858940a6b9c0e @@ -1280,7 +1255,7 @@ SPEC CHECKSUMS: rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64 RNPermissions: 9b086c8f05b2e2faa587fdc31f4c5ab4509728aa RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c - RNReanimated: ab2e96c6d5591c3dfbb38a464f54c8d17fb34a87 + RNReanimated: fdbaa9c964bbab7fac50c90862b6cc5f041679b9 RNScreens: d037903436160a4b039d32606668350d2a808806 RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396 SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d diff --git a/package-lock.json b/package-lock.json index 9ad0c00b7bfb..8fb51c7ba3e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.13-4", + "version": "1.4.14-0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.13-4", + "version": "1.4.14-0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -41,7 +41,7 @@ "@rnmapbox/maps": "^10.0.11", "@shopify/flash-list": "^1.6.1", "@types/node": "^18.14.0", - "@ua/react-native-airship": "^15.2.6", + "@ua/react-native-airship": "^15.3.1", "awesome-phonenumber": "^5.4.0", "babel-polyfill": "^6.26.0", "canvas-size": "^1.2.6", @@ -50,7 +50,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#927c8409e4454e15a1b95ed0a312ff8fee38f0f0", + "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#398bf7c6a6d37f229a41d92bd7a4324c0fd32849", "fbjs": "^3.0.2", "htmlparser2": "^7.2.0", "idb-keyval": "^6.2.1", @@ -100,7 +100,7 @@ "react-native-plaid-link-sdk": "10.8.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "3.5.4", + "react-native-reanimated": "^3.6.1", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", @@ -20437,9 +20437,9 @@ } }, "node_modules/@ua/react-native-airship": { - "version": "15.2.6", - "resolved": "https://registry.npmjs.org/@ua/react-native-airship/-/react-native-airship-15.2.6.tgz", - "integrity": "sha512-dVlBPPYXD/4SEshv/X7mmt3xF8WfnNqiSNzCyqJSLAZ1aJuPpP9Z5WemCYsa2iv6goRZvtJSE4P79QKlfoTwXw==", + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/@ua/react-native-airship/-/react-native-airship-15.3.1.tgz", + "integrity": "sha512-g5YX4/fpBJ0ml//7ave8HE68uF4QFriCuei0xJwK+ClzbTDWYB6OldvE/wj5dMpgQ95ZFSbr5LU77muYScxXLQ==", "engines": { "node": ">= 16.0.0" }, @@ -29894,8 +29894,8 @@ }, "node_modules/expensify-common": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#927c8409e4454e15a1b95ed0a312ff8fee38f0f0", - "integrity": "sha512-s9l/Zy3UjDBrq0WTkgEue1DXLRkkYtuqnANQlVmODHJ9HkJADjrVSv2D0U3ltqd9X7vLCLCmmwl5AUE6466gGg==", + "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#398bf7c6a6d37f229a41d92bd7a4324c0fd32849", + "integrity": "sha512-H7UrLgWIr8mCoPc1oxbeYW2RwLzUWI6jdjbV6cRnrlp8cDW3IyZISF+BQSPFDj7bMhNAbczQPtEOE1gld21Cvg==", "license": "MIT", "dependencies": { "classnames": "2.3.1", @@ -29911,7 +29911,7 @@ "simply-deferred": "git+https://github.com/Expensify/simply-deferred.git#77a08a95754660c7bd6e0b6979fdf84e8e831bf5", "string.prototype.replaceall": "^1.0.6", "ua-parser-js": "^1.0.35", - "underscore": "1.13.1" + "underscore": "1.13.6" } }, "node_modules/expensify-common/node_modules/prop-types": { @@ -29983,12 +29983,6 @@ "node": "*" } }, - "node_modules/expensify-common/node_modules/underscore": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", - "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==", - "license": "MIT" - }, "node_modules/express": { "version": "4.18.1", "license": "MIT", @@ -44561,9 +44555,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.4.tgz", - "integrity": "sha512-8we9LLDO1o4Oj9/DICeEJ2K1tjfqkJagqQUglxeUAkol/HcEJ6PGxIrpBcNryLqCDYEcu6FZWld/FzizBIw6bg==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.6.1.tgz", + "integrity": "sha512-F4vG9Yf9PKmE3GaWtVGUpzj3SM6YY2cx1yRHCwiMd1uY7W0gU017LfcVUorboJnj0y5QZqEriEK1Usq2Y8YZqg==", "dependencies": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", @@ -67439,9 +67433,9 @@ } }, "@ua/react-native-airship": { - "version": "15.2.6", - "resolved": "https://registry.npmjs.org/@ua/react-native-airship/-/react-native-airship-15.2.6.tgz", - "integrity": "sha512-dVlBPPYXD/4SEshv/X7mmt3xF8WfnNqiSNzCyqJSLAZ1aJuPpP9Z5WemCYsa2iv6goRZvtJSE4P79QKlfoTwXw==", + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/@ua/react-native-airship/-/react-native-airship-15.3.1.tgz", + "integrity": "sha512-g5YX4/fpBJ0ml//7ave8HE68uF4QFriCuei0xJwK+ClzbTDWYB6OldvE/wj5dMpgQ95ZFSbr5LU77muYScxXLQ==", "requires": {} }, "@vercel/ncc": { @@ -74403,9 +74397,9 @@ } }, "expensify-common": { - "version": "git+ssh://git@github.com/Expensify/expensify-common.git#927c8409e4454e15a1b95ed0a312ff8fee38f0f0", - "integrity": "sha512-s9l/Zy3UjDBrq0WTkgEue1DXLRkkYtuqnANQlVmODHJ9HkJADjrVSv2D0U3ltqd9X7vLCLCmmwl5AUE6466gGg==", - "from": "expensify-common@git+ssh://git@github.com/Expensify/expensify-common.git#927c8409e4454e15a1b95ed0a312ff8fee38f0f0", + "version": "git+ssh://git@github.com/Expensify/expensify-common.git#398bf7c6a6d37f229a41d92bd7a4324c0fd32849", + "integrity": "sha512-H7UrLgWIr8mCoPc1oxbeYW2RwLzUWI6jdjbV6cRnrlp8cDW3IyZISF+BQSPFDj7bMhNAbczQPtEOE1gld21Cvg==", + "from": "expensify-common@git+ssh://git@github.com/Expensify/expensify-common.git#398bf7c6a6d37f229a41d92bd7a4324c0fd32849", "requires": { "classnames": "2.3.1", "clipboard": "2.0.4", @@ -74420,7 +74414,7 @@ "simply-deferred": "git+https://github.com/Expensify/simply-deferred.git#77a08a95754660c7bd6e0b6979fdf84e8e831bf5", "string.prototype.replaceall": "^1.0.6", "ua-parser-js": "^1.0.35", - "underscore": "1.13.1" + "underscore": "1.13.6" }, "dependencies": { "prop-types": { @@ -74467,11 +74461,6 @@ "version": "1.0.35", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.35.tgz", "integrity": "sha512-fKnGuqmTBnIE+/KXSzCn4db8RTigUzw1AN0DmdU6hJovUTbYJKyqj+8Mt1c4VfRDnOVJnENmfYkIPZ946UrSAA==" - }, - "underscore": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", - "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==" } } }, @@ -84883,9 +84872,9 @@ "requires": {} }, "react-native-reanimated": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.5.4.tgz", - "integrity": "sha512-8we9LLDO1o4Oj9/DICeEJ2K1tjfqkJagqQUglxeUAkol/HcEJ6PGxIrpBcNryLqCDYEcu6FZWld/FzizBIw6bg==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.6.1.tgz", + "integrity": "sha512-F4vG9Yf9PKmE3GaWtVGUpzj3SM6YY2cx1yRHCwiMd1uY7W0gU017LfcVUorboJnj0y5QZqEriEK1Usq2Y8YZqg==", "requires": { "@babel/plugin-transform-object-assign": "^7.16.7", "@babel/preset-typescript": "^7.16.7", diff --git a/package.json b/package.json index 33882d533cae..0e40d5b3fa23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.13-4", + "version": "1.4.14-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.", @@ -89,7 +89,7 @@ "@rnmapbox/maps": "^10.0.11", "@shopify/flash-list": "^1.6.1", "@types/node": "^18.14.0", - "@ua/react-native-airship": "^15.2.6", + "@ua/react-native-airship": "^15.3.1", "awesome-phonenumber": "^5.4.0", "babel-polyfill": "^6.26.0", "canvas-size": "^1.2.6", @@ -98,7 +98,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#927c8409e4454e15a1b95ed0a312ff8fee38f0f0", + "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#398bf7c6a6d37f229a41d92bd7a4324c0fd32849", "fbjs": "^3.0.2", "htmlparser2": "^7.2.0", "idb-keyval": "^6.2.1", @@ -148,7 +148,7 @@ "react-native-plaid-link-sdk": "10.8.0", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-sqlite": "^8.0.0-beta.2", - "react-native-reanimated": "3.5.4", + "react-native-reanimated": "^3.6.1", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.4.1", "react-native-screens": "3.21.0", diff --git a/patches/react-native-fast-image+8.6.3.patch b/patches/react-native-fast-image+8.6.3+001+initial.patch similarity index 100% rename from patches/react-native-fast-image+8.6.3.patch rename to patches/react-native-fast-image+8.6.3+001+initial.patch diff --git a/patches/react-native-fast-image+8.6.3+002+bitmap-downsampling.patch b/patches/react-native-fast-image+8.6.3+002+bitmap-downsampling.patch new file mode 100644 index 000000000000..a626d5b16b2f --- /dev/null +++ b/patches/react-native-fast-image+8.6.3+002+bitmap-downsampling.patch @@ -0,0 +1,62 @@ +diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewWithUrl.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewWithUrl.java +index 1339f5c..9dfec0c 100644 +--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewWithUrl.java ++++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewWithUrl.java +@@ -176,7 +176,8 @@ class FastImageViewWithUrl extends AppCompatImageView { + .apply(FastImageViewConverter + .getOptions(context, imageSource, mSource) + .placeholder(mDefaultSource) // show until loaded +- .fallback(mDefaultSource)); // null will not be treated as error ++ .fallback(mDefaultSource)) ++ .transform(new ResizeTransformation()); + + if (key != null) + builder.listener(new FastImageRequestListener(key)); +diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/ResizeTransformation.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/ResizeTransformation.java +new file mode 100644 +index 0000000..1daa227 +--- /dev/null ++++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/ResizeTransformation.java +@@ -0,0 +1,41 @@ ++package com.dylanvann.fastimage; ++ ++ import android.content.Context; ++ import android.graphics.Bitmap; ++ ++ import androidx.annotation.NonNull; ++ ++ import com.bumptech.glide.load.Transformation; ++ import com.bumptech.glide.load.engine.Resource; ++ import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; ++ import com.bumptech.glide.load.resource.bitmap.BitmapResource; ++ ++ import java.security.MessageDigest; ++ ++ public class ResizeTransformation implements Transformation { ++ ++ private final double MAX_BYTES = 25000000.0; ++ ++ @NonNull ++ @Override ++ public Resource transform(@NonNull Context context, @NonNull Resource resource, int outWidth, int outHeight) { ++ Bitmap toTransform = resource.get(); ++ ++ if (toTransform.getByteCount() > MAX_BYTES) { ++ double scaleFactor = Math.sqrt(MAX_BYTES / (double) toTransform.getByteCount()); ++ int newHeight = (int) (outHeight * scaleFactor); ++ int newWidth = (int) (outWidth * scaleFactor); ++ ++ BitmapPool pool = GlideApp.get(context).getBitmapPool(); ++ Bitmap scaledBitmap = Bitmap.createScaledBitmap(toTransform, newWidth, newHeight, true); ++ return BitmapResource.obtain(scaledBitmap, pool); ++ } ++ ++ return resource; ++ } ++ ++ @Override ++ public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { ++ messageDigest.update(("ResizeTransformation").getBytes()); ++ } ++ } +\ No newline at end of file diff --git a/src/CONST.ts b/src/CONST.ts index 2733da56e597..2e2f591f7117 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -77,6 +77,12 @@ const CONST = { AVATAR_MAX_WIDTH_PX: 4096, AVATAR_MAX_HEIGHT_PX: 4096, + BREADCRUMB_TYPE: { + ROOT: 'root', + STRONG: 'strong', + NORMAL: 'normal', + }, + DEFAULT_AVATAR_COUNT: 24, OLD_DEFAULT_AVATAR_COUNT: 8, @@ -464,6 +470,7 @@ const CONST = { ONFIDO_TERMS_OF_SERVICE_URL: 'https://onfido.com/terms-of-service/', // Use Environment.getEnvironmentURL to get the complete URL with port number DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:', + EXPENSIFY_INBOX_URL: 'https://www.expensify.com/inbox', SIGN_IN_FORM_WIDTH: 300, @@ -703,7 +710,7 @@ const CONST = { TOOLTIP_SENSE: 1000, TRIE_INITIALIZATION: 'trie_initialization', COMMENT_LENGTH_DEBOUNCE_TIME: 500, - SEARCH_FOR_REPORTS_DEBOUNCE_TIME: 300, + SEARCH_OPTION_LIST_DEBOUNCE_TIME: 300, }, PRIORITY_MODE: { GSD: 'gsd', diff --git a/src/NAVIGATORS.ts b/src/NAVIGATORS.ts index a3a041e65684..c68a950d3501 100644 --- a/src/NAVIGATORS.ts +++ b/src/NAVIGATORS.ts @@ -4,6 +4,7 @@ * */ export default { CENTRAL_PANE_NAVIGATOR: 'CentralPaneNavigator', + LEFT_MODAL_NAVIGATOR: 'LeftModalNavigator', RIGHT_MODAL_NAVIGATOR: 'RightModalNavigator', FULL_SCREEN_NAVIGATOR: 'FullScreenNavigator', } as const; diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index f8d43748b0ae..6a5a657ff72e 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -373,7 +373,7 @@ type OnyxValues = { [ONYXKEYS.NETWORK]: OnyxTypes.Network; [ONYXKEYS.CUSTOM_STATUS_DRAFT]: OnyxTypes.CustomStatusDraft; [ONYXKEYS.INPUT_FOCUSED]: boolean; - [ONYXKEYS.PERSONAL_DETAILS_LIST]: Record; + [ONYXKEYS.PERSONAL_DETAILS_LIST]: OnyxTypes.PersonalDetailsList; [ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails; [ONYXKEYS.TASK]: OnyxTypes.Task; [ONYXKEYS.CURRENCY_LIST]: Record; diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 2cd263237866..9e52ea0a38ca 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -81,10 +81,12 @@ const SCREENS = { SAVE_THE_WORLD: { ROOT: 'SaveTheWorld_Root', }, + LEFT_MODAL: { + SEARCH: 'Search', + }, RIGHT_MODAL: { SETTINGS: 'Settings', NEW_CHAT: 'NewChat', - SEARCH: 'Search', DETAILS: 'Details', PROFILE: 'Profile', REPORT_DETAILS: 'Report_Details', diff --git a/src/components/AddressSearch/index.js b/src/components/AddressSearch/index.js index 3c764b36f3eb..d9e4ef2c0f6e 100644 --- a/src/components/AddressSearch/index.js +++ b/src/components/AddressSearch/index.js @@ -276,6 +276,11 @@ function AddressSearch({ values.state = stateFallback; } + // Set the state to be the same as the city in case the state is empty. + if (_.isEmpty(values.state)) { + values.state = values.city; + } + // Some edge-case addresses may lack both street_number and route in the API response, resulting in an empty "values.street" // We are setting up a fallback to ensure "values.street" is populated with a relevant value if (!values.street && details.adr_address) { diff --git a/src/components/ArchivedReportFooter.tsx b/src/components/ArchivedReportFooter.tsx index 7dadd86debfe..8604d20130c7 100644 --- a/src/components/ArchivedReportFooter.tsx +++ b/src/components/ArchivedReportFooter.tsx @@ -30,14 +30,14 @@ function ArchivedReportFooter({report, reportClosedAction, personalDetails = {}} const originalMessage = reportClosedAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED ? reportClosedAction.originalMessage : null; const archiveReason = originalMessage?.reason ?? CONST.REPORT.ARCHIVE_REASON.DEFAULT; - let displayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, [report.ownerAccountID, 'displayName']); + let displayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails?.[report?.ownerAccountID ?? 0]?.displayName); let oldDisplayName: string | undefined; if (archiveReason === CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED) { const newAccountID = originalMessage?.newAccountID; const oldAccountID = originalMessage?.oldAccountID; - displayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, [newAccountID, 'displayName']); - oldDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, [oldAccountID, 'displayName']); + displayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails?.[newAccountID ?? 0]?.displayName); + oldDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails?.[oldAccountID ?? 0]?.displayName); } const shouldRenderHTML = archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT; diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 13b3b9f1e836..b1af96561ef5 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -4,6 +4,7 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {Animated, Keyboard, View} from 'react-native'; +import {GestureHandlerRootView} from 'react-native-gesture-handler'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import useLocalize from '@hooks/useLocalize'; @@ -425,78 +426,80 @@ function AttachmentModal(props) { }} propagateSwipe > - {props.isSmallScreenWidth && } - downloadAttachment(source)} - shouldShowCloseButton={!props.isSmallScreenWidth} - shouldShowBackButton={props.isSmallScreenWidth} - onBackButtonPress={closeModal} - onCloseButtonPress={closeModal} - shouldShowThreeDotsButton={shouldShowThreeDotsButton} - threeDotsAnchorPosition={styles.threeDotsPopoverOffsetAttachmentModal(windowWidth)} - threeDotsMenuItems={threeDotsMenuItems} - shouldOverlay - /> - - {!_.isEmpty(props.report) && !props.isReceiptAttachment ? ( - - ) : ( - Boolean(sourceForAttachmentView) && - shouldLoadAttachment && ( - + {props.isSmallScreenWidth && } + downloadAttachment(source)} + shouldShowCloseButton={!props.isSmallScreenWidth} + shouldShowBackButton={props.isSmallScreenWidth} + onBackButtonPress={closeModal} + onCloseButtonPress={closeModal} + shouldShowThreeDotsButton={shouldShowThreeDotsButton} + threeDotsAnchorPosition={styles.threeDotsPopoverOffsetAttachmentModal(windowWidth)} + threeDotsMenuItems={threeDotsMenuItems} + shouldOverlay + /> + + {!_.isEmpty(props.report) && !props.isReceiptAttachment ? ( + - ) - )} - - {/* If we have an onConfirm method show a confirmation button */} - {Boolean(props.onConfirm) && ( - - {({safeAreaPaddingBottomStyle}) => ( - -