Add object detection, tracking, mobile notifications, and search to any security camera.
start email stuff
roryclear3870035efeb4
diff --git a/clearcam/SceneState.h b/clearcam/SceneState.hindex 4548ace..3d478b7 100644--- a/clearcam/SceneState.h+++ b/clearcam/SceneState.h@@ -9,6 +9,7 @@@property (nonatomic, strong) NSArray<NSNumber *> *events;@property (nonatomic, strong) NSDictionary *alerts;@property (strong, nonatomic) NSManagedObjectContext *backgroundContext;+@property (strong, nonatomic) NSDate *last_email_time;- (void)processOutput:(NSArray *)array withImage:(CIImage *)image;- (void)writeToFileWithString:(NSString *)customString;diff --git a/clearcam/SceneState.m b/clearcam/SceneState.mindex 5d63dc6..c30d11c 100644--- a/clearcam/SceneState.m+++ b/clearcam/SceneState.m@@ -11,6 +11,7 @@self.lastN_total = [[NSMutableDictionary alloc] init];self.events = [SettingsManager sharedManager].events;self.alerts = [SettingsManager sharedManager].alerts;+ self.last_email_time = [NSDate dateWithTimeIntervalSince1970:0];// Get Core Data context from AppDelegateAppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];@@ -89,6 +90,13 @@} else {NSLog(@"Failed to create CGImage from CIImage");}++ if (self.last_email_time && [[NSDate date] timeIntervalSinceDate:self.last_email_time] > 3600) { // only once per hour, enforce server side!+ self.last_email_time = [NSDate date]; // Set to now+ NSLog(@"sending email");+ } else {+ NSLog(@"NOT sending an email");+ }[self.backgroundContext performBlockAndWait:^{NSManagedObject *newEvent = [NSEntityDescription insertNewObjectForEntityForName:@"EventEntity"