Skip to content

Commit caad9e7

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Delete never-posted RCTBridge notifications
Summary: Five bridge notifications and three user-info keys have zero posters; only fast refresh is posted and observed. Delete the script-download notifications, `WillBeInvalidated`, and the keys with the dead observers in `RCTDeviceInfo`, the avatar updates module, and both reload perf loggers. Keep the two invalidation notifications Skia and Reanimated still observe, marked deprecated along with `WillReload`. Changelog: [iOS][Removed] - Remove never-posted `RCTBridge` script-download and `WillBeInvalidated` notifications [iOS][Deprecated] - Deprecate never-posted invalidation notifications still observed by Skia and Reanimated Reviewed By: vzaidman Differential Revision: D127294776
1 parent 1e3673a commit caad9e7

3 files changed

Lines changed: 4 additions & 56 deletions

File tree

‎packages/react-native/React/Base/RCTBridgeConstants.h‎

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,22 @@
1515
* DEPRECATED - Use RCTReloadCommand instead. This notification fires just before the bridge starts
1616
* processing a request to reload.
1717
*/
18-
RCT_EXTERN NSString *const RCTBridgeWillReloadNotification;
18+
RCT_EXTERN NSString *const RCTBridgeWillReloadNotification __deprecated_msg("Use RCTReloadCommand instead.");
1919

2020
/**
2121
* This notification fires whenever a fast refresh happens.
2222
*/
2323
RCT_EXTERN NSString *const RCTBridgeFastRefreshNotification;
2424

25-
/**
26-
* This notification fires just before the bridge begins downloading a script
27-
* from the packager.
28-
*/
29-
RCT_EXTERN NSString *const RCTBridgeWillDownloadScriptNotification;
30-
31-
/**
32-
* This notification fires just after the bridge finishes downloading a script
33-
* from the packager.
34-
*/
35-
RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotification;
36-
3725
/**
3826
* This notification fires right after the bridge is about to invalidate NativeModule
3927
* instances during teardown. Handle this notification to perform additional invalidation.
4028
*/
41-
RCT_EXTERN NSString *const RCTBridgeWillInvalidateModulesNotification;
29+
RCT_EXTERN NSString *const RCTBridgeWillInvalidateModulesNotification
30+
__deprecated_msg("Never posted; will be removed.");
4231

4332
/**
4433
* This notification fires right after the bridge finishes invalidating NativeModule
4534
* instances during teardown. Handle this notification to perform additional invalidation.
4635
*/
47-
RCT_EXTERN NSString *const RCTBridgeDidInvalidateModulesNotification;
48-
49-
/**
50-
* This notification fires right before the bridge starting invalidation process.
51-
* Handle this notification to perform additional invalidation.
52-
* The notification can be issued on any thread.
53-
*/
54-
RCT_EXTERN NSString *const RCTBridgeWillBeInvalidatedNotification;
55-
56-
/**
57-
* Key for the RCTSource object in the RCTBridgeDidDownloadScriptNotification
58-
* userInfo dictionary.
59-
*/
60-
RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey;
61-
62-
/**
63-
* Key for the reload reason in the RCTBridgeWillReloadNotification userInfo dictionary.
64-
*/
65-
RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationReasonKey;
66-
67-
/**
68-
* Key for the bridge description (NSString_ in the
69-
* RCTBridgeDidDownloadScriptNotification userInfo dictionary.
70-
*/
71-
RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey;
36+
RCT_EXTERN NSString *const RCTBridgeDidInvalidateModulesNotification __deprecated_msg("Never posted; will be removed.");

‎packages/react-native/React/Base/RCTBridgeConstants.m‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,5 @@
99

1010
NSString *const RCTBridgeWillReloadNotification = @"RCTBridgeWillReloadNotification";
1111
NSString *const RCTBridgeFastRefreshNotification = @"RCTBridgeFastRefreshNotification";
12-
NSString *const RCTBridgeWillDownloadScriptNotification = @"RCTBridgeWillDownloadScriptNotification";
13-
NSString *const RCTBridgeDidDownloadScriptNotification = @"RCTBridgeDidDownloadScriptNotification";
1412
NSString *const RCTBridgeWillInvalidateModulesNotification = @"RCTBridgeWillInvalidateModulesNotification";
1513
NSString *const RCTBridgeDidInvalidateModulesNotification = @"RCTBridgeDidInvalidateModulesNotification";
16-
NSString *const RCTBridgeWillBeInvalidatedNotification = @"RCTBridgeWillBeInvalidatedNotification";
17-
NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey = @"source";
18-
NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey = @"bridgeDescription";

‎packages/react-native/React/CoreModules/RCTDeviceInfo.mm‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ - (void)initialize
116116
object:nil];
117117
#endif
118118

119-
// TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73
120-
// The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure
121-
// and the infrastructure imperatively invoke the `invalidate` method, rather than listening to a notification.
122-
// This is a temporary workaround until we can investigate the issue better as there might be other modules in a
123-
// similar situation.
124-
[[NSNotificationCenter defaultCenter] addObserver:self
125-
selector:@selector(invalidate)
126-
name:RCTBridgeWillInvalidateModulesNotification
127-
object:nil];
128-
129119
[self invalidateCachedConstants];
130120
}
131121

@@ -160,8 +150,6 @@ - (void)_cleanupObservers
160150

161151
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTUserInterfaceStyleDidChangeNotification object:nil];
162152

163-
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
164-
165153
[_applicationWindow removeObserver:self forKeyPath:kFrameKeyPath];
166154

167155
#if TARGET_OS_IOS

0 commit comments

Comments
 (0)