Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/react-native/Libraries/Blob/RCTBlobManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTInitializing.h>
#import <React/RCTURLRequestHandler.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/Libraries/Blob/RCTBlobManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ @implementation RCTBlobManager {

RCT_EXPORT_MODULE(BlobModule)

@synthesize bridge = _bridge;
@synthesize moduleRegistry = _moduleRegistry;
@synthesize methodQueue = _methodQueue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <React/RCTFileReaderModule.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>

#import <React/RCTBlobManager.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTImageURLLoader.h>
#import <React/RCTResizeMode.h>
#import <React/RCTURLRequestHandler.h>
Expand Down
35 changes: 4 additions & 31 deletions packages/react-native/Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ @implementation RCTImageLoader {
__weak id<RCTImageRedirectProtocol> _redirectDelegate;
}

@synthesize bridge = _bridge;
@synthesize moduleRegistry = _moduleRegistry;
@synthesize maxConcurrentLoadingTasks = _maxConcurrentLoadingTasks;
@synthesize maxConcurrentDecodingTasks = _maxConcurrentDecodingTasks;
Expand Down Expand Up @@ -134,13 +133,8 @@ - (void)setUp

_URLRequestQueue = dispatch_queue_create("com.facebook.react.ImageLoaderURLRequestQueue", DISPATCH_QUEUE_SERIAL);

// Get loaders, sorted in reverse priority order (highest priority first)
if (_loadersProvider != nil) {
_loaders = _loadersProvider(self.moduleRegistry);
} else {
RCTAssert(_bridge, @"Trying to find RCTImageURLLoaders and bridge not set.");
_loaders = [_bridge modulesConformingToProtocol:@protocol(RCTImageURLLoader)];
}
RCTAssert(_loadersProvider != nil, @"Trying to find RCTImageURLLoaders and loaders provider not set.");
_loaders = _loadersProvider(self.moduleRegistry);
_loaders =
[_loaders sortedArrayUsingComparator:^NSComparisonResult(id<RCTImageURLLoader> a, id<RCTImageURLLoader> b) {
float priorityA = [a respondsToSelector:@selector(loaderPriority)] ? [a loaderPriority] : 0;
Expand All @@ -154,13 +148,8 @@ - (void)setUp
}
}];

// Get decoders, sorted in reverse priority order (highest priority first)
if (_decodersProvider != nil) {
_decoders = _decodersProvider(self.moduleRegistry);
} else {
RCTAssert(_bridge, @"Trying to find RCTImageDataDecoders and bridge not set.");
_decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)];
}
RCTAssert(_decodersProvider != nil, @"Trying to find RCTImageDataDecoders and decoders provider not set.");
_decoders = _decodersProvider(self.moduleRegistry);
_decoders = [_decoders
sortedArrayUsingComparator:^NSComparisonResult(id<RCTImageDataDecoder> a, id<RCTImageDataDecoder> b) {
float priorityA = [a respondsToSelector:@selector(decoderPriority)] ? [a decoderPriority] : 0;
Expand Down Expand Up @@ -1334,22 +1323,6 @@ - (void)queryCache:(NSArray *)uris resolve:(RCTPromiseResolveBlock)resolve rejec
}
@end

/**
* DEPRECATED!! DO NOT USE
* Instead use `[_bridge moduleForClass:[RCTImageLoader class]]`
*/
@implementation RCTBridge (RCTImageLoader)

- (RCTImageLoader *)imageLoader
{
RCTLogWarn(
@"Calling bridge.imageLoader is deprecated and will not work in newer versions of RN. Please update to the "
"moduleForClass API or turboModuleRegistry API.");
return [self moduleForClass:[RCTImageLoader class]];
}

@end

@implementation RCTBridgeProxy (RCTImageLoader)

- (RCTImageLoader *)imageLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTImageCache.h>
#import <React/RCTImageDataDecoder.h>
#import <React/RCTImageURLLoader.h>
Expand Down
9 changes: 0 additions & 9 deletions packages/react-native/Libraries/Image/RCTImageStoreManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,6 @@ - (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image))

@end

@implementation RCTBridge (RCTImageStoreManager)

- (RCTImageStoreManager *)imageStoreManager
{
return [self moduleForClass:[RCTImageStoreManager class]];
}

