2018-03-08 20:02:45 +00:00
|
|
|
// Copyright (c) 2004-present, Facebook, Inc.
|
|
|
|
//
|
|
|
|
// This source code is licensed under the MIT license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree.
|
2015-07-21 05:44:42 +00:00
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
#import <React/RCTBridge.h>
|
|
|
|
#import <React/RCTURLRequestHandler.h>
|
2015-07-21 05:44:42 +00:00
|
|
|
|
2015-11-17 17:53:47 +00:00
|
|
|
@interface RCTImageStoreManager : NSObject <RCTURLRequestHandler>
|
2015-07-21 05:44:42 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-17 17:53:47 +00:00
|
|
|
* Set and get cached image data asynchronously. It is safe to call these from any
|
|
|
|
* thread. The callbacks will be called on an unspecified thread.
|
2015-07-21 05:44:42 +00:00
|
|
|
*/
|
2017-10-30 06:10:39 +00:00
|
|
|
- (void)removeImageForTag:(NSString *)imageTag withBlock:(void (^)(void))block;
|
2015-11-17 17:53:47 +00:00
|
|
|
- (void)storeImageData:(NSData *)imageData withBlock:(void (^)(NSString *imageTag))block;
|
|
|
|
- (void)getImageDataForTag:(NSString *)imageTag withBlock:(void (^)(NSData *imageData))block;
|
2015-07-21 05:44:42 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-17 17:53:47 +00:00
|
|
|
* Convenience method to store an image directly (image is converted to data
|
|
|
|
* internally, so any metadata such as scale or orientation will be lost).
|
2015-07-21 05:44:42 +00:00
|
|
|
*/
|
|
|
|
- (void)storeImage:(UIImage *)image withBlock:(void (^)(NSString *imageTag))block;
|
2015-11-17 17:53:47 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface RCTImageStoreManager (Deprecated)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* These methods are deprecated - use the data-based alternatives instead.
|
|
|
|
*/
|
|
|
|
- (NSString *)storeImage:(UIImage *)image __deprecated;
|
|
|
|
- (UIImage *)imageForTag:(NSString *)imageTag __deprecated;
|
|
|
|
- (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image))block __deprecated;
|
2015-07-21 05:44:42 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface RCTBridge (RCTImageStoreManager)
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) RCTImageStoreManager *imageStoreManager;
|
|
|
|
|
|
|
|
@end
|