Add object detection, tracking, mobile notifications, and search to any security camera.
turn camera off and deslop
roryclear56e8bad1b9c3
diff --git a/clearcam/StoreManager.m b/clearcam/StoreManager.mindex 0c7266f..65aa001 100644--- a/clearcam/StoreManager.m+++ b/clearcam/StoreManager.m@@ -33,25 +33,17 @@ NSString *const StoreManagerSubscriptionStatusDidChangeNotification = @"StoreMan- (void)fetchAndPurchaseProduct {if (self.premiumProduct) {- // Product info already available, proceed to purchase[self purchaseProduct:self.premiumProduct];} else {- // Fetch the product info first, and *then* call purchase.- NSLog(@"Premium product info not yet fetched. Fetching now for purchase...");[self getPremiumProductInfo:^(SKProduct * _Nullable product, NSError * _Nullable error) {- // Ensure UI updates potentially triggered by purchase alerts run on main threaddispatch_async(dispatch_get_main_queue(), ^{if (product) {[self purchaseProduct:product];} else {- // Handle error - maybe show an alert?- NSLog(@"Failed to get product info for purchase: %@", error.localizedDescription);- // Consider showing an error alert here, maybe via a notification or delegate.UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Error"message:@"Could not retrieve product information. Please try again later."preferredStyle:UIAlertControllerStyleAlert];[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];- // Find the top view controller to present the alertUIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;while (topController.presentedViewController) {topController = topController.presentedViewController;@@ -87,18 +79,13 @@ NSString *const StoreManagerSubscriptionStatusDidChangeNotification = @"StoreManNSLog(@"Received product response.");if (response.products.count > 0) {self.premiumProduct = response.products.firstObject;- NSLog(@"Premium product fetched: %@", self.premiumProduct.localizedTitle);-- // If there's a completion handler waiting for product info (from getPremiumProductInfo), call it.if (self.productInfoCompletionHandler) {- // Ensure handler is called on main thread if it involves UI updates laterdispatch_async(dispatch_get_main_queue(), ^{self.productInfoCompletionHandler(self.premiumProduct, nil);- self.productInfoCompletionHandler = nil; // Clear the handler+ self.productInfoCompletionHandler = nil;});}} else {- NSLog(@"No products found.");NSError *error = [NSError errorWithDomain:@"StoreManagerError" code:101 userInfo:@{NSLocalizedDescriptionKey: @"No products found."}];if (self.productInfoCompletionHandler) {dispatch_async(dispatch_get_main_queue(), ^{@@ -107,20 +94,17 @@ NSString *const StoreManagerSubscriptionStatusDidChangeNotification = @"StoreMan});}}- // Clean up the request objectself.productsRequest.delegate = nil;self.productsRequest = nil;}- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {- NSLog(@"Failed to fetch products: %@", error.localizedDescription);if (self.productInfoCompletionHandler) {dispatch_async(dispatch_get_main_queue(), ^{self.productInfoCompletionHandler(nil, error);self.productInfoCompletionHandler = nil; // Clear the handler});}- // Clean up the request objectself.productsRequest.delegate = nil;self.productsRequest = nil;}@@ -129,12 +113,8 @@ NSString *const StoreManagerSubscriptionStatusDidChangeNotification = @"StoreMan- (void)purchaseProduct:(SKProduct *)product {if ([SKPaymentQueue canMakePayments] && product) {- NSLog(@"Initiating purchase for: %@", product.localizedTitle);SKPayment *payment = [SKPayment paymentWithProduct:product];[[SKPaymentQueue defaultQueue] addPayment:payment];- } else {- NSLog(@"Cannot make payments or product is nil.");- // Maybe show an alert to the user here?}}diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 5414dcd..16b9dc4 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -105,17 +105,12 @@ NSMutableDictionary *classColorMap;[self.captureSession startRunning];[self startNewRecording];[self setupUI];-- // Log initial stateUIDeviceOrientation initialOrientation = [self getCurrentOrientation];- NSLog(@"viewDidLoad - Initial orientation: %ld", (long)initialOrientation);}- (void)setInitialOrientation {UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];AVCaptureVideoOrientation videoOrientation;-- // Fallback to status bar orientation if device orientation is ambiguousif (deviceOrientation == UIDeviceOrientationUnknown || deviceOrientation == UIDeviceOrientationFaceUp || deviceOrientation == UIDeviceOrientationFaceDown) {UIInterfaceOrientation statusBarOrientation = UIApplication.sharedApplication.statusBarOrientation;if (statusBarOrientation == UIInterfaceOrientationLandscapeLeft) {@@ -159,7 +154,6 @@ NSMutableDictionary *classColorMap;[self setVideoOrientationForOrientation:initialOrientation];self.previewLayer.frame = self.view.bounds;[self updateButtonFrames];- NSLog(@"viewWillAppear - Orientation: %ld, Record button frame: %@", (long)initialOrientation, NSStringFromCGRect(self.recordButton.frame));}- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {@@ -516,7 +510,6 @@ NSMutableDictionary *classColorMap;if (orientation == UIDeviceOrientationPortraitUpsideDown ||orientation == UIDeviceOrientationFaceUp ||orientation == UIDeviceOrientationFaceDown) {- NSLog(@"updateButtonFrames - Skipping layout for ignored orientation: %ld", (long)orientation);return;}if (orientation == UIDeviceOrientationLandscapeRight) {@@ -612,6 +605,7 @@ NSMutableDictionary *classColorMap;- (void)viewWillDisappear:(BOOL)animated {[super viewWillDisappear:animated];+ [self.captureSession stopRunning];// Enable auto-locking (important!)[UIApplication sharedApplication].idleTimerDisabled = NO;}