Digital PCT265 story MVAPCT-48 - exposing constants.

This commit is contained in:
Scott Pfeil 2024-04-04 17:33:05 -04:00
parent 64aba6a100
commit 19c277d68e
2 changed files with 9 additions and 3 deletions

View File

@ -12,6 +12,9 @@
#import <AVKit/AVKit.h>
@class MVMCoreErrorObject;
extern NSString * _Nonnull const KeyCachePolicy;
extern NSString * _Nonnull const KeyCacheExpiry;
//block returned when getting image
//parameters are UIImage object for the image, NSData for gif images, UIImage object for the image, A BOOL to indicate if it is a fall back image.
typedef void(^MVMCoreGetImageBlock)(UIImage * _Nullable, NSData * _Nullable, BOOL);

View File

@ -17,6 +17,9 @@
#import "MVMCoreErrorConstants.h"
#import "MVMCoreLoggingHandlerHelper.h"
NSString * _Nonnull const KeyCachePolicy = @"cachePolicy";
NSString * _Nonnull const KeyCacheExpiry = @"expiry";
@interface MVMCoreCache ()
// The cache for json.
@ -113,13 +116,13 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
}
- (nonnull NSDate *)getExpirationDateForJSON:(nonnull NSDictionary *)jsonDictionary {
NSDictionary *cachePolicy = [jsonDictionary dict:@"cachePolicy"];
NSTimeInterval interval = [[cachePolicy string:@"expiry"] doubleValue] / 1000;
NSDictionary *cachePolicy = [jsonDictionary dict:KeyCachePolicy];
NSTimeInterval interval = [[cachePolicy string:KeyCacheExpiry] doubleValue] / 1000;
return [NSDate dateWithTimeIntervalSince1970:interval];
}
- (BOOL)shouldPersistentlyCacheJSON:(nonnull NSDictionary *)jsonDictionary {
NSDictionary *cachePolicy = [jsonDictionary dict:@"cachePolicy"];
NSDictionary *cachePolicy = [jsonDictionary dict:KeyCachePolicy];
if (!cachePolicy || ![cachePolicy boolForKey:@"persist"]) {
return NO;
}