Skip to content

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

dont send notifs right after live

roryclear054615d003a3
diff --git a/clearcam/SceneState.h b/clearcam/SceneState.h
index 9d60fa0..2d36f13 100644
--- a/clearcam/SceneState.h
+++ b/clearcam/SceneState.h
@@ -10,6 +10,7 @@
@property (nonatomic, strong) NSDictionary *alerts;
@property (strong, nonatomic) NSManagedObjectContext *backgroundContext;
@property (strong, nonatomic) NSDate *last_notif_time;
+@property (strong, nonatomic) NSDate *left_live_time;
- (void)processOutput:(NSArray *)array withImage:(CIImage *)image orientation:(AVCaptureVideoOrientation)orientation;
- (void)sendnotification; //todo, remove
diff --git a/clearcam/SceneState.m b/clearcam/SceneState.m
index c6eda2f..a1da875 100644
--- a/clearcam/SceneState.m
+++ b/clearcam/SceneState.m
@@ -20,7 +20,7 @@
self.lastN_total = [[NSMutableDictionary alloc] init];
self.alerts = [SettingsManager sharedManager].alerts;
self.last_notif_time = [NSDate dateWithTimeIntervalSince1970:0];
-
+ self.left_live_time = [NSDate now];
// Get Core Data context from AppDelegate
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
self.backgroundContext = appDelegate.persistentContainer.newBackgroundContext;
@@ -151,6 +151,7 @@
- (void)sendnotification {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"send_notif_enabled"] || !([[NSUserDefaults standardUserDefaults] boolForKey:@"isSubscribed"] || [[NSUserDefaults standardUserDefaults] boolForKey:@"use_own_server_enabled"])){ //todo add back other stuff
NSDate *now = [NSDate date];
+ if ([now timeIntervalSinceDate:self.left_live_time] < 5.0) return;
[FileServer sharedInstance].last_req_time = [NSDate now]; //todo, this keep segment length 3 for a min
NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitWeekday) fromDate:now];
NSInteger currentTime = components.hour * 60 + components.minute;
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.m
index 4921ea4..67a1f69 100644
--- a/clearcam/ViewController.m
+++ b/clearcam/ViewController.m
@@ -1295,6 +1295,7 @@ NSMutableDictionary *classColorMap;
}
} else {
if (self.isStreaming) {
+ self.scene.left_live_time = [NSDate now];
self.isStreaming = NO;
[self refreshView];
NSLog(@"no link");