@end

@implementation RCTBridgeProxy (RCTImageStoreManager)

- (RCTImageStoreManager *)imageStoreManager
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Image/RCTImageURLLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTResizeMode.h>

NS_ASSUME_NONNULL_BEGIN
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <React/RCTLinkingManager.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
Expand Down Expand Up @@ -36,6 +35,8 @@ @implementation RCTLinkingManager

RCT_EXPORT_MODULE()

@synthesize launchOptions = _launchOptions;

+ (void)postNotificationWithURL:(NSURL *)URL
{
NSDictionary<NSString *, id> *payload = @{@"url" : URL.absoluteString};
Expand Down Expand Up @@ -207,11 +208,10 @@ - (void)canOpenURL:(NSString *)urlString
- (void)getInitialURL:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject
{
NSURL *initialURL = nil;
if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey] != nullptr) {
initialURL = self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
if (self.launchOptions[UIApplicationLaunchOptionsURLKey] != nullptr) {
initialURL = self.launchOptions[UIApplicationLaunchOptionsURLKey];
} else {
NSDictionary *userActivityDictionary =
self.bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
NSDictionary *userActivityDictionary = self.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
if ([userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqual:NSUserActivityTypeBrowsingWeb]) {
initialURL = ((NSUserActivity *)userActivityDictionary[@"UIApplicationLaunchOptionsUserActivityKey"]).webpageURL;
}
Expand Down
14 changes: 2 additions & 12 deletions packages/react-native/Libraries/Network/RCTNetworking.mm
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ - (void)invalidate
return _handlers;
}

NSArray<id<RCTURLRequestHandler>> *newHandlers = _handlersProvider
? _handlersProvider(self.moduleRegistry)
: [self.bridge modulesConformingToProtocol:@protocol(RCTURLRequestHandler)];
RCTAssert(_handlersProvider != nil, @"Trying to find RCTURLRequestHandlers and handlers provider not set.");
NSArray<id<RCTURLRequestHandler>> *newHandlers = _handlersProvider(self.moduleRegistry);

// Get handlers, sorted in reverse priority order (highest priority first)
newHandlers = [newHandlers
Expand Down Expand Up @@ -857,15 +856,6 @@ - (void)clearCookies:(RCTResponseSenderBlock)responseSender

@end

@implementation RCTBridge (RCTNetworking)

- (RCTNetworking *)networking
{
return [self moduleForClass:[RCTNetworking class]];
}

@end

@implementation RCTBridgeProxy (RCTNetworking)

- (RCTNetworking *)networking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#import <UserNotifications/UserNotifications.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTUtils.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <React/RCTSettingsManager.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTUtils.h>
Expand Down
20 changes: 20 additions & 0 deletions packages/react-native/React/Base/RCTBridgeModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@class RCTModuleRegistry;
@class RCTViewRegistry;
@class RCTCallableJSModules;
@class RCTPerformanceLogger;

/**
* The type of a block that is capable of sending a response to a bridged
Expand Down Expand Up @@ -168,6 +169,25 @@ RCT_EXTERN_C_END
*/
@property (nonatomic, weak, readwrite) RCTCallableJSModules *callableJSModules;

/**
* The launch options that were used to initialize the React instance.
* Useful for modules that need to read launch-time configuration.
*
* To implement this in your module, just add `@synthesize launchOptions =
* _launchOptions;`. If using Swift, add `@objc var launchOptions:
* NSDictionary!` to your module.
*/
@property (nonatomic, copy, readwrite) NSDictionary *launchOptions;

/**
* Link to the Performance Logger that logs React Native perf events.
*
* To implement this in your module, just add `@synthesize performanceLogger =
* _performanceLogger;`. If using Swift, add `@objc var performanceLogger:
* RCTPerformanceLogger!` to your module.
*/
@property (nonatomic, strong, readwrite) RCTPerformanceLogger *performanceLogger;

/**
* A reference to the RCTBridge. Useful for modules that require access
* to bridge features, such as sending events or making JS calls. This
Expand Down
7 changes: 6 additions & 1 deletion packages/react-native/React/Base/RCTBridgeModuleDecorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@class RCTBundleManager;
@class RCTCallableJSModules;
@class RCTModuleRegistry;
@class RCTPerformanceLogger;
@class RCTViewRegistry;

/**
Expand All @@ -24,11 +25,15 @@
@property (nonatomic, strong, readonly) RCTModuleRegistry *moduleRegistry;
@property (nonatomic, strong, readonly) RCTBundleManager *bundleManager;
@property (nonatomic, strong, readonly) RCTCallableJSModules *callableJSModules;
@property (nonatomic, copy, readonly) NSDictionary *launchOptions;
@property (nonatomic, strong, readonly) RCTPerformanceLogger *performanceLogger;

- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
bundleManager:(RCTBundleManager *)bundleManager
callableJSModules:(RCTCallableJSModules *)callableJSModules;
callableJSModules:(RCTCallableJSModules *)callableJSModules
launchOptions:(NSDictionary *)launchOptions
performanceLogger:(RCTPerformanceLogger *)performanceLogger;

- (void)attachInteropAPIsToModule:(id<RCTBridgeModule>)bridgeModule;

Expand Down
26 changes: 26 additions & 0 deletions packages/react-native/React/Base/RCTBridgeModuleDecorator.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ - (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
bundleManager:(RCTBundleManager *)bundleManager
callableJSModules:(RCTCallableJSModules *)callableJSModules
launchOptions:(NSDictionary *)launchOptions
performanceLogger:(RCTPerformanceLogger *)performanceLogger
{
if (self = [super init]) {
_viewRegistry_DEPRECATED = viewRegistry;
_moduleRegistry = moduleRegistry;
_bundleManager = bundleManager;
_callableJSModules = callableJSModules;
_launchOptions = [launchOptions copy];
_performanceLogger = performanceLogger;
}
return self;
}
Expand Down Expand Up @@ -68,6 +72,28 @@ - (void)attachInteropAPIsToModule:(id<RCTBridgeModule>)bridgeModule
if ([bridgeModule respondsToSelector:@selector(setModuleRegistry:)]) {
bridgeModule.moduleRegistry = _moduleRegistry;
}

/**
* Attach the launch options to this TurboModule, which allows this TurboModule
* to read the launch-time configuration of the React instance.
*
* Usage: In the TurboModule @implementation, include:
* `@synthesize launchOptions = _launchOptions`
*/
if ([bridgeModule respondsToSelector:@selector(setLaunchOptions:)]) {
bridgeModule.launchOptions = _launchOptions;
}

/**
* Attach the RCTPerformanceLogger to this TurboModule, which allows this
* TurboModule to read React Native perf events.
*
* Usage: In the TurboModule @implementation, include:
* `@synthesize performanceLogger = _performanceLogger`
*/
if ([bridgeModule respondsToSelector:@selector(setPerformanceLogger:)]) {
bridgeModule.performanceLogger = _performanceLogger;
}
}

@end
9 changes: 0 additions & 9 deletions packages/react-native/React/Base/RCTEventDispatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@
return eventName;
}

