Skip to content

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

less session spam

roryclear3cc3dd27ecfd
diff --git a/clearcam/SettingsViewController.m b/clearcam/SettingsViewController.m
index d9c7698..a6a66df 100644
--- a/clearcam/SettingsViewController.m
+++ b/clearcam/SettingsViewController.m
@@ -34,8 +34,8 @@
self.view.backgroundColor = [UIColor systemBackgroundColor];
self.title = @"Settings";
- // Check subscription status on view load
- [self checkSubscriptionStatus];
+ if(![[NSUserDefaults standardUserDefaults] boolForKey:@"isSubscribed"] || ![[NSDate date] compare:[[NSUserDefaults standardUserDefaults] objectForKey:@"expiry"]] || [[NSDate date] compare:[[NSUserDefaults standardUserDefaults] objectForKey:@"expiry"]] == NSOrderedDescending) [self checkSubscriptionStatus];
+ NSLog(@"%d %@",[[NSUserDefaults standardUserDefaults] boolForKey:@"isSubscribed"],[[NSUserDefaults standardUserDefaults] objectForKey:@"expiry"]);
// Register for subscription status change notifications
[[NSNotificationCenter defaultCenter] addObserver:self
diff --git a/clearcam/StoreManager.m b/clearcam/StoreManager.m
index 25ef3cd..d65545f 100644
--- a/clearcam/StoreManager.m
+++ b/clearcam/StoreManager.m
@@ -188,6 +188,7 @@ NSString *const StoreManagerSubscriptionStatusDidChangeNotification = @"StoreMan
if (sessionToken && [sessionToken isKindOfClass:[NSString class]]) {
// Store session token in Keychain
[self storeSessionTokenInKeychain:sessionToken];
+ [[NSUserDefaults standardUserDefaults] setObject:[NSDate dateWithTimeIntervalSinceNow:45 * 60] forKey:@"expiry"];
NSLog(@"Stored session token: %@", sessionToken);
} else {
NSLog(@"Warning: No valid session_token in response.");