mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
e37708dfb6
Summary: When shouldEnableLoggingForRequestUrl is false, ImageTelemetry is not initialized, and no logging is done. * Replace `- (NSString *)loaderModuleNameForRequestUrl:(NSURL *)url` with `- (BOOL)shouldEnableLoggingForRequestUrl:(NSURL *)url` * Rename RCTImageLoaderInstrumentableProtocol.h -> RCTImageLoaderLoggableProtocol.h Reviewed By: fkgozali Differential Revision: D24523984 fbshipit-source-id: a5463eceea1c40f9452b0ad2ee6bf047f71a02c1
57 lines
2.4 KiB
Objective-C
57 lines
2.4 KiB
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <React/RCTImageLoaderProtocol.h>
|
|
#import <React/RCTImageURLLoaderWithAttribution.h>
|
|
|
|
RCT_EXTERN BOOL RCTImageLoadingInstrumentationEnabled(void);
|
|
RCT_EXTERN BOOL RCTImageLoadingPerfInstrumentationEnabled(void);
|
|
RCT_EXTERN void RCTEnableImageLoadingInstrumentation(BOOL enabled);
|
|
RCT_EXTERN void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled);
|
|
|
|
RCT_EXTERN BOOL RCTGetImageLoadingPerfInstrumentationForFabricEnabled();
|
|
RCT_EXTERN void RCTSetImageLoadingPerfInstrumentationForFabricEnabledBlock(BOOL (^getEnabled)());
|
|
|
|
@protocol RCTImageLoaderWithAttributionProtocol<RCTImageLoaderProtocol, RCTImageLoaderLoggableProtocol>
|
|
|
|
// TODO (T61325135): Remove C++ checks
|
|
#ifdef __cplusplus
|
|
/**
|
|
* Same as the variant in RCTImageURLLoaderProtocol, but allows passing attribution
|
|
* information that each image URL loader can process.
|
|
*/
|
|
- (RCTImageURLLoaderRequest *)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest
|
|
size:(CGSize)size
|
|
scale:(CGFloat)scale
|
|
clipped:(BOOL)clipped
|
|
resizeMode:(RCTResizeMode)resizeMode
|
|
priority: (RCTImageLoaderPriority)priority
|
|
attribution:(const facebook::react::ImageURLLoaderAttribution &)attribution
|
|
progressBlock:(RCTImageLoaderProgressBlock)progressBlock
|
|
partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock
|
|
completionBlock:(RCTImageLoaderCompletionBlockWithMetadata)completionBlock;
|
|
#endif
|
|
|
|
/**
|
|
* Image instrumentation - start tracking the on-screen visibility of the native image view.
|
|
*/
|
|
- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(UIView *)imageView;
|
|
|
|
/**
|
|
* Image instrumentation - notify that the request was cancelled.
|
|
*/
|
|
- (void)trackURLImageRequestDidDestroy:(RCTImageURLLoaderRequest *)loaderRequest;
|
|
|
|
/**
|
|
* Image instrumentation - notify that the native image view was destroyed.
|
|
*/
|
|
- (void)trackURLImageDidDestroy:(RCTImageURLLoaderRequest *)loaderRequest;
|
|
|
|
@end
|