- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
73 lines
2.1 KiB
Objective-C
73 lines
2.1 KiB
Objective-C
// Copyright 2016-present 650 Industries. All rights reserved.
|
|
|
|
#import <EXLocation/EXLocationPermissionRequester.h>
|
|
|
|
#import <objc/message.h>
|
|
#import <CoreLocation/CLLocationManagerDelegate.h>
|
|
|
|
static SEL alwaysAuthorizationSelector;
|
|
static SEL whenInUseAuthorizationSelector;
|
|
|
|
@implementation EXLocationPermissionRequester
|
|
|
|
+ (NSString *)permissionType
|
|
{
|
|
return @"location";
|
|
}
|
|
|
|
+ (void)load
|
|
{
|
|
alwaysAuthorizationSelector = NSSelectorFromString([@"request" stringByAppendingString:@"AlwaysAuthorization"]);
|
|
whenInUseAuthorizationSelector = NSSelectorFromString([@"request" stringByAppendingString:@"WhenInUseAuthorization"]);
|
|
}
|
|
|
|
- (void)requestLocationPermissions
|
|
{
|
|
if ([EXBaseLocationRequester isConfiguredForAlwaysAuthorization] && [self.locationManager respondsToSelector:alwaysAuthorizationSelector]) {
|
|
((void (*)(id, SEL))objc_msgSend)(self.locationManager, alwaysAuthorizationSelector);
|
|
} else if ([EXBaseLocationRequester isConfiguredForWhenInUseAuthorization] && [self.locationManager respondsToSelector:whenInUseAuthorizationSelector]) {
|
|
((void (*)(id, SEL))objc_msgSend)(self.locationManager, whenInUseAuthorizationSelector);
|
|
} else {
|
|
self.reject(@"E_LOCATION_INFO_PLIST", @"One of the `NSLocation*UsageDescription` keys must be present in Info.plist to be able to use geolocation.", nil);
|
|
|
|
self.resolve = nil;
|
|
self.reject = nil;
|
|
}
|
|
}
|
|
|
|
- (NSDictionary *)parsePermissions:(CLAuthorizationStatus)systemStatus
|
|
{
|
|
EXPermissionStatus status;
|
|
NSString *scope = @"none";
|
|
|
|
switch (systemStatus) {
|
|
case kCLAuthorizationStatusAuthorizedWhenInUse: {
|
|
status = EXPermissionStatusGranted;
|
|
scope = @"whenInUse";
|
|
break;
|
|
}
|
|
case kCLAuthorizationStatusAuthorizedAlways: {
|
|
status = EXPermissionStatusGranted;
|
|
scope = @"always";
|
|
break;
|
|
}
|
|
case kCLAuthorizationStatusDenied:
|
|
case kCLAuthorizationStatusRestricted: {
|
|
status = EXPermissionStatusDenied;
|
|
break;
|
|
}
|
|
case kCLAuthorizationStatusNotDetermined:
|
|
default: {
|
|
status = EXPermissionStatusUndetermined;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return @{
|
|
@"status": @(status),
|
|
@"scope": scope
|
|
};
|
|
}
|
|
|
|
@end
|