Add object detection, tracking, mobile notifications, and search to any security camera.
can open pgp from downloads kinda
roryclearb78df3b1bf10
diff --git a/clearcam/SceneDelegate.m b/clearcam/SceneDelegate.mindex 0840507..7e04ffb 100644--- a/clearcam/SceneDelegate.m+++ b/clearcam/SceneDelegate.m@@ -54,30 +54,63 @@}- (void)handlePGPFileAtURL:(NSURL *)url {- // Decrypt the .pgp file using the PGP class- NSString *encryptedFilePath = url.path;+ if (!url) {+ NSLog(@"Error: URL is nil.");+ return;+ }++ // Start accessing security-scoped resource (for iCloud/Downloads files)+ BOOL isSecured = [url startAccessingSecurityScopedResource];+ if (!isSecured) {+ NSLog(@"Error: Unable to access security-scoped resource.");+ return;+ }++ // Get the path to the app's Documents directory+ NSURL *documentsDirectoryURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject];++ // Destination path inside the app's Documents directory+ NSURL *localPGPFileURL = [documentsDirectoryURL URLByAppendingPathComponent:url.lastPathComponent];++ // Check if file is already in Documents, otherwise copy it+ if (![url.path isEqualToString:localPGPFileURL.path]) {+ NSError *copyError = nil;+ [[NSFileManager defaultManager] copyItemAtURL:url toURL:localPGPFileURL error:©Error];++ if (copyError) {+ NSLog(@"Error copying file: %@", copyError.localizedDescription);+ [url stopAccessingSecurityScopedResource]; // Stop access before returning+ return;+ }+ }++ // Stop accessing the security-scoped resource after copying+ [url stopAccessingSecurityScopedResource];++ // Decrypt the copied .pgp file using your PGP class+ NSString *encryptedFilePath = localPGPFileURL.path;[self.pgp decryptImageWithPrivateKey:encryptedFilePath];-+// Get the path to the decrypted .jpg fileNSString *decryptedFilePath = [[encryptedFilePath stringByDeletingPathExtension] stringByAppendingPathExtension:@"jpg"];NSURL *decryptedFileURL = [NSURL fileURLWithPath:decryptedFilePath];-+// Check if the decrypted file existsif ([[NSFileManager defaultManager] fileExistsAtPath:decryptedFilePath]) {// Create a UIDocumentInteractionController for the decrypted fileself.docController = [UIDocumentInteractionController interactionControllerWithURL:decryptedFileURL];-+// Set the delegate to selfself.docController.delegate = self;-+// Present the document interaction controller from the root view controller[self.docController presentPreviewAnimated:YES];} else {- // If the file doesn't exist, log an error or show an alertNSLog(@"Decrypted file not found at %@", decryptedFilePath);}}+#pragma mark - UIDocumentInteractionControllerDelegate- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {diff --git a/clearcam/SceneState.m b/clearcam/SceneState.mindex 6cbff58..9de20f6 100644--- a/clearcam/SceneState.m+++ b/clearcam/SceneState.m@@ -92,7 +92,7 @@if (self.last_email_time && [[NSDate date] timeIntervalSinceDate:self.last_email_time] > 300) { // only once per hour? enforce server side!self.last_email_time = [NSDate date]; // Set to nowNSLog(@"sending email");- [self sendEmailWithImageAtPath:filePath encryptImage:NO];+ [self sendEmailWithImageAtPath:filePath encryptImage:YES];} else {NSLog(@"NOT sending an email");}