Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

Ios load (#163)

Rory Clearda288875336a
diff --git a/ios/clearcam/GalleryViewController.m b/ios/clearcam/GalleryViewController.m
index ac28b93..6592ce5 100644
--- a/ios/clearcam/GalleryViewController.m
+++ b/ios/clearcam/GalleryViewController.m
@@ -81,7 +81,6 @@
@property (nonatomic, strong) NSMutableArray<NSString *> *sectionTitles;
@property (nonatomic, strong) UIRefreshControl *refreshControl;
@property (nonatomic, strong) NSMutableSet<NSString *> *loadedFilenames;
-@property (nonatomic, strong) NSTimer *refreshTimer;
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, strong) FileServer *fileServer;
@property (nonatomic, strong) NSURL *previewItemURL;
@@ -228,7 +227,6 @@
[self setupDownloadDirectory];
[self loadExistingVideos];
[self updateTableViewBackground];
- [self setupRefreshTimer];
self.statusTimer = [NSTimer scheduledTimerWithTimeInterval:10.0
target:self
@@ -266,25 +264,10 @@
}
- (void)dealloc {
- [self.refreshTimer invalidate];
- self.refreshTimer = nil;
[self.statusTimer invalidate];
self.statusTimer = nil;
}
-- (void)setupRefreshTimer {
- self.refreshTimer = [NSTimer scheduledTimerWithTimeInterval:10.0
- target:self
- selector:@selector(refreshTimerFired)
- userInfo:nil
- repeats:YES];
-}
-
-- (void)refreshTimerFired {
- [self getEvents];
-}
-
-
- (void)updateTableViewBackground {
if (self.videoFiles.count == 0) {
UILabel *messageLabel = [[UILabel alloc] initWithFrame:self.eventsViewController.view.bounds];
@@ -366,8 +349,6 @@
self.previewItemURL = [NSURL fileURLWithPath:tempPath];
QLPreviewController *previewController = [[QLPreviewController alloc] init];
- previewController.dataSource = self;
- previewController.delegate = self;
[self presentViewController:previewController animated:YES completion:nil];
}
@@ -401,7 +382,7 @@
// Setup refresh control for events
self.refreshControl = [[UIRefreshControl alloc] init];
- [self.refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
+ [self.refreshControl addTarget:self action:@selector(getEvents) forControlEvents:UIControlEventValueChanged];
if (@available(iOS 10.0, *)) {
self.tableView.refreshControl = self.refreshControl;
} else {
@@ -411,7 +392,7 @@
- (void)setupRefreshControl {
self.refreshControl = [[UIRefreshControl alloc] init];
- [self.refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
+ [self.refreshControl addTarget:self action:@selector(getEvents) forControlEvents:UIControlEventValueChanged];
if (@available(iOS 10.0, *)) {
self.tableView.refreshControl = self.refreshControl;
} else {
@@ -419,10 +400,6 @@
}
}
-- (void)handleRefresh {
- [self getEvents];
-}
-
- (void)setupDownloadDirectory {
NSString *documentsDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
self.downloadDirectory = [documentsDir stringByAppendingPathComponent:@"downloaded-events"];
@@ -530,9 +507,6 @@
[downloadQueue addOperationWithBlock:^{
[self downloadSingleFile:fileURL completion:^(BOOL success) {
if (success) {
- NSURL *url = [NSURL URLWithString:fileURL];
- NSString *fileName = url.lastPathComponent;
- NSString *fullPath = [self.downloadDirectory stringByAppendingPathComponent:fileName];
dispatch_async(dispatch_get_main_queue(), ^{
[self loadExistingVideos];
});
@@ -547,8 +521,6 @@
}
-
-
- (void)downloadSingleFile:(NSString *)fileURL completion:(void(^)(BOOL success))completion {
NSURL *url = [NSURL URLWithString:fileURL];
NSString *saveFileName = [url lastPathComponent];