Add object detection, tracking, mobile notifications, and search to any security camera.
Mainscreen (#59)
Rory Clear7d6fd66f10fd
diff --git a/clearcam.xcodeproj/project.pbxproj b/clearcam.xcodeproj/project.pbxprojindex 8304955..4b885a1 100644--- a/clearcam.xcodeproj/project.pbxproj+++ b/clearcam.xcodeproj/project.pbxproj@@ -125,6 +125,7 @@es,ja,ko,+ hi,);mainGroup = BE007DC12D2BFF36005D40B3;minimizedProjectReferenceProxies = 1;@@ -182,7 +183,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 1.2.1;+ MARKETING_VERSION = 1.2.2;PRODUCT_BUNDLE_IDENTIFIER = roryclear.clearcam;PRODUCT_NAME = "$(TARGET_NAME)";SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";@@ -215,7 +216,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 1.2.1;+ MARKETING_VERSION = 1.2.2;PRODUCT_BUNDLE_IDENTIFIER = roryclear.clearcam;PRODUCT_NAME = "$(TARGET_NAME)";SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";diff --git a/clearcam/FileServer.m b/clearcam/FileServer.mindex b787591..8c5a721 100644--- a/clearcam/FileServer.m+++ b/clearcam/FileServer.m@@ -56,6 +56,9 @@self.basePath = [self getDocumentsDirectory];self.durationCache = [[NSMutableDictionary alloc] init];if ([[NSUserDefaults standardUserDefaults] boolForKey:@"stream_via_wifi_enabled"]) [self startServer];+ if ([[NSUserDefaults standardUserDefaults] objectForKey:@"stream_via_wifi_enabled"] == nil) {+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"stream_via_wifi_enabled"];+ }}- (void)dealloc {diff --git a/clearcam/MainViewController.h b/clearcam/MainViewController.hnew file mode 100644index 0000000..c9bfd23--- /dev/null+++ b/clearcam/MainViewController.h@@ -0,0 +1,8 @@+#import <UIKit/UIKit.h>++NS_ASSUME_NONNULL_BEGIN++@interface MainViewController : UIViewController+@end++NS_ASSUME_NONNULL_ENDdiff --git a/clearcam/MainViewController.m b/clearcam/MainViewController.mnew file mode 100644index 0000000..bcefa06--- /dev/null+++ b/clearcam/MainViewController.m@@ -0,0 +1,192 @@+// MainViewController.m+#import "MainViewController.h"+#import "ViewController.h"+#import "GalleryViewController.h"+#import "SettingsViewController.h"+#import "FileServer.h"++@interface MainViewController ()+@property (nonatomic, strong) FileServer *fileServer;+@property (nonatomic, strong) UILabel *ipLabel;+@property (nonatomic, strong) UIStackView *mainStackView;+@property (nonatomic, strong) NSLayoutConstraint *mainStackViewTopToIPLabelConstraint;+@property (nonatomic, strong) NSLayoutConstraint *mainStackViewTopToSafeAreaConstraint;+@end++@implementation MainViewController++- (void)viewDidLoad {+ [super viewDidLoad];++ self.fileServer = [FileServer sharedInstance];+ [self.fileServer start];++ self.view.backgroundColor = (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark)+ ? [UIColor blackColor]+ : [UIColor whiteColor];++ self.title = @"Clearcam";+ self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"home", nil)+ style:UIBarButtonItemStylePlain+ target:nil+ action:nil];++ // Setup IP label+ self.ipLabel = [[UILabel alloc] init];+ self.ipLabel.translatesAutoresizingMaskIntoConstraints = NO;+ self.ipLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];+ self.ipLabel.textColor = [UIColor secondaryLabelColor];+ self.ipLabel.textAlignment = NSTextAlignmentCenter;+ self.ipLabel.numberOfLines = 1;+ [self.view addSubview:self.ipLabel];++ [NSLayoutConstraint activateConstraints:@[+ [self.ipLabel.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:10],+ [self.ipLabel.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:20],+ [self.ipLabel.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-20]+ ]];++ // Stack View setup+ self.mainStackView = [[UIStackView alloc] init];+ self.mainStackView.axis = UILayoutConstraintAxisVertical;+ self.mainStackView.distribution = UIStackViewDistributionFillEqually;+ self.mainStackView.alignment = UIStackViewAlignmentFill;+ self.mainStackView.spacing = 20;+ self.mainStackView.translatesAutoresizingMaskIntoConstraints = NO;+ [self.view addSubview:self.mainStackView];++ // Create the two possible top constraints for the stack view+ // The constant for mainStackViewTopToIPLabelConstraint should ensure there's enough space below the label+ self.mainStackViewTopToIPLabelConstraint = [self.mainStackView.topAnchor constraintEqualToAnchor:self.ipLabel.bottomAnchor constant:20]; // Keep original constant+ self.mainStackViewTopToSafeAreaConstraint = [self.mainStackView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:20]; // Keep original constant++ [NSLayoutConstraint activateConstraints:@[+ [self.mainStackView.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:20],+ [self.mainStackView.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-20],+ [self.mainStackView.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor constant:-20]+ ]];++ [self addItemToStackView:self.mainStackView+ title:NSLocalizedString(@"camera_desc", nil)+ image:[UIImage systemImageNamed:@"camera.fill"]+ action:@selector(cameraTapped)];++ [self addItemToStackView:self.mainStackView+ title:NSLocalizedString(@"gallery_desc", nil)+ image:[UIImage systemImageNamed:@"photo.on.rectangle"]+ action:@selector(galleryTapped)];++ [self addItemToStackView:self.mainStackView+ title:NSLocalizedString(@"settings_desc", nil)+ image:[UIImage systemImageNamed:@"gear"]+ action:@selector(settingsTapped)];++ // Observe IP address changes+ [[NSNotificationCenter defaultCenter] addObserver:self+ selector:@selector(updateIPAddressLabel)+ name:@"DeviceIPAddressDidChangeNotification"+ object:nil];+}++- (void)viewWillAppear:(BOOL)animated {+ [super viewWillAppear:animated];+ [self updateIPAddressLabel]; // Ensure layout is correct when view appears/reappears+}++- (void)updateIPAddressLabel {+ BOOL streamViaWifiEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"stream_via_wifi_enabled"];+ NSString *ipAddress = [[NSUserDefaults standardUserDefaults] stringForKey:@"DeviceIPAddress"];++ if (streamViaWifiEnabled) {+ // If streaming is enabled, IP label should be visible+ self.ipLabel.hidden = NO;+ self.ipLabel.text = (ipAddress.length > 0) ? [NSString stringWithFormat:NSLocalizedString(@"streaming_over_wifi", nil), ipAddress] : NSLocalizedString(@"waiting_for_ip", nil);++ // Activate constraint to IP label, deactivate constraint to safe area+ self.mainStackViewTopToSafeAreaConstraint.active = NO;+ self.mainStackViewTopToIPLabelConstraint.active = YES;+ } else {+ // If streaming is disabled, IP label should be hidden+ self.ipLabel.hidden = YES;+ self.ipLabel.text = nil; // Clear text when hidden++ // Activate constraint to safe area, deactivate constraint to IP label+ self.mainStackViewTopToIPLabelConstraint.active = NO;+ self.mainStackViewTopToSafeAreaConstraint.active = YES;+ }++ // Force layout update after constraint changes+ [self.view layoutIfNeeded];+}++- (void)addItemToStackView:(UIStackView *)stackView title:(NSString *)title image:(UIImage *)image action:(SEL)action {+ // Create container view+ UIView *container = [[UIView alloc] init];+ container.backgroundColor = [UIColor systemGray6Color];+ container.layer.cornerRadius = 10;+ container.translatesAutoresizingMaskIntoConstraints = NO;++ // Create image view+ UIImageView *imageView = [[UIImageView alloc] initWithImage:image];+ imageView.contentMode = UIViewContentModeScaleAspectFit;+ imageView.tintColor = [UIColor systemBlueColor];+ imageView.translatesAutoresizingMaskIntoConstraints = NO;++ // Create label+ UILabel *label = [[UILabel alloc] init];+ label.text = title;+ label.numberOfLines = 0;+ label.font = [UIFont systemFontOfSize:18];+ label.translatesAutoresizingMaskIntoConstraints = NO;++ // Create horizontal stack view for image and label+ UIStackView *itemStackView = [[UIStackView alloc] init];+ itemStackView.axis = UILayoutConstraintAxisHorizontal;+ itemStackView.alignment = UIStackViewAlignmentCenter;+ itemStackView.spacing = 15;+ itemStackView.translatesAutoresizingMaskIntoConstraints = NO;+ [itemStackView addArrangedSubview:imageView];+ [itemStackView addArrangedSubview:label];++ // Add stack view to container+ [container addSubview:itemStackView];+ [NSLayoutConstraint activateConstraints:@[+ [itemStackView.leadingAnchor constraintEqualToAnchor:container.leadingAnchor constant:15],+ [itemStackView.trailingAnchor constraintEqualToAnchor:container.trailingAnchor constant:-15],+ [itemStackView.topAnchor constraintEqualToAnchor:container.topAnchor constant:10],+ [itemStackView.bottomAnchor constraintEqualToAnchor:container.bottomAnchor constant:-10],+ [imageView.widthAnchor constraintEqualToConstant:50],+ [imageView.heightAnchor constraintEqualToConstant:50]+ ]];++ // Add tap gesture+ container.userInteractionEnabled = YES;+ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:action];+ [container addGestureRecognizer:tap];++ // Add to main stack view+ [stackView addArrangedSubview:container];+}++#pragma mark - Actions++- (void)cameraTapped {+ ViewController *cameraVC = [[ViewController alloc] init];+ [self.navigationController pushViewController:cameraVC animated:YES];+}++- (void)galleryTapped {+ GalleryViewController *galleryVC = [[GalleryViewController alloc] init];+ [self.navigationController pushViewController:galleryVC animated:YES];+}++- (void)settingsTapped {+ SettingsViewController *settingsVC = [[SettingsViewController alloc] init];+ [self.navigationController pushViewController:settingsVC animated:YES];+}++- (void)dealloc {+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DeviceIPAddressDidChangeNotification" object:nil];+}++@enddiff --git a/clearcam/PortScanner.m b/clearcam/PortScanner.mindex c0f7e6f..b3eb713 100644--- a/clearcam/PortScanner.m+++ b/clearcam/PortScanner.m@@ -4,17 +4,42 @@#include <netinet/in.h>#include <sys/socket.h>+@interface PortScanner ()+@property (nonatomic, strong) NSTimer *ipCheckTimer;+@property (nonatomic, strong) NSString *lastKnownIPAddress;+@end+@implementation PortScanner-// Initialize cached list and scan queue- (instancetype)init {self = [super init];if (self) {- [self getDeviceIPAddress];+ [self startPeriodicIPCheck];}return self;}+- (void)startPeriodicIPCheck {+ [self checkAndUpdateIPAddress];+ self.ipCheckTimer = [NSTimer scheduledTimerWithTimeInterval:5.0+ target:self+ selector:@selector(checkAndUpdateIPAddress)+ userInfo:nil+ repeats:YES];+}++- (void)checkAndUpdateIPAddress {+ NSString *currentIP = [self getDeviceIPAddress];++ if (currentIP && ![currentIP isEqualToString:self.lastKnownIPAddress]) {+ self.lastKnownIPAddress = currentIP;+ [[NSUserDefaults standardUserDefaults] setObject:currentIP forKey:@"DeviceIPAddress"];+ [[NSUserDefaults standardUserDefaults] synchronize];+ [[NSNotificationCenter defaultCenter] postNotificationName:@"DeviceIPAddressDidChangeNotification"+ object:nil];+ }+}+- (NSString *)getDeviceIPAddress {struct ifaddrs *interfaces = NULL;struct ifaddrs *temp_addr = NULL;@@ -24,22 +49,25 @@temp_addr = interfaces;while (temp_addr != NULL) {if (temp_addr->ifa_addr->sa_family == AF_INET) {- // Check for Wi-Fi (en0)if ([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) {- ipAddress = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];- break; // Found the IP, exit loop+ ipAddress = [NSString stringWithUTF8String:+ inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];+ break;}}temp_addr = temp_addr->ifa_next;}}freeifaddrs(interfaces);-- if (ipAddress) {- [[NSUserDefaults standardUserDefaults] setObject:ipAddress forKey:@"DeviceIPAddress"];- [[NSUserDefaults standardUserDefaults] synchronize];+ if (ipAddress && ipAddress.length > 0) {+ return [NSString stringWithFormat:@"http://%@", ipAddress];+ } else {+ return @"";}- return ipAddress ? ipAddress : @"No IP found";}+- (void)dealloc {+ [self.ipCheckTimer invalidate];+ self.ipCheckTimer = nil;+}@enddiff --git a/clearcam/SceneDelegate.m b/clearcam/SceneDelegate.mindex 17a00a3..89e8fc4 100644--- a/clearcam/SceneDelegate.m+++ b/clearcam/SceneDelegate.m@@ -1,5 +1,5 @@#import "SceneDelegate.h"-#import "ViewController.h"+#import "MainViewController.h"@interface SceneDelegate ()@@ -9,7 +9,7 @@- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];- ViewController *rootViewController = [[ViewController alloc] init];+ MainViewController *rootViewController = [[MainViewController alloc] init];UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];self.window.rootViewController = navigationController;[self.window makeKeyAndVisible];diff --git a/clearcam/SettingsManager.m b/clearcam/SettingsManager.mindex 61ce78b..edc40cc 100644--- a/clearcam/SettingsManager.m+++ b/clearcam/SettingsManager.m@@ -17,11 +17,11 @@NSDictionary *savedPresets = [[NSUserDefaults standardUserDefaults] objectForKey:@"yolo_presets"];if (!savedPresets) {[[NSUserDefaults standardUserDefaults] setObject:[[NSMutableDictionary alloc] initWithDictionary:@{- @"all": @[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35, @36, @37, @38, @39, @40, @41, @42, @43, @44, @45, @46, @47, @48, @49, @50, @51, @52, @53, @54, @55, @56, @57, @58, @59, @60, @61, @62, @63, @64, @65, @66, @67, @68, @69, @70, @71, @72, @73, @74, @75, @76, @77, @78, @79],- @"People+Vehicles": @[@0, @1, @2, @3, @5, @7]+ NSLocalizedString(@"all", nil): @[@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35, @36, @37, @38, @39, @40, @41, @42, @43, @44, @45, @46, @47, @48, @49, @50, @51, @52, @53, @54, @55, @56, @57, @58, @59, @60, @61, @62, @63, @64, @65, @66, @67, @68, @69, @70, @71, @72, @73, @74, @75, @76, @77, @78, @79],+ NSLocalizedString(@"people+vehicles", nil): @[@0, @1, @2, @3, @5, @7]}] forKey:@"yolo_presets"];}- if(![[NSUserDefaults standardUserDefaults] objectForKey:@"yolo_preset_idx"]) [[NSUserDefaults standardUserDefaults] setObject:@"People+Vehicles" forKey:@"yolo_preset_idx"];+ if(![[NSUserDefaults standardUserDefaults] objectForKey:@"yolo_preset_idx"]) [[NSUserDefaults standardUserDefaults] setObject:NSLocalizedString(@"people+vehicles", nil) forKey:@"yolo_preset_idx"];[[NSUserDefaults standardUserDefaults] synchronize];[self loadResolutionSettings];}diff --git a/clearcam/SettingsViewController.m b/clearcam/SettingsViewController.mindex 6b753e2..6a6457a 100644--- a/clearcam/SettingsViewController.m+++ b/clearcam/SettingsViewController.m@@ -70,8 +70,8 @@if ([defaults objectForKey:@"stream_via_wifi_enabled"] != nil) {self.streamViaWiFiEnabled = [defaults boolForKey:@"stream_via_wifi_enabled"];} else {- self.streamViaWiFiEnabled = NO;- [defaults setBool:NO forKey:@"stream_via_wifi_enabled"];+ self.streamViaWiFiEnabled = YES;+ [defaults setBool:YES forKey:@"stream_via_wifi_enabled"];}if ([defaults objectForKey:@"send_notif_enabled"] != nil) {@@ -189,7 +189,7 @@NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];NSString *ipAddress = [defaults stringForKey:@"DeviceIPAddress"];if (ipAddress && ipAddress.length > 0) {- self.notificationServerAddress = [NSString stringWithFormat:@"http://%@", ipAddress];+ self.notificationServerAddress = ipAddress;} else {self.notificationServerAddress = NSLocalizedString(@"waiting_for_ip", @"Placeholder when IP address is not available");}@@ -425,7 +425,7 @@cell.textLabel.text = NSLocalizedString(@"stream_via_wifi", @"Label for stream via Wi-Fi setting");NSString *ipAddress = [[NSUserDefaults standardUserDefaults] stringForKey:@"DeviceIPAddress"];cell.detailTextLabel.text = ipAddress && ipAddress.length > 0 ?- [NSString stringWithFormat:@"http://%@", ipAddress] :+ ipAddress :NSLocalizedString(@"waiting_for_ip", @"Placeholder when IP address is not available");cell.accessoryType = UITableViewCellAccessoryNone;UISwitch *wifiSwitch = [[UISwitch alloc] init];diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex be47576..4c8dae5 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -7,8 +7,6 @@#import "StoreManager.h"#import "SecretManager.h"#import "SceneState.h"-#import "SettingsViewController.h"-#import "GalleryViewController.h"#import <Security/Security.h>#import <CommonCrypto/CommonCryptor.h>@@ -18,8 +16,6 @@@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;@property (nonatomic, strong) UILabel *fpsLabel;@property (nonatomic, strong) UIButton *recordButton;-@property (nonatomic, strong) UIButton *settingsButton;-@property (nonatomic, strong) UIButton *galleryButton;@property (nonatomic, assign) CFTimeInterval lastFrameTime;@property (nonatomic, assign) NSUInteger frameCount;@property (nonatomic, strong) Yolo *yolo;@@ -97,7 +93,6 @@ NSMutableDictionary *classColorMap;self.yolo = [[Yolo alloc] init];self.seg_number = 0;self.fileServer = [FileServer sharedInstance];- [self.fileServer start];self.backgroundContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];self.backgroundContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy;self.backgroundContext.parentContext = self.fileServer.context;@@ -153,7 +148,6 @@ NSMutableDictionary *classColorMap;[self.previewLayer removeFromSuperlayer];self.previewLayer = nil;-self.isProcessing = NO;self.isProcessingCoreData = NO;self.recordPressed = wasRecording;@@ -168,7 +162,6 @@ NSMutableDictionary *classColorMap;[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];-SettingsManager *settings = [SettingsManager sharedManager];[self setupCameraWithWidth:settings.width height:settings.height];@@ -233,7 +226,6 @@ NSMutableDictionary *classColorMap;[self updateButtonFrames];}-- (void)viewWillAppear:(BOOL)animated {[super viewWillAppear:animated];[UIApplication sharedApplication].idleTimerDisabled = YES;@@ -451,7 +443,6 @@ NSMutableDictionary *classColorMap;if(![self ensureFreeDiskSpace]) [self stopRecording];}-- (void)drawSquareWithTopLeftX:(CGFloat)xOrigin topLeftY:(CGFloat)yOrigin bottomRightX:(CGFloat)bottomRightX bottomRightY:(CGFloat)bottomRightY classIndex:(int)classIndex aspectRatio:(float)aspectRatio {CGFloat leftEdgeX = (self.view.bounds.size.width - (self.view.bounds.size.height * aspectRatio)) / 2;CGFloat scaledXOrigin, scaledYOrigin, scaledWidth, scaledHeight;@@ -571,37 +562,11 @@ NSMutableDictionary *classColorMap;[self.recordButton addTarget:self action:@selector(toggleRecording) forControlEvents:UIControlEventTouchUpInside];[self.view addSubview:self.recordButton];- self.settingsButton = [UIButton buttonWithType:UIButtonTypeSystem];- UIImage *gearIcon = [UIImage systemImageNamed:@"gear"];- [self.settingsButton setImage:gearIcon forState:UIControlStateNormal];- CGFloat gearButtonSize = 50;- self.settingsButton.frame = CGRectMake(0, 0, gearButtonSize, gearButtonSize);- self.settingsButton.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];- self.settingsButton.layer.cornerRadius = gearButtonSize / 2;- self.settingsButton.clipsToBounds = YES;- self.settingsButton.tintColor = [UIColor whiteColor];- [self.settingsButton addTarget:self action:@selector(openSettings) forControlEvents:UIControlEventTouchUpInside];- [self.view addSubview:self.settingsButton];-- self.galleryButton = [UIButton buttonWithType:UIButtonTypeSystem];- UIImage *galleryIcon = [UIImage systemImageNamed:@"photo.on.rectangle"];- [self.galleryButton setImage:galleryIcon forState:UIControlStateNormal];- CGFloat galleryButtonSize = 50;- self.galleryButton.frame = CGRectMake(0, 0, galleryButtonSize, galleryButtonSize);- self.galleryButton.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];- self.galleryButton.layer.cornerRadius = galleryButtonSize / 2;- self.galleryButton.clipsToBounds = YES;- self.galleryButton.tintColor = [UIColor whiteColor];- [self.galleryButton addTarget:self action:@selector(galleryButtonPressed) forControlEvents:UIControlEventTouchUpInside];- [self.view addSubview:self.galleryButton];-[self updateButtonFrames]; // Just call it once}- (void)updateButtonFrames {CGFloat recordButtonSize = 80;- CGFloat settingsButtonSize = 50;- CGFloat galleryButtonSize = 50;CGFloat spacing = 60;UIEdgeInsets safeAreaInsets = self.view.safeAreaInsets;@@ -609,8 +574,6 @@ NSMutableDictionary *classColorMap;CGFloat screenHeight = self.view.bounds.size.height;self.recordButton.layer.cornerRadius = recordButtonSize / 2;- self.settingsButton.layer.cornerRadius = settingsButtonSize / 2;- self.galleryButton.layer.cornerRadius = galleryButtonSize / 2;UIDeviceOrientation orientation = [self getCurrentOrientation];@@ -622,49 +585,28 @@ NSMutableDictionary *classColorMap;if (orientation == UIDeviceOrientationLandscapeRight) {CGFloat leftMargin = MAX(20, safeAreaInsets.left + 10);self.recordButton.frame = CGRectMake(leftMargin, screenHeight / 2 - recordButtonSize / 2, recordButtonSize, recordButtonSize);- self.settingsButton.frame = CGRectMake(leftMargin + (recordButtonSize / 2) - (settingsButtonSize / 2),- screenHeight / 2 - recordButtonSize / 2 - settingsButtonSize - spacing,- settingsButtonSize, settingsButtonSize);- self.galleryButton.frame = CGRectMake(leftMargin + (recordButtonSize / 2) - (galleryButtonSize / 2),- screenHeight / 2 + recordButtonSize / 2 + spacing,- galleryButtonSize, galleryButtonSize);self.fpsLabel.frame = CGRectMake(screenWidth - self.fpsLabel.frame.size.width - MAX(20, safeAreaInsets.right + 10),- 30,- self.fpsLabel.frame.size.width,- self.fpsLabel.frame.size.height);+ safeAreaInsets.top + 10,+ self.fpsLabel.frame.size.width,+ self.fpsLabel.frame.size.height);} else if (orientation == UIDeviceOrientationLandscapeLeft) {CGFloat rightMargin = MAX(20, safeAreaInsets.right + 10);self.recordButton.frame = CGRectMake(screenWidth - recordButtonSize - rightMargin, screenHeight / 2 - recordButtonSize / 2, recordButtonSize, recordButtonSize);- self.settingsButton.frame = CGRectMake(screenWidth - recordButtonSize - rightMargin + (recordButtonSize / 2) - (settingsButtonSize / 2),- screenHeight / 2 - recordButtonSize / 2 - settingsButtonSize - spacing,- settingsButtonSize, settingsButtonSize);- self.galleryButton.frame = CGRectMake(screenWidth - recordButtonSize - rightMargin + (recordButtonSize / 2) - (galleryButtonSize / 2),- screenHeight / 2 + recordButtonSize / 2 + spacing,- galleryButtonSize, galleryButtonSize);self.fpsLabel.frame = CGRectMake(MAX(10, safeAreaInsets.left + 5),- 30,- self.fpsLabel.frame.size.width,- self.fpsLabel.frame.size.height);+ safeAreaInsets.top + 10,+ self.fpsLabel.frame.size.width,+ self.fpsLabel.frame.size.height);} else {CGFloat bottomMargin = MAX(20, safeAreaInsets.bottom + 10);CGFloat recordX = (screenWidth - recordButtonSize) / 2;self.recordButton.frame = CGRectMake(recordX, screenHeight - recordButtonSize - bottomMargin, recordButtonSize, recordButtonSize);- self.settingsButton.frame = CGRectMake(recordX + recordButtonSize + spacing,- screenHeight - bottomMargin - recordButtonSize / 2 - settingsButtonSize / 2,- settingsButtonSize, settingsButtonSize);- self.galleryButton.frame = CGRectMake(recordX - galleryButtonSize - spacing,- screenHeight - bottomMargin - recordButtonSize / 2 - galleryButtonSize / 2,- galleryButtonSize, galleryButtonSize);- self.fpsLabel.frame = CGRectMake(10, 50, self.fpsLabel.frame.size.width, self.fpsLabel.frame.size.height);+ self.fpsLabel.frame = CGRectMake(screenWidth - self.fpsLabel.frame.size.width - 20,+ safeAreaInsets.top + 10,+ self.fpsLabel.frame.size.width,+ self.fpsLabel.frame.size.height);}}-- (void)galleryButtonPressed {- [self.captureSession stopRunning];- GalleryViewController *galleryVC = [[GalleryViewController alloc] init];- [self.navigationController pushViewController:galleryVC animated:YES];-}-- (void)toggleRecording {CAShapeLayer *redShape = nil;for (CALayer *layer in self.recordButton.layer.sublayers) {@@ -703,13 +645,6 @@ NSMutableDictionary *classColorMap;[self updateButtonFrames];}-- (void)openSettings {- if(self.recordPressed) [self toggleRecording];- [self.captureSession stopRunning];- SettingsViewController *settingsVC = [[SettingsViewController alloc] init];- [self.navigationController pushViewController:settingsVC animated:YES];-}-- (void)viewWillLayoutSubviews {[super viewWillLayoutSubviews];self.previewLayer.frame = self.view.bounds;@@ -753,7 +688,6 @@ NSMutableDictionary *classColorMap;[self.videoWriterInput markAsFinished];}-- (void)finishRecording {if (!(self.isRecording && self.assetWriter.status == AVAssetWriterStatusWriting)) return;diff --git a/clearcam/en.lproj/Localizable.strings b/clearcam/en.lproj/Localizable.stringsindex 0b9fd1b..48d6054 100644--- a/clearcam/en.lproj/Localizable.strings+++ b/clearcam/en.lproj/Localizable.strings@@ -2,7 +2,8 @@"events" = "Events";"live"="Live";"default_device_name" = "My Device";-"waiting_for_ip" = "Waiting for IP...";+"waiting_for_ip" = "Waiting for Wi-Fi...";+"streaming_over_wifi" = "Streaming over local Wi-Fi at: %@";"permission_denied" = "Permission Denied";"notification_permission_denied" = "Notification permission was denied. You can enable it in Settings.";"ok" = "OK";@@ -91,3 +92,10 @@"online" = "Online";"experimental_features" = "Experimental Features";"docs" = "Docs";+"app_name" = "Clearcam";+"home" = "Home";+"camera_desc" = "Record and broadcast footage, with AI object detection";+"gallery_desc" = "View captured events and live camera feeds (Premium required)";+"settings_desc" = "Configure cameras and detection";+"all" = "all";+"people+vehicles" = "people+vehicles";diff --git a/clearcam/es.lproj/Localizable.strings b/clearcam/es.lproj/Localizable.stringsindex f2453a6..3cbf810 100644--- a/clearcam/es.lproj/Localizable.strings+++ b/clearcam/es.lproj/Localizable.strings@@ -2,7 +2,8 @@"events" = "Eventos";"live" = "En vivo";"default_device_name" = "Mi dispositivo";-"waiting_for_ip" = "Esperando IP...";+"waiting_for_ip" = "Esperando Wi-Fi...";+"streaming_over_wifi" = "Transmitiendo por Wi-Fi local en: %@";"permission_denied" = "Permiso denegado";"notification_permission_denied" = "Permiso de notificaciones denegado. Actívalo en Ajustes.";"ok" = "Aceptar";@@ -91,6 +92,13 @@"online" = "En línea";"experimental_features" = "Funciones experimentales";"docs" = "Documentación";+"app_name" = "Clearcam";+"home" = "Inicio";+"camera_desc" = "Graba y transmite imágenes con detección de objetos por IA";+"gallery_desc" = "Ve eventos capturados y transmisiones en vivo (se requiere Premium)";+"settings_desc" = "Configura cámaras y detección";+"all" = "todos";+"people+vehicles" = "personas+vehículos";"person" = "persona";"bicycle" = "bicicleta";diff --git a/clearcam/hi.lproj/Localizable.strings b/clearcam/hi.lproj/Localizable.stringsnew file mode 100644index 0000000..a77b394--- /dev/null+++ b/clearcam/hi.lproj/Localizable.strings@@ -0,0 +1,182 @@+"settings" = "सेटिंग्स";+"events" = "ईवेंट्स";+"live" = "लाइव";+"default_device_name" = "मेरा डिवाइस";+"waiting_for_ip" = "Wi-Fi का इंतज़ार कर रहे...";+"streaming_over_wifi" = "स्थानीय Wi-Fi पर स्ट्रीमिंग: %@";+"permission_denied" = "अनुमति अस्वीकृत";+"notification_permission_denied" = "सूचना की अनुमति अस्वीकृत कर दी गई है। आप इसे सेटिंग्स में सक्षम कर सकते हैं।";+"ok" = "ठीक है";+"enable_in_settings" = "सेटिंग्स में सक्षम करें";+"notifications_disabled" = "सूचनाएँ अक्षम हैं। कृपया उन्हें सेटिंग्स ऐप में सक्षम करें।";+"camera_settings" = "कैमरा सेटिंग्स";+"live_stream_settings" = "लाइव स्ट्रीम सेटिंग्स";+"viewer_settings" = "व्यूअर सेटिंग्स";+"subscription" = "सदस्यता";+"upgrade_to_premium" = "प्रीमियम में अपग्रेड करें";+"stream_via_wifi" = "Wi-Fi के माध्यम से स्ट्रीम करें";+"resolution" = "रिज़ॉल्यूशन";+"detect_objects" = "वस्तुओं का पता लगाएं";+"manage_detection_presets" = "डिटेक्शन प्रीसेट प्रबंधित करें";+"detection_certainty_threshold" = "डिटेक्शन निश्चितता सीमा";+"send_videos_on_detection" = "डिटेक्शन पर वीडियो भेजें";+"send_videos_description" = "इवेंट्स को किसी भी डिवाइस पर देखने के लिए सक्षम करें।";+"change_encryption_password" = "एन्क्रिप्शन पासवर्ड बदलें";+"manage_detection_schedules" = "डिटेक्शन शेड्यूल प्रबंधित करें";+"manage_detection_schedules_description" = "कब वस्तुओं का पता लगाना है, चुनें।";+"use_own_notification_server" = "स्वयं का नोटिफिकेशन सर्वर उपयोग करें";+"use_own_notification_server_description" = "वीडियो अपने सर्वर पर भेजें।";+"server_address" = "सर्वर पता";+"test_own_server" = "अपना सर्वर जांचें";+"use_own_inference_server" = "स्वयं का इनफेरेंस सर्वर उपयोग करें";+"use_own_inference_server_description" = "वस्तु पहचान के लिए कस्टम सर्वर उपयोग करें।";+"enter_inference_server_address" = "सर्वर पता दर्ज करें: जैसे http://192.168.1.1:6667";+"live_stream_network" = "नेटवर्क पर लाइव स्ट्रीम";+"device_name" = "डिवाइस का नाम";+"receive_notifications" = "सूचनाएँ प्राप्त करें";+"receive_notifications_description" = "जब कैमरा कोई इवेंट कैप्चर करे तो सूचित किया जाए।";+"restore_purchases" = "खरीदारी पुनर्स्थापित करें";+"terms_of_use" = "उपयोग की शर्तें";+"privacy_policy" = "गोपनीयता नीति";+"delete_encryption_keys" = "एन्क्रिप्शन कुंजियाँ हटाएं";+"enter_inference_server_address_title" = "इनफेरेंस सर्वर का पता दर्ज करें";+"enter_inference_server_address_message" = "कृपया अपने इनफेरेंस सर्वर का पता दर्ज करें।";+"server_address_label" = "सर्वर पता";+"save" = "सेव करें";+"cancel" = "रद्द करें";+"set_threshold_title" = "सीमा निर्धारित करें";+"set_threshold_message" = "1 से 100 के बीच का प्रतिशत दर्ज करें (डिफ़ॉल्ट 25 है)।";+"threshold_placeholder" = "सीमा (1-100)";+"invalid_threshold_title" = "अमान्य सीमा";+"invalid_threshold_message" = "कृपया 1 से 100 के बीच का मान्य मान दर्ज करें";+"set_device_name_title" = "डिवाइस नाम सेट करें";+"set_device_name_message" = "इस डिवाइस के लिए नाम दर्ज करें।";+"device_name_placeholder" = "डिवाइस का नाम";+"delete_encryption_keys_title" = "एन्क्रिप्शन कुंजियाँ हटाएं";+"delete_encryption_keys_message" = "क्या आप वाकई इस डिवाइस से सभी कुंजियाँ हटाना चाहते हैं?";+"delete" = "हाँ";+"price_unknown" = "मूल्य";+"get_premium_title" = "Clearcam प्रीमियम प्राप्त करें";+"premium_feature_1" = "कहीं से भी कैप्चर किए गए इवेंट देखें";+"premium_feature_2" = "वास्तविक समय में इवेंट सूचनाएँ प्राप्त करें";+"premium_feature_3" = "कहीं से भी लाइव स्ट्रीम करें";+"premium_feature_4" = "आपके फ़ोन से भेजे गए सभी कैमरा डेटा पर एंड-टू-एंड एन्क्रिप्शन।";+"upgrade_button" = "₹%@ प्रति माह में अपग्रेड करें";+"not_now" = "अभी नहीं";+"premium_disclaimer" = "प्रति माह 5,000 क्लिप अपलोड और 1,000 मिनट या सत्र की लाइव स्ट्रीम सीमा।";+"purchase_failed" = "खरीद विफल रही";+"enter_notification_server_address_title" = "सर्वर पता दर्ज करें";+"enter_notification_server_address_message" = "कृपया अपने नोटिफिकेशन सर्वर का पता दर्ज करें।";+"test_notification_sent_title" = "भेजा गया";+"test_notification_sent_message" = "टेस्ट नोटिफिकेशन भेजा गया। अपने सर्वर की जाँच करें।";+"set_password_title" = "पासवर्ड सेट करें";+"set_password_message" = "अपने डेटा को एन्क्रिप्ट करने के लिए पासवर्ड दर्ज करें";+"password_placeholder" = "पासवर्ड";+"confirm_password_placeholder" = "पासवर्ड की पुष्टि करें";+"invalid_password_title" = "अमान्य पासवर्ड";+"invalid_password_message" = "पासवर्ड मेल नहीं खा रहे हैं या खाली हैं।";+"select_resolution_title" = "रिज़ॉल्यूशन चुनें";+"select_objects_preset_title" = "वस्तु प्रीसेट चुनें";+"add_preset_title" = "प्रीसेट जोड़ें";+"add_preset_message" = "नए प्रीसेट के लिए नाम दर्ज करें";+"preset_name_placeholder" = "प्रीसेट नाम";+"restoring_purchases_title" = "खरीदारी पुनर्स्थापित की जा रही है";+"restoring_purchases_message" = "कृपया प्रतीक्षा करें, हम आपकी पिछली खरीदारी पुनर्स्थापित कर रहे हैं...";+"steps_text_live" = "1. किसी अन्य फ़ोन पर Clearcam इंस्टॉल करें।\n2. Clearcam प्रीमियम में अपग्रेड करें (दोनों फ़ोन पर एक ही Apple खाता होना चाहिए)।\n3. अपने अन्य फ़ोन पर \"नेटवर्क पर लाइव स्ट्रीम\" चालू करें और एक सुरक्षित पासवर्ड और डिवाइस नाम चुनें।\n4. रिकॉर्डिंग शुरू करें।";+"steps_text_clips" = "1. किसी अन्य फ़ोन पर Clearcam इंस्टॉल करें।\n2. Clearcam प्रीमियम में अपग्रेड करें (दोनों फ़ोन पर एक ही Apple खाता होना चाहिए)।\n3. अपने अन्य फ़ोन पर \"डिटेक्शन पर वीडियो भेजें\" चालू करें और एक सुरक्षित पासवर्ड चुनें।\n4. (वैकल्पिक) अपनी डिटेक्शन सेटिंग्स और शेड्यूल कॉन्फ़िगर करें।\n5. रिकॉर्डिंग शुरू करें।\n";+"no_live_devices" = "कोई लाइव डिवाइस नहीं\n";+"no_videos_available" = "कोई वीडियो उपलब्ध नहीं\n";+"share" = "साझा करें";+"delete" = "हटाएं";+"cancel" = "रद्द करें";+"online" = "ऑनलाइन";+"experimental_features" = "प्रायोगिक विशेषताएँ";+"docs" = "दस्तावेज़";+"app_name" = "Clearcam";+"home" = "होम";+"camera_desc" = "एआई ऑब्जेक्ट डिटेक्शन के साथ वीडियो रिकॉर्ड और प्रसारित करें";+"gallery_desc" = "कैप्चर किए गए इवेंट और लाइव फीड देखें (प्रीमियम आवश्यक)";+"settings_desc" = "कैमरों और डिटेक्शन को कॉन्फ़िगर करें";+"all" = "सभी";+"people+vehicles" = "लोग+वाहन";++"person" = "व्यक्ति";+"bicycle" = "साइकिल";+"car" = "कार";+"motorcycle" = "मोटरसाइकिल";+"airplane" = "विमान";+"bus" = "बस";+"train" = "रेलगाड़ी";+"truck" = "ट्रक";+"boat" = "नाव";+"traffic light" = "ट्रैफिक लाइट";+"fire hydrant" = "फायर हाइड्रेंट";+"stop sign" = "रुकने का संकेत";+"parking meter" = "पार्किंग मीटर";+"bench" = "बेंच";+"bird" = "पक्षी";+"cat" = "बिल्ली";+"dog" = "कुत्ता";+"horse" = "घोड़ा";+"sheep" = "भेड़";+"cow" = "गाय";+"elephant" = "हाथी";+"bear" = "भालू";+"zebra" = "ज़ेबरा";+"giraffe" = "जिराफ";+"backpack" = "बैकपैक";+"umbrella" = "छाता";+"handbag" = "हैंडबैग";+"tie" = "टाई";+"suitcase" = "सूटकेस";+"frisbee" = "फ्रिसबी";+"skis" = "स्की";+"snowboard" = "स्नोबोर्ड";+"sports ball" = "खेल की गेंद";+"kite" = "पतंग";+"baseball bat" = "बेसबॉल बैट";+"baseball glove" = "बेसबॉल ग्लव";+"skateboard" = "स्केटबोर्ड";+"surfboard" = "सर्फबोर्ड";+"tennis racket" = "टेनिस रैकेट";+"bottle" = "बोतल";+"wine glass" = "वाइन ग्लास";+"cup" = "कप";+"fork" = "कांटा";+"knife" = "चाकू";+"spoon" = "चम्मच";+"bowl" = "कटोरा";+"banana" = "केला";+"apple" = "सेब";+"sandwich" = "सैंडविच";+"orange" = "संतरा";+"broccoli" = "ब्रोकली";+"carrot" = "गाजर";+"hot dog" = "हॉट डॉग";+"pizza" = "पिज़्ज़ा";+"donut" = "डोनट";+"cake" = "केक";+"chair" = "कुर्सी";+"couch" = "सोफ़ा";+"potted plant" = "गमले वाला पौधा";+"bed" = "बिस्तर";+"dining table" = "भोजन मेज़";+"toilet" = "शौचालय";+"tv" = "टीवी";+"laptop" = "लैपटॉप";+"mouse" = "माउस";+"remote" = "रिमोट";+"keyboard" = "कीबोर्ड";+"cell phone" = "मोबाइल फोन";+"microwave" = "माइक्रोवेव";+"oven" = "ओवन";+"toaster" = "टोस्टर";+"sink" = "सिंक";+"refrigerator" = "फ्रिज";+"book" = "किताब";+"clock" = "घड़ी";+"vase" = "फूलदान";+"scissors" = "कैंची";+"teddy bear" = "टेडी बियर";+"hair drier" = "हेयर ड्रायर";+"toothbrush" = "टूथब्रश";diff --git a/clearcam/ja.lproj/Localizable.strings b/clearcam/ja.lproj/Localizable.stringsindex 1523c45..bbac2c0 100644--- a/clearcam/ja.lproj/Localizable.strings+++ b/clearcam/ja.lproj/Localizable.strings@@ -2,7 +2,8 @@"events" = "イベント";"live" = "ライブ";"default_device_name" = "マイデバイス";-"waiting_for_ip" = "IPアドレス待機中...";+"waiting_for_ip" = "Wi-Fiを待機中...";+"streaming_over_wifi" = "ローカルWi-Fiでストリーミング中: %@";"permission_denied" = "アクセス拒否されました";"notification_permission_denied" = "通知許可が拒否されました。設定から有効にできます。";"ok" = "OK";@@ -91,6 +92,13 @@"online" = "オンライン";"experimental_features" = "実験的機能";"docs" = "ドキュメント";+"app_name" = "Clearcam";+"home" = "ホーム";+"camera_desc" = "映像を録画・配信し、AIで物体検出を行います";+"gallery_desc" = "撮影されたイベントやライブ映像を表示(プレミアムが必要)";+"settings_desc" = "カメラと検出機能の設定";+"all" = "すべて";+"people+vehicles" = "人+車両";"person" = "人";"bicycle" = "自転車";diff --git a/clearcam/ko.lproj/Localizable.strings b/clearcam/ko.lproj/Localizable.stringsindex a961ea9..813ca15 100644--- a/clearcam/ko.lproj/Localizable.strings+++ b/clearcam/ko.lproj/Localizable.strings@@ -2,7 +2,8 @@"events" = "이벤트";"live" = "라이브";"default_device_name" = "내 장치";-"waiting_for_ip" = "IP 대기 중...";+"waiting_for_ip" = "Wi-Fi 연결 대기 중...";+"streaming_over_wifi" = "로컬 Wi-Fi로 스트리밍 중: %@";"permission_denied" = "권한 거부됨";"notification_permission_denied" = "알림 권한이 거부되었습니다. 설정에서 활성화할 수 있습니다.";"ok" = "확인";@@ -91,6 +92,13 @@"online" = "온라인";"experimental_features" = "실험적 기능";"docs" = "문서";+"app_name" = "Clearcam";+"home" = "홈";+"camera_desc" = "AI 객체 감지 기능으로 영상을 녹화하고 방송합니다";+"gallery_desc" = "캡처된 이벤트와 실시간 영상을 확인하세요 (프리미엄 필요)";+"settings_desc" = "카메라 및 감지 설정";+"all" = "전체";+"people+vehicles" = "사람+차량";"person" = "사람";"bicycle" = "자전거";diff --git a/clearcam/zh-Hans.lproj/Localizable.strings b/clearcam/zh-Hans.lproj/Localizable.stringsindex 7bab95c..5a188ea 100644--- a/clearcam/zh-Hans.lproj/Localizable.strings+++ b/clearcam/zh-Hans.lproj/Localizable.strings@@ -2,7 +2,8 @@"events" = "事件";"live" = "直播";"default_device_name" = "我的设备";-"waiting_for_ip" = "正在获取IP...";+"waiting_for_ip" = "等待Wi-Fi连接...";+"streaming_over_wifi" = "正在通过本地Wi-Fi串流,地址: %@";"permission_denied" = "权限被拒绝";"notification_permission_denied" = "通知权限被拒绝。您可以在设置中启用它。";"ok" = "确定";@@ -91,6 +92,13 @@"online" = "在线";"experimental_features" = "实验性功能";"docs" = "文档";+"app_name" = "Clearcam";+"home" = "首页";+"camera_desc" = "录制并直播画面,支持AI目标识别";+"gallery_desc" = "查看捕捉事件和实时画面(需订阅高级版)";+"settings_desc" = "配置摄像头和识别功能";+"all" = "全部";+"people+vehicles" = "人+车辆";"person" = "人";"bicycle" = "自行车";