@implementation RCTBridge (RCTEventDispatcher)

- (id<RCTEventDispatcherProtocol>)eventDispatcher
{
return [self moduleForName:@"EventDispatcher" lazilyLoadIfNecessary:YES];
}

@end

@implementation RCTBridgeProxy (RCTEventDispatcher)

- (id<RCTEventDispatcherProtocol>)eventDispatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,6 @@ void RCTAccessibilityManagerSetIsVoiceOverEnabled(

@end

@implementation RCTBridge (RCTAccessibilityManager)

- (RCTAccessibilityManager *)accessibilityManager
{
return [self moduleForClass:[RCTAccessibilityManager class]];
}

@end

@implementation RCTBridgeProxy (RCTAccessibilityManager)

- (RCTAccessibilityManager *)accessibilityManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>

@interface RCTActionSheetManager : NSObject <RCTBridgeModule>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#if !TARGET_OS_TV

#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTLog.h>
#import <React/RCTUIManager.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/CoreModules/RCTAppState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTAssert.h>
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTInitializing.h>
#import <React/RCTUtils.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTAppearance.h>
#import <React/RCTBridge.h>
#import <React/RCTConstants.h>
#import <React/RCTConvert.h>
#import <React/RCTDefines.h>
Expand Down
Loading
Loading