- 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
65 lines
2.0 KiB
Objective-C
65 lines
2.0 KiB
Objective-C
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
|
|
#import <ExpoFileSystem/EXSessionDownloadTaskDelegate.h>
|
|
#import <ExpoFileSystem/NSData+EXFileSystem.h>
|
|
|
|
@interface EXSessionDownloadTaskDelegate ()
|
|
|
|
@property (strong, nonatomic) NSURL *localUrl;
|
|
@property (nonatomic) BOOL shouldCalculateMd5;
|
|
|
|
@end
|
|
|
|
@implementation EXSessionDownloadTaskDelegate
|
|
|
|
- (nonnull instancetype)initWithResolve:(EXPromiseResolveBlock)resolve
|
|
reject:(EXPromiseRejectBlock)reject
|
|
localUrl:(NSURL *)localUrl
|
|
shouldCalculateMd5:(BOOL)shouldCalculateMd5
|
|
{
|
|
if (self = [super initWithResolve:resolve reject:reject])
|
|
{
|
|
_localUrl = localUrl;
|
|
_shouldCalculateMd5 = shouldCalculateMd5;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
|
|
{
|
|
NSError *error;
|
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
if ([fileManager fileExistsAtPath:_localUrl.path]) {
|
|
[fileManager removeItemAtURL:_localUrl error:&error];
|
|
if (error) {
|
|
self.reject(@"ERR_FILESYSTEM_CANNOT_REMOVE",
|
|
[NSString stringWithFormat:@"Unable to remove file from local URI: '%@'", error.description],
|
|
error);
|
|
return;
|
|
}
|
|
}
|
|
|
|
[fileManager moveItemAtURL:location toURL:_localUrl error:&error];
|
|
if (error) {
|
|
self.reject(@"ERR_FILESYSTEM_CANNOT_SAVE",
|
|
[NSString stringWithFormat:@"Unable to save file to local URI: '%@'", error.description],
|
|
error);
|
|
return;
|
|
}
|
|
|
|
self.resolve([self parseServerResponse:downloadTask.response]);
|
|
}
|
|
|
|
- (NSDictionary *)parseServerResponse:(NSURLResponse *)response
|
|
{
|
|
NSMutableDictionary *result = [[super parseServerResponse:response] mutableCopy];
|
|
result[@"uri"] = _localUrl.absoluteString;
|
|
if (_shouldCalculateMd5) {
|
|
NSData *data = [NSData dataWithContentsOfURL:_localUrl];
|
|
result[@"md5"] = [data md5String];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
@end
|