Code style cleanups

This commit is contained in:
Hampton Maxwell 2018-08-08 15:34:07 -07:00
parent 9d22835343
commit 8084b160d5

View File

@ -7,8 +7,7 @@
@synthesize cacheIdentifier; @synthesize cacheIdentifier;
@synthesize temporaryCachePath; @synthesize temporaryCachePath;
+ (RCTVideoCache *) sharedInstance + (RCTVideoCache *)sharedInstance {
{
static RCTVideoCache *sharedInstance = nil; static RCTVideoCache *sharedInstance = nil;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
@ -41,9 +40,8 @@
return self; return self;
} }
- (void) createTemporaryPath - (void) createTemporaryPath {
{ NSError *error = nil;
NSError * error = nil;
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:self.temporaryCachePath BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:self.temporaryCachePath
withIntermediateDirectories:YES withIntermediateDirectories:YES
attributes:nil attributes:nil
@ -77,19 +75,19 @@
} }
- (AVURLAsset *)getItemFromTemporaryStorage:(NSString *)key { - (AVURLAsset *)getItemFromTemporaryStorage:(NSString *)key {
NSString * temporaryFilePath =[self.temporaryCachePath stringByAppendingPathComponent:key]; NSString * temporaryFilePath = [self.temporaryCachePath stringByAppendingPathComponent:key];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:temporaryFilePath]; BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:temporaryFilePath];
if (!fileExists) { if (!fileExists) {
return nil; return nil;
} }
NSURL * assetUrl = [[NSURL alloc] initFileURLWithPath:temporaryFilePath]; NSURL *assetUrl = [[NSURL alloc] initFileURLWithPath:temporaryFilePath];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:assetUrl options:nil]; AVURLAsset *asset = [AVURLAsset URLAssetWithURL:assetUrl options:nil];
return asset; return asset;
} }
- (BOOL)saveDataToTemporaryStorage:(NSData *)data key:(NSString *)key { - (BOOL)saveDataToTemporaryStorage:(NSData *)data key:(NSString *)key {
NSString * temporaryFilePath = [self.temporaryCachePath stringByAppendingPathComponent:key]; NSString *temporaryFilePath = [self.temporaryCachePath stringByAppendingPathComponent:key];
[data writeToFile:temporaryFilePath atomically:YES]; [data writeToFile:temporaryFilePath atomically:YES];
return YES; return YES;
} }
@ -159,7 +157,7 @@
} }
} }
- (NSString *) generateHashForUrl:(NSString *)string { - (NSString *)generateHashForUrl:(NSString *)string {
const char *cStr = [string UTF8String]; const char *cStr = [string UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH]; unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, (CC_LONG)strlen(cStr), result ); CC_MD5( cStr, (CC_LONG)strlen(cStr), result );