Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Expensify/App into perf/onyx-upgrad…
Browse files Browse the repository at this point in the history
…e-use-cache-directly
  • Loading branch information
hannojg committed Jul 28, 2023
2 parents 4e3de64 + a5373eb commit eec6676
Show file tree
Hide file tree
Showing 42 changed files with 1,045 additions and 814 deletions.
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 1001034601
versionName "1.3.46-1"
versionCode 1001034702
versionName "1.3.47-2"
}

splits {
Expand Down
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.3.46</string>
<string>1.3.47</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.46.1</string>
<string>1.3.47.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</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.3.46</string>
<string>1.3.47</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.46.1</string>
<string>1.3.47.2</string>
</dict>
</plist>
6 changes: 2 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,11 @@ PODS:
- React-Core
- RNReactNativeHapticFeedback (1.14.0):
- React-Core
- RNReanimated (3.4.0):
- RNReanimated (3.1.0):
- DoubleConversion
- FBLazyVector
- FBReactNativeSpec
- glog
- hermes-engine
- RCT-Folly
- RCTRequired
- RCTTypeSafety
Expand All @@ -687,7 +686,6 @@ PODS:
- React-Core/RCTWebSocket
- React-CoreModules
- React-cxxreact
- React-hermes
- React-jsi
- React-jsiexecutor
- React-jsinspector
Expand Down Expand Up @@ -1132,7 +1130,7 @@ SPEC CHECKSUMS:
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
RNPermissions: dcdb7b99796bbeda6975a6e79ad519c41b251b1c
RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c
RNReanimated: 532818a3578a0832d95ea9d0a6a9dc0e73bbce29
RNReanimated: b1220a0e5168745283ff5d53bfc7d2144b2cee1b
RNScreens: 0df01424e9e0ed7827200d6ed1087ddd06c493f9
RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 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.46-1",
"version": "1.3.47-2",
"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 Down Expand Up @@ -123,7 +123,7 @@
"react-native-plaid-link-sdk": "^10.0.0",
"react-native-qrcode-svg": "^6.2.0",
"react-native-quick-sqlite": "^8.0.0-beta.2",
"react-native-reanimated": "3.4.0",
"react-native-reanimated": "3.1.0",
"react-native-render-html": "6.3.1",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "3.17.0",
Expand Down
177 changes: 177 additions & 0 deletions patches/react-native-reanimated+3.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
diff --git a/node_modules/react-native-reanimated/ios/REANodesManager.mm b/node_modules/react-native-reanimated/ios/REANodesManager.mm
index 26bb253..4108293 100644
--- a/node_modules/react-native-reanimated/ios/REANodesManager.mm
+++ b/node_modules/react-native-reanimated/ios/REANodesManager.mm
@@ -85,19 +85,77 @@ - (void)runSyncUIUpdatesWithObserver:(id<RCTUIManagerObserver>)observer

@end

-@interface REANodesManager () <RCTUIManagerObserver>
+#ifndef RCT_NEW_ARCH_ENABLED

+@interface REASyncUpdateObserver : NSObject <RCTUIManagerObserver>
@end

+@implementation REASyncUpdateObserver {
+ volatile void (^_mounting)(void);
+ volatile BOOL _waitTimedOut;
+ dispatch_semaphore_t _semaphore;
+}
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ _mounting = nil;
+ _waitTimedOut = NO;
+ _semaphore = dispatch_semaphore_create(0);
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ RCTAssert(_mounting == nil, @"Mouting block was set but never executed. This may lead to UI inconsistencies");
+}
+
+- (void)unblockUIThread
+{
+ RCTAssertUIManagerQueue();
+ dispatch_semaphore_signal(_semaphore);
+}
+
+- (void)waitAndMountWithTimeout:(NSTimeInterval)timeout
+{
+ RCTAssertMainQueue();
+ long result = dispatch_semaphore_wait(_semaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC));
+ if (result != 0) {
+ @synchronized(self) {
+ _waitTimedOut = YES;
+ }
+ }
+ if (_mounting) {
+ _mounting();
+ _mounting = nil;
+ }
+}
+
+- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
+{
+ RCTAssertUIManagerQueue();
+ @synchronized(self) {
+ if (_waitTimedOut) {
+ return NO;
+ } else {
+ _mounting = block;
+ return YES;
+ }
+ }
+}
+
+@end
+
+#endif
+
@implementation REANodesManager {
CADisplayLink *_displayLink;
BOOL _wantRunUpdates;
NSMutableArray<REAOnAnimationCallback> *_onAnimationCallbacks;
BOOL _tryRunBatchUpdatesSynchronously;
REAEventHandler _eventHandler;
- volatile void (^_mounting)(void);
- NSObject *_syncLayoutUpdatesWaitLock;
- volatile BOOL _syncLayoutUpdatesWaitTimedOut;
NSMutableDictionary<NSNumber *, ComponentUpdate *> *_componentUpdateBuffer;
NSMutableDictionary<NSNumber *, UIView *> *_viewRegistry;
#ifdef RCT_NEW_ARCH_ENABLED
@@ -125,7 +183,6 @@ - (nonnull instancetype)initWithModule:(REAModule *)reanimatedModule
_operationsInBatch = [NSMutableDictionary new];
_componentUpdateBuffer = [NSMutableDictionary new];
_viewRegistry = [_uiManager valueForKey:@"_viewRegistry"];
- _syncLayoutUpdatesWaitLock = [NSObject new];
}

