Add object detection, tracking, mobile notifications, and search to any security camera.
Gallery (#133)
Rory Clear037cc4993558
diff --git a/ios/clearcam/GalleryViewController.m b/ios/clearcam/GalleryViewController.mindex b9afb97..146ab4e 100644--- a/ios/clearcam/GalleryViewController.m+++ b/ios/clearcam/GalleryViewController.m@@ -15,9 +15,6 @@@property (nonatomic, strong) UILabel *titleLabel;@end-@interface GalleryViewController () <UITableViewDelegate, UITableViewDataSource, QLPreviewControllerDataSource, QLPreviewControllerDelegate>-@end-@implementation VideoTableViewCell- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {@@ -245,6 +242,7 @@userInfo:nilrepeats:YES];[self updateInternetStatus];+ [self getEvents];}- (void)appDidBecomeActive {@@ -495,7 +493,9 @@}- (void)getEvents {- if (self.isLoadingVideos) self.isLoadingVideos = NO;+ if (self.isLoadingVideos) {+ return;+ }self.isLoadingVideos = YES;NSURLComponents *components = [NSURLComponents componentsWithString:@"https://clearcam.org/events"];NSString *sessionToken = [[StoreManager sharedInstance] retrieveSessionTokenFromKeychain];@@ -520,6 +520,7 @@if (error) {dispatch_async(dispatch_get_main_queue(), ^{self.isLoadingVideos = NO;+ [self.refreshControl endRefreshing];});return;}@@ -541,6 +542,7 @@- (void)downloadFiles:(NSArray<NSString *> *)fileURLs {if (fileURLs.count == 0) {self.isLoadingVideos = NO;+ [self.refreshControl endRefreshing];return;}self.isLoadingVideos = YES;@@ -565,6 +567,7 @@}dispatch_group_notify(downloadGroup, dispatch_get_main_queue(), ^{self.isLoadingVideos = NO;+ [self.refreshControl endRefreshing];});}@@ -632,10 +635,7 @@NSString *outputFilePath = filePath;if ([file hasSuffix:@".aes"]) {NSData *encryptedData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:filePath] options:0 error:&error];- if (!encryptedData) {- [self showErrorAlertWithMessage:[NSString stringWithFormat:@"Failed to read the file: %@", error.localizedDescription]];- return;- }+ if (!encryptedData) return;NSArray<NSString *> *storedKeys = [[SecretManager sharedManager] getAllDecryptionKeys];NSData *decryptedData = nil;for (NSString *key in storedKeys) {@@ -647,16 +647,10 @@outputFilePath = [self.downloadDirectory stringByAppendingPathComponent:outputFilename];NSError *writeError = nil;BOOL success = [decryptedData writeToFile:outputFilePath options:NSDataWritingAtomic error:&writeError];- if (!success) {- [self showErrorAlertWithMessage:[NSString stringWithFormat:@"Failed to write decrypted file: %@", writeError.localizedDescription]];- return;- }+ if (!success) return;NSError *deleteError = nil;BOOL removed = [[NSFileManager defaultManager] removeItemAtPath:filePath error:&deleteError];- if (!removed) {- [self showErrorAlertWithMessage:[NSString stringWithFormat:@"Failed to delete original encrypted file: %@", deleteError.localizedDescription]];- return;- }+ if (!removed) return;}}