RCTImageLoaderWithAttributionProtocol.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <UIKit/UIKit.h>
  8. #import <React/RCTImageLoaderProtocol.h>
  9. #import <React/RCTImageURLLoaderWithAttribution.h>
  10. RCT_EXTERN BOOL RCTImageLoadingInstrumentationEnabled(void);
  11. RCT_EXTERN BOOL RCTImageLoadingPerfInstrumentationEnabled(void);
  12. RCT_EXTERN void RCTEnableImageLoadingInstrumentation(BOOL enabled);
  13. RCT_EXTERN void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled);
  14. @protocol RCTImageLoaderWithAttributionProtocol<RCTImageLoaderProtocol>
  15. // TODO (T61325135): Remove C++ checks
  16. #ifdef __cplusplus
  17. /**
  18. * Same as the variant in RCTImageURLLoaderProtocol, but allows passing attribution
  19. * information that each image URL loader can process.
  20. */
  21. - (RCTImageURLLoaderRequest *)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest
  22. size:(CGSize)size
  23. scale:(CGFloat)scale
  24. clipped:(BOOL)clipped
  25. resizeMode:(RCTResizeMode)resizeMode
  26. priority: (RCTImageLoaderPriority)priority
  27. attribution:(const facebook::react::ImageURLLoaderAttribution &)attribution
  28. progressBlock:(RCTImageLoaderProgressBlock)progressBlock
  29. partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock
  30. completionBlock:(RCTImageLoaderCompletionBlock)completionBlock;
  31. #endif
  32. /**
  33. * Image instrumentation - notify that the image content (UIImage) has been set on the native view.
  34. */
  35. - (void)trackURLImageContentDidSetForRequest:(RCTImageURLLoaderRequest *)loaderRequest;
  36. /**
  37. * Image instrumentation - start tracking the on-screen visibility of the native image view.
  38. */
  39. - (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(UIView *)imageView;
  40. /**
  41. * Image instrumentation - notify that the native image view was destroyed.
  42. */
  43. - (void)trackURLImageDidDestroy:(RCTImageURLLoaderRequest *)loaderRequest;
  44. @end