mark init as designated initializer for RCTNetworking (#41252)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41252

Changelog: [Internal]

let's add compile time guarantee that `RCTNetworking` must go thru `initWithDisabledObservation`.

Reviewed By: cipolleschi

Differential Revision: D50764524

fbshipit-source-id: fcc92411b26343bd5977dbfa1b2e95f0841e4ac8
This commit is contained in:
Phillip Pan
2023-11-01 11:24:57 -07:00
committed by Facebook GitHub Bot
parent 695a30d6b4
commit 052d20058b
2 changed files with 3 additions and 1 deletions
@@ -28,6 +28,8 @@
@interface RCTNetworking : RCTEventEmitter
- (instancetype)init NS_DESIGNATED_INITIALIZER;
/**
* Allows RCTNetworking instances to be initialized with handlers.
* The handlers will be requested via the bridge's moduleForName method when required.
@@ -170,7 +170,7 @@ RCT_EXPORT_MODULE()
- (instancetype)initWithHandlersProvider:
(NSArray<id<RCTURLRequestHandler>> * (^)(RCTModuleRegistry *moduleRegistry))getHandlers
{
if (self = [super initWithDisabledObservation]) {
if (self = [self init]) {
_handlersProvider = getHandlers;
}
return self;