Remove debug info
This commit is contained in:
parent
c0ab21e728
commit
4bf56cd8f1
@ -765,10 +765,10 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
- (void)dvAssetLoaderDelegate:(DVAssetLoaderDelegate *)loaderDelegate
|
- (void)dvAssetLoaderDelegate:(DVAssetLoaderDelegate *)loaderDelegate
|
||||||
didLoadData:(NSData *)data
|
didLoadData:(NSData *)data
|
||||||
forURL:(NSURL *)url {
|
forURL:(NSURL *)url {
|
||||||
NSLog(@"File size is : %.2f MB",(float)data.length/1024.0f/1024.0f);
|
|
||||||
[_videoCache storeItem:data forUri:[url absoluteString] withCallback:^(BOOL success) {
|
[_videoCache storeItem:data forUri:[url absoluteString] withCallback:^(BOOL success) {
|
||||||
|
#ifdef DEBUG
|
||||||
NSLog(@"data stored succesfully 🎉");
|
NSLog(@"data stored succesfully 🎉");
|
||||||
|
#endif
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
withIntermediateDirectories:YES
|
withIntermediateDirectories:YES
|
||||||
attributes:nil
|
attributes:nil
|
||||||
error:&error];
|
error:&error];
|
||||||
|
#ifdef DEBUG
|
||||||
if (!success || error) {
|
if (!success || error) {
|
||||||
NSLog(@"Error! %@", error);
|
NSLog(@"Error while! %@", error);
|
||||||
} else {
|
|
||||||
NSLog(@"Success!");
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)storeItem:(NSData *)data forUri:(NSString *)uri withCallback:(void(^)(BOOL))handler;
|
- (void)storeItem:(NSData *)data forUri:(NSString *)uri withCallback:(void(^)(BOOL))handler;
|
||||||
@ -60,9 +60,11 @@
|
|||||||
[self saveDataToTemporaryStorage:data key:key];
|
[self saveDataToTemporaryStorage:data key:key];
|
||||||
[self.videoCache storeData:data forKey:key locked:NO withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
|
[self.videoCache storeData:data forKey:key locked:NO withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
|
#ifdef DEBUG
|
||||||
NSLog(@"An error occured while saving the video into the cache: %@", [response.error localizedDescription]);
|
NSLog(@"An error occured while saving the video into the cache: %@", [response.error localizedDescription]);
|
||||||
handler(NO);
|
handler(NO);
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
handler(YES);
|
handler(YES);
|
||||||
} onQueue:dispatch_get_main_queue()];
|
} onQueue:dispatch_get_main_queue()];
|
||||||
@ -74,10 +76,8 @@
|
|||||||
|
|
||||||
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:temporaryFilePath];
|
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:temporaryFilePath];
|
||||||
if (!fileExists) {
|
if (!fileExists) {
|
||||||
NSLog(@"Temporary file does not exist");
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
NSLog(@"Temporary file does exist");
|
|
||||||
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;
|
||||||
@ -85,7 +85,6 @@
|
|||||||
|
|
||||||
- (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];
|
||||||
NSLog(@"Temporary path %@", temporaryFilePath);
|
|
||||||
[data writeToFile:temporaryFilePath atomically:YES];
|
[data writeToFile:temporaryFilePath atomically:YES];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -93,23 +92,17 @@
|
|||||||
- (void)getItemForUri:(NSString *)uri withCallback:(void(^)(AVAsset * _Nullable)) handler {
|
- (void)getItemForUri:(NSString *)uri withCallback:(void(^)(AVAsset * _Nullable)) handler {
|
||||||
NSString * key = [[self generateHashForUrl:uri] stringByAppendingPathExtension: [uri pathExtension]];
|
NSString * key = [[self generateHashForUrl:uri] stringByAppendingPathExtension: [uri pathExtension]];
|
||||||
|
|
||||||
NSLog(@"LOADING FROM TEMPORARY STORAGE %@", key);
|
|
||||||
AVURLAsset * temporaryAsset = [self getItemFromTemporaryStorage:key];
|
AVURLAsset * temporaryAsset = [self getItemFromTemporaryStorage:key];
|
||||||
if (temporaryAsset != nil) {
|
if (temporaryAsset != nil) {
|
||||||
NSLog(@"FOUND IN TEMPORARY STORAGE");
|
|
||||||
handler(temporaryAsset);
|
handler(temporaryAsset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSLog(@"NOT FOUND IN TEMPORARY STORAGE");
|
|
||||||
NSLog(@"LOAD FROM PERSISTENT STORAGE");
|
|
||||||
|
|
||||||
[self.videoCache loadDataForKey:key withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
|
[self.videoCache loadDataForKey:key withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
|
||||||
if (response.record == nil || response.record.data == nil) {
|
if (response.record == nil || response.record.data == nil) {
|
||||||
NSLog(@"NOT FOUND IN PERSISTENT STORAGE");
|
|
||||||
handler(nil);
|
handler(nil);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSLog(@"FOUND IN PERSISTENT -> SAVE TO TEMPORARY");
|
|
||||||
[self saveDataToTemporaryStorage:response.record.data key:key];
|
[self saveDataToTemporaryStorage:response.record.data key:key];
|
||||||
handler([self getItemFromTemporaryStorage:key]);
|
handler([self getItemFromTemporaryStorage:key]);
|
||||||
} onQueue:dispatch_get_main_queue()];
|
} onQueue:dispatch_get_main_queue()];
|
||||||
@ -130,4 +123,3 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user