Add object detection, tracking, mobile notifications, and search to any security camera.
purchase on launch
roryclear3f38aea397a8
diff --git a/clearcam.xcodeproj/project.pbxproj b/clearcam.xcodeproj/project.pbxprojindex bc69257..1f54c58 100644--- a/clearcam.xcodeproj/project.pbxproj+++ b/clearcam.xcodeproj/project.pbxproj@@ -7,11 +7,13 @@objects = {/* Begin PBXBuildFile section */+ BE0FD6782D839FFE005C4A06 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE0FD6772D839FFE005C4A06 /* StoreKit.framework */; };BEA6777C2D5CEFE300271B4F /* SegmentsModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BEA6777A2D5CEFE300271B4F /* SegmentsModel.xcdatamodeld */; };/* End PBXBuildFile section *//* Begin PBXFileReference section */BE007DCA2D2BFF36005D40B3 /* clearcam.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = clearcam.app; sourceTree = BUILT_PRODUCTS_DIR; };+ BE0FD6772D839FFE005C4A06 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };BEA6777B2D5CEFE300271B4F /* SegmentsModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SegmentsModel.xcdatamodel; sourceTree = "<group>"; };/* End PBXFileReference section */@@ -41,6 +43,7 @@isa = PBXFrameworksBuildPhase;buildActionMask = 2147483647;files = (+ BE0FD6782D839FFE005C4A06 /* StoreKit.framework in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;};@@ -52,6 +55,7 @@children = (BEA6777A2D5CEFE300271B4F /* SegmentsModel.xcdatamodeld */,BE007DCC2D2BFF36005D40B3 /* clearcam */,+ BE0FD6762D839FFE005C4A06 /* Frameworks */,BE007DCB2D2BFF36005D40B3 /* Products */,);sourceTree = "<group>";@@ -64,6 +68,14 @@name = Products;sourceTree = "<group>";};+ BE0FD6762D839FFE005C4A06 /* Frameworks */ = {+ isa = PBXGroup;+ children = (+ BE0FD6772D839FFE005C4A06 /* StoreKit.framework */,+ );+ name = Frameworks;+ sourceTree = "<group>";+ };/* End PBXGroup section *//* Begin PBXNativeTarget section */diff --git a/clearcam/StoreManager.h b/clearcam/StoreManager.hnew file mode 100644index 0000000..f5e6087--- /dev/null+++ b/clearcam/StoreManager.h@@ -0,0 +1,17 @@+//+// StoreManager.h+// clearcam+//+// Created by Rory Clear on 13/03/2025.+//+++#import <Foundation/Foundation.h>+#import <StoreKit/StoreKit.h>++@interface StoreManager : NSObject <SKProductsRequestDelegate, SKPaymentTransactionObserver>+++ (instancetype)sharedInstance;+- (void)fetchAndPurchaseProduct;++@enddiff --git a/clearcam/StoreManager.m b/clearcam/StoreManager.mnew file mode 100644index 0000000..5a62787--- /dev/null+++ b/clearcam/StoreManager.m@@ -0,0 +1,103 @@+#import "StoreManager.h"++@interface StoreManager ()+@property (nonatomic, strong) SKProductsRequest *productsRequest;+@property (nonatomic, strong) SKProduct *premiumProduct;+@end++@implementation StoreManager+++ (instancetype)sharedInstance {+ static StoreManager *sharedInstance = nil;+ static dispatch_once_t onceToken;+ dispatch_once(&onceToken, ^{+ sharedInstance = [[self alloc] init];+ });+ return sharedInstance;+}++- (instancetype)init {+ self = [super init];+ if (self) {+ [[SKPaymentQueue defaultQueue] addTransactionObserver:self];+ }+ return self;+}++- (void)fetchAndPurchaseProduct {+ NSSet *productIdentifiers = [NSSet setWithObject:@"monthly.premium"];+ self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];+ self.productsRequest.delegate = self;+ [self.productsRequest start];+}++#pragma mark - SKProductsRequestDelegate++- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {+ NSLog(@"β Received response from App Store.");++ if (response.invalidProductIdentifiers.count > 0) {+ NSLog(@"π¨ Invalid product IDs: %@", response.invalidProductIdentifiers);+ }++ if (response.products.count == 0) {+ NSLog(@"π¨ No valid products found! Double-check subscription status in App Store Connect.");+ return;+ }++ // Print details of the subscription+ for (SKProduct *product in response.products) {+ NSLog(@"β Found product: %@", product.productIdentifier);+ NSLog(@"Title: %@", product.localizedTitle);+ NSLog(@"Description: %@", product.localizedDescription);+ NSLog(@"Price: %@", product.price);+ }++ self.premiumProduct = response.products.firstObject;+ [self purchaseProduct];+}+++- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {+ NSLog(@"Failed to fetch products: %@", error.localizedDescription);+}++#pragma mark - Purchase Product++- (void)purchaseProduct {+ if ([SKPaymentQueue canMakePayments] && self.premiumProduct) {+ SKPayment *payment = [SKPayment paymentWithProduct:self.premiumProduct];+ [[SKPaymentQueue defaultQueue] addPayment:payment];+ } else {+ NSLog(@"Purchases are disabled on this device.");+ }+}++#pragma mark - SKPaymentTransactionObserver++- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions {+ for (SKPaymentTransaction *transaction in transactions) {+ switch (transaction.transactionState) {+ case SKPaymentTransactionStatePurchased:+ NSLog(@"Purchase successful!");+ [[SKPaymentQueue defaultQueue] finishTransaction:transaction];+ break;++ case SKPaymentTransactionStateFailed:+ NSLog(@"Purchase failed: %@", transaction.error.localizedDescription);+ [[SKPaymentQueue defaultQueue] finishTransaction:transaction];+ break;++ case SKPaymentTransactionStateRestored:+ NSLog(@"Purchase restored.");+ [[SKPaymentQueue defaultQueue] finishTransaction:transaction];+ break;++ default:+ break;+ }+ }+}++@end+