123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*
- * 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 <React/RCTImageURLLoader.h>
- #import <React/RCTImageLoaderProtocol.h>
- // TODO (T61325135): Remove C++ checks
- #ifdef __cplusplus
- namespace facebook {
- namespace react {
- struct ImageURLLoaderAttribution {
- int32_t nativeViewTag = 0;
- int32_t surfaceId = 0;
- };
- } // namespace react
- } // namespace facebook
- #endif
- @interface RCTImageURLLoaderRequest : NSObject
- @property (nonatomic, strong, readonly) NSString *requestId;
- @property (nonatomic, strong, readonly) NSURL *imageURL;
- @property (nonatomic, copy, readonly) RCTImageLoaderCancellationBlock cancellationBlock;
- - (instancetype)initWithRequestId:(NSString *)requestId imageURL:(NSURL *)imageURL cancellationBlock:(RCTImageLoaderCancellationBlock)cancellationBlock;
- - (void)cancel;
- @end
- /**
- * Same as the RCTImageURLLoader interface, but allows passing in optional `attribution` information.
- * This is useful for per-app logging and other instrumentation.
- */
- @protocol RCTImageURLLoaderWithAttribution <RCTImageURLLoader>
- // TODO (T61325135): Remove C++ checks
- #ifdef __cplusplus
- /**
- * Same as the RCTImageURLLoader variant above, but allows optional `attribution` information.
- * Caller may also specify a preferred requestId for tracking purpose.
- */
- - (RCTImageURLLoaderRequest *)loadImageForURL:(NSURL *)imageURL
- size:(CGSize)size
- scale:(CGFloat)scale
- resizeMode:(RCTResizeMode)resizeMode
- requestId:(NSString *)requestId
- priority: (RCTImageLoaderPriority)priority
- attribution:(const facebook::react::ImageURLLoaderAttribution &)attribution
- progressHandler:(RCTImageLoaderProgressBlock)progressHandler
- partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler
- completionHandler:(RCTImageLoaderCompletionBlock)completionHandler;
- #endif
- /**
- * Image instrumentation - notify that the image content (UIImage) has been set on the native view.
- */
- - (void)trackURLImageContentDidSetForRequest:(RCTImageURLLoaderRequest *)loaderRequest;
- /**
- * 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 native image view was destroyed.
- */
- - (void)trackURLImageDidDestroy:(RCTImageURLLoaderRequest *)loaderRequest;
- @end
|