Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/41952
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictb committed Jun 17, 2024
2 parents e355bcc + 2ac6dd6 commit d1fc0b3
Show file tree
Hide file tree
Showing 256 changed files with 2,093 additions and 1,626 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const restrictedImportPaths = [
name: 'date-fns/locale',
message: "Do not import 'date-fns/locale' directly. Please use the submodule import instead, like 'date-fns/locale/en-GB'.",
},
{
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.",
},
];

const restrictedImportPatterns = [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: android-sourcemap
path: android/app/build/generated/sourcemaps/react/release/*.map
path: android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map

- name: Upload Android version to GitHub artifacts
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
Expand Down
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 1001048301
versionName "1.4.83-1"
versionCode 1001048402
versionName "1.4.84-2"
// 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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ buildscript {
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
classpath("com.google.firebase:perf-plugin:1.4.1")
// Fullstory integration
classpath ("com.fullstory:gradle-plugin-local:1.47.0")
classpath ("com.fullstory:gradle-plugin-local:1.49.0")

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
10 changes: 7 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ const defaultPlugins = [
'@babel/transform-runtime',
'@babel/plugin-proposal-class-properties',

// This will serve to map the classes correctly in FullStory
'@fullstory/babel-plugin-annotate-react',
[
'@fullstory/babel-plugin-annotate-react',
{
'react-native-web': true,
native: true,
},
],

// We use `transform-class-properties` for transforming ReactNative libraries and do not use it for our own
// source code transformation as we do not use class property assignment.
Expand Down Expand Up @@ -45,7 +50,6 @@ const metro = {
'@fullstory/babel-plugin-annotate-react',
{
native: true,
setFSTagName: true,
},
],

Expand Down
46 changes: 0 additions & 46 deletions contributingGuides/STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
- [Forwarding refs](#forwarding-refs)
- [Hooks and HOCs](#hooks-and-hocs)
- [Stateless components vs Pure Components vs Class based components vs Render Props](#stateless-components-vs-pure-components-vs-class-based-components-vs-render-props---when-to-use-what)
- [Composition](#composition)
- [Use Refs Appropriately](#use-refs-appropriately)
- [Are we allowed to use [insert brand new React feature]?](#are-we-allowed-to-use-insert-brand-new-react-feature-why-or-why-not)
- [React Hooks: Frequently Asked Questions](#react-hooks-frequently-asked-questions)
Expand Down Expand Up @@ -1094,51 +1093,6 @@ Class components are DEPRECATED. Use function components and React hooks.

[https://react.dev/reference/react/Component#migrating-a-component-with-lifecycle-methods-from-a-class-to-a-function](https://react.dev/reference/react/Component#migrating-a-component-with-lifecycle-methods-from-a-class-to-a-function)

### Composition

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.

From React's documentation -
>Props and composition give you all the flexibility you need to customize a component’s look and behavior in an explicit and safe way. Remember that components may accept arbitrary props, including primitive values, React elements, or functions.
>If you want to reuse non-UI functionality between components, we suggest extracting it into a separate JavaScript module. The components may import it and use that function, object, or a class, without extending it.

```ts
// BAD
export default compose(
withCurrentUserPersonalDetails,
withReportOrNotFound(),
withOnyx<ComponentProps, ComponentOnyxProps>({
session: {
key: ONYXKEYS.SESSION,
},
}),
)(Component);

// GOOD
export default withCurrentUserPersonalDetails(
withReportOrNotFound()(
withOnyx<ComponentProps, ComponentOnyxProps>({
session: {
key: ONYXKEYS.SESSION,
},
})(Component),
),
);

// GOOD - alternative to HOC nesting
const ComponentWithOnyx = withOnyx<ComponentProps, ComponentOnyxProps>({
session: {
key: ONYXKEYS.SESSION,
},
})(Component);
const ComponentWithReportOrNotFound = withReportOrNotFound()(ComponentWithOnyx);
export default withCurrentUserPersonalDetails(ComponentWithReportOrNotFound);
```

**Note:** If you find that none of these approaches work for you, please ask an Expensify engineer for guidance via Slack or GitHub.

### Use Refs Appropriately

React's documentation explains refs in [detail](https://reactjs.org/docs/refs-and-the-dom.html). It's important to understand when to use them and how to use them to avoid bugs and hard to maintain code.
Expand Down
5 changes: 5 additions & 0 deletions ios/.xcode.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)

# Provide a sourcemap path so that in release builds a source map file will be
# created at the specified location.
# (RN's default behaviour on iOS is to skip creating a sourcemap file):
export SOURCEMAP_FILE="$(pwd)/../main.jsbundle.map";
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.83</string>
<string>1.4.84</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.83.1</string>
<string>1.4.84.2</string>
<key>FullStory</key>
<dict>
<key>OrgId</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.4.83</string>
<string>1.4.84</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.83.1</string>
<string>1.4.84.2</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleShortVersionString</key>
<string>1.4.83</string>
<string>1.4.84</string>
<key>CFBundleVersion</key>
<string>1.4.83.1</string>
<string>1.4.84.2</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ target 'NotificationServiceExtension' do
pod 'AirshipServiceExtension'
end

pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz'
pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz'
22 changes: 11 additions & 11 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ PODS:
- GoogleUtilities/Environment (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- fmt (6.2.1)
- FullStory (1.48.0)
- FullStory (1.49.0)
- fullstory_react-native (1.4.2):
- FullStory (~> 1.14)
- glog
Expand Down Expand Up @@ -1852,7 +1852,7 @@ PODS:
- RNGoogleSignin (10.0.1):
- GoogleSignIn (~> 7.0)
- React-Core
- RNLiveMarkdown (0.1.83):
- RNLiveMarkdown (0.1.85):
- glog
- hermes-engine
- RCT-Folly (= 2022.05.16.00)
Expand All @@ -1870,9 +1870,9 @@ PODS:
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNLiveMarkdown/common (= 0.1.83)
- RNLiveMarkdown/common (= 0.1.85)
- Yoga
- RNLiveMarkdown/common (0.1.83):
- RNLiveMarkdown/common (0.1.85):
- glog
- hermes-engine
- RCT-Folly (= 2022.05.16.00)
Expand Down Expand Up @@ -2098,7 +2098,7 @@ DEPENDENCIES:
- ExpoImageManipulator (from `../node_modules/expo-image-manipulator/ios`)
- ExpoModulesCore (from `../node_modules/expo-modules-core`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- "FullStory (from `{:http=>\"https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz\"}`)"
- "FullStory (from `{:http=>\"https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz\"}`)"
- "fullstory_react-native (from `../node_modules/@fullstory/react-native`)"
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
Expand Down Expand Up @@ -2263,7 +2263,7 @@ EXTERNAL SOURCES:
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
FullStory:
:http: https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz
:http: https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz
fullstory_react-native:
:path: "../node_modules/@fullstory/react-native"
glog:
Expand Down Expand Up @@ -2458,7 +2458,7 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
FullStory:
:http: https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz
:http: https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz

SPEC CHECKSUMS:
Airship: 5a6d3f8a982398940b0d48423bb9b8736717c123
Expand All @@ -2485,7 +2485,7 @@ SPEC CHECKSUMS:
FirebasePerformance: 0c01a7a496657d7cea86d40c0b1725259d164c6c
FirebaseRemoteConfig: 2d6e2cfdb49af79535c8af8a80a4a5009038ec2b
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
FullStory: 097347c823c21c655ca25fd8d5e6355a9326ec54
FullStory: c95f74445f871bc344cdc4a4e4ece61b5554e55d
fullstory_react-native: 6cba8a2c054374a24a44dc4310407d9435459cae
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
GoogleAppMeasurement: 5ba1164e3c844ba84272555e916d0a6d3d977e91
Expand Down Expand Up @@ -2589,7 +2589,7 @@ SPEC CHECKSUMS:
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 74b7b3d06d667ba0bbf41da7718f2607ae0dfe8f
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
RNLiveMarkdown: 88030b7d9a31f5f6e67743df48ad952d64513b4a
RNLiveMarkdown: fff70dc755ed8199a449f61e76cbadec7cd20440
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c
RNPermissions: 0b61d30d21acbeafe25baaa47d9bae40a0c65216
Expand All @@ -2606,8 +2606,8 @@ SPEC CHECKSUMS:
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2
VisionCamera: 1394a316c7add37e619c48d7aa40b38b954bf055
Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312

PODFILE CHECKSUM: 66a5c97ae1059e4da1993a4ad95abe5d819f555b
PODFILE CHECKSUM: d5e281e5370cb0211a104efd90eb5fa7af936e14

COCOAPODS: 1.13.0
32 changes: 16 additions & 16 deletions package-lock.json

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

Loading

0 comments on commit d1fc0b3

Please sign in to comment.