_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)];
@@ -241,19 +298,6 @@ - (void)onAnimationFrame:(CADisplayLink *)displayLink
}
}

-- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
-{
- RCTAssert(_mounting == nil, @"Mouting block is expected to not be set");
- @synchronized(_syncLayoutUpdatesWaitLock) {
- if (_syncLayoutUpdatesWaitTimedOut) {
- return NO;
- } else {
- _mounting = block;
- return YES;
- }
- }
-}
-
- (void)performOperations
{
#ifdef RCT_NEW_ARCH_ENABLED
@@ -268,8 +312,7 @@ - (void)performOperations
_tryRunBatchUpdatesSynchronously = NO;

__weak __typeof__(self) weakSelf = self;
- dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
- _syncLayoutUpdatesWaitTimedOut = NO;
+ REASyncUpdateObserver *syncUpdateObserver = [REASyncUpdateObserver new];
RCTExecuteOnUIManagerQueue(^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf == nil) {
@@ -278,7 +321,7 @@ - (void)performOperations
BOOL canUpdateSynchronously = trySynchronously && ![strongSelf.uiManager hasEnqueuedUICommands];

if (!canUpdateSynchronously) {
- dispatch_semaphore_signal(semaphore);
+ [syncUpdateObserver unblockUIThread];
}

for (int i = 0; i < copiedOperationsQueue.count; i++) {
@@ -286,8 +329,8 @@ - (void)performOperations
}

if (canUpdateSynchronously) {
- [strongSelf.uiManager runSyncUIUpdatesWithObserver:strongSelf];
- dispatch_semaphore_signal(semaphore);
+ [strongSelf.uiManager runSyncUIUpdatesWithObserver:syncUpdateObserver];
+ [syncUpdateObserver unblockUIThread];
}
// In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event
// to observers because some components (e.g. TextInput) update their UIViews only on that event.
@@ -298,17 +341,7 @@ - (void)performOperations
// from CADisplayLink but it is easier to hardcode it for the time being.
// The reason why we use frame duration here is that if takes longer than one frame to complete layout tasks
// there is no point of synchronizing layout with the UI interaction as we get that one frame delay anyways.
- long result = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, 16 * NSEC_PER_MSEC));
- if (result != 0) {
- @synchronized(_syncLayoutUpdatesWaitLock) {
- _syncLayoutUpdatesWaitTimedOut = YES;
- }
- }
- }
-
- if (_mounting) {
- _mounting();
- _mounting = nil;
+ [syncUpdateObserver waitAndMountWithTimeout:0.016];
}
}
_wantRunUpdates = NO;
diff --git a/node_modules/react-native-reanimated/mock.js b/node_modules/react-native-reanimated/mock.js
index 68b20d2..b088001 100644
--- a/node_modules/react-native-reanimated/mock.js
+++ b/node_modules/react-native-reanimated/mock.js
@@ -41,6 +41,9 @@ const Reanimated = {
createAnimatedComponent: (Component) => Component,
addWhitelistedUIProps: NOOP,
addWhitelistedNativeProps: NOOP,
+
+ // used by react-navigation fork
+ isConfigured: () => true,
};

module.exports = {
2 changes: 1 addition & 1 deletion src/components/AttachmentCarousel/CarouselActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Carousel(props) {
unsubscribeRightKey();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [props.onCycleThroughAttachments]);

return null;
}
Expand Down
25 changes: 25 additions & 0 deletions src/components/AttachmentCarousel/attachmentCarouselPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import PropTypes from 'prop-types';
import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes';
import reportPropTypes from '../../pages/reportPropTypes';

const propTypes = {
/** source is used to determine the starting index in the array of attachments */
source: PropTypes.string,

/** Callback to update the parent modal's state with a source and name from the attachments array */
onNavigate: PropTypes.func,

/** Object of report actions for this report */
reportActions: PropTypes.shape(reportActionPropTypes),

/** The report currently being looked at */
report: reportPropTypes.isRequired,
};

const defaultProps = {
source: '',
reportActions: {},
onNavigate: () => {},
};

export {propTypes, defaultProps};
Loading

0 comments on commit eec6676

Please sign in to comment.