1 // Copyright 2015-present 650 Industries. All rights reserved. 2 3 #import <Foundation/Foundation.h> 4 5 #import "EXResourceLoader.h" 6 7 NS_ASSUME_NONNULL_BEGIN 8 9 @interface EXCachedResource : NSObject <EXResourceLoader> 10 11 @property (nonatomic, strong) NSURL *remoteUrl; 12 @property (nonatomic, assign) BOOL shouldVersionCache; 13 @property (nonatomic, strong, nullable) NSString *abiVersion; 14 @property (nonatomic, strong) NSURLCache *urlCache; 15 @property (nonatomic, assign) NSTimeInterval requestTimeoutInterval; 16 @property (nonatomic, strong, nullable) NSString *releaseChannel; 17 18 - (instancetype)initWithResourceName:(NSString *)resourceName 19 resourceType:(NSString *)resourceType 20 remoteUrl:(NSURL *)url 21 cachePath:(NSString * _Nullable)cachePath; 22 23 /** 24 * Filesystem path to the downloaded and cached copy of this resource. 25 */ 26 - (NSString *)resourceCachePath; 27 /** 28 * NSBundle path to the embedded copy of this resource. 29 */ 30 - (NSString *)resourceBundlePath; 31 /** 32 * Indicates whether or not local copies of this resource are loaded from the NSBundle 33 * rather than the cache. 34 */ 35 - (BOOL)isUsingEmbeddedResource; 36 37 - (NSError *)_validateResponseData:(NSData *)data response:(NSURLResponse *)response; 38 - (NSError *)_validateErrorData:(NSError *)error response:(NSURLResponse *)response; 39 40 /** 41 * Returns whether a cache was removed. 42 */ 43 - (BOOL)removeCache; 44 45 @end 46 47 NS_ASSUME_NONNULL_END 48