- 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
104 lines
3.1 KiB
Objective-C
104 lines
3.1 KiB
Objective-C
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTUIManagerUtils.h"
|
|
|
|
#import <stdatomic.h>
|
|
|
|
#import "RCTAssert.h"
|
|
|
|
char *const RCTUIManagerQueueName = "com.facebook.react.ShadowQueue";
|
|
|
|
static BOOL pseudoUIManagerQueueFlag = NO;
|
|
|
|
dispatch_queue_t RCTGetUIManagerQueue(void)
|
|
{
|
|
static dispatch_queue_t shadowQueue;
|
|
static dispatch_once_t onceToken;
|
|
dispatch_once(&onceToken, ^{
|
|
if ([NSOperation instancesRespondToSelector:@selector(qualityOfService)]) {
|
|
dispatch_queue_attr_t attr =
|
|
dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INTERACTIVE, 0);
|
|
shadowQueue = dispatch_queue_create(RCTUIManagerQueueName, attr);
|
|
} else {
|
|
shadowQueue = dispatch_queue_create(RCTUIManagerQueueName, DISPATCH_QUEUE_SERIAL);
|
|
dispatch_set_target_queue(shadowQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));
|
|
}
|
|
});
|
|
return shadowQueue;
|
|
}
|
|
|
|
BOOL RCTIsUIManagerQueue(void)
|
|
{
|
|
static void *queueKey = &queueKey;
|
|
static dispatch_once_t onceToken;
|
|
dispatch_once(&onceToken, ^{
|
|
dispatch_queue_set_specific(RCTGetUIManagerQueue(), queueKey, queueKey, NULL);
|
|
});
|
|
return dispatch_get_specific(queueKey) == queueKey;
|
|
}
|
|
|
|
BOOL RCTIsPseudoUIManagerQueue(void)
|
|
{
|
|
if (RCTIsMainQueue()) {
|
|
return pseudoUIManagerQueueFlag;
|
|
}
|
|
|
|
return NO;
|
|
}
|
|
|
|
void RCTExecuteOnUIManagerQueue(dispatch_block_t block)
|
|
{
|
|
if (RCTIsUIManagerQueue() || RCTIsPseudoUIManagerQueue()) {
|
|
block();
|
|
} else {
|
|
dispatch_async(RCTGetUIManagerQueue(), ^{
|
|
block();
|
|
});
|
|
}
|
|
}
|
|
|
|
void RCTUnsafeExecuteOnUIManagerQueueSync(dispatch_block_t block)
|
|
{
|
|
if (RCTIsUIManagerQueue() || RCTIsPseudoUIManagerQueue()) {
|
|
block();
|
|
} else {
|
|
if (RCTIsMainQueue()) {
|
|
dispatch_semaphore_t mainQueueBlockingSemaphore = dispatch_semaphore_create(0);
|
|
dispatch_semaphore_t uiManagerQueueBlockingSemaphore = dispatch_semaphore_create(0);
|
|
|
|
// Dispatching block which blocks UI Manager queue.
|
|
dispatch_async(RCTGetUIManagerQueue(), ^{
|
|
// Initiating `block` execution on main queue.
|
|
dispatch_semaphore_signal(mainQueueBlockingSemaphore);
|
|
// Waiting for finishing `block`.
|
|
dispatch_semaphore_wait(uiManagerQueueBlockingSemaphore, DISPATCH_TIME_FOREVER);
|
|
});
|
|
|
|
// Waiting for block on UIManager queue.
|
|
dispatch_semaphore_wait(mainQueueBlockingSemaphore, DISPATCH_TIME_FOREVER);
|
|
pseudoUIManagerQueueFlag = YES;
|
|
// `block` execution while UIManager queue is blocked by semaphore.
|
|
block();
|
|
pseudoUIManagerQueueFlag = NO;
|
|
// Signalling UIManager block.
|
|
dispatch_semaphore_signal(uiManagerQueueBlockingSemaphore);
|
|
} else {
|
|
dispatch_sync(RCTGetUIManagerQueue(), ^{
|
|
block();
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
NSNumber *RCTAllocateRootViewTag(void)
|
|
{
|
|
// Numbering of these tags goes from 1, 11, 21, 31, ..., 100501, ...
|
|
static _Atomic int64_t rootViewTagCounter = 0;
|
|
return @(atomic_fetch_add_explicit(&rootViewTagCounter, 1, memory_order_relaxed) * 10 + 1);
|
|
}
|