- 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
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
'use strict';
|
|
import { Platform } from 'react-native';
|
|
|
|
// This type is necessary since some libraries tend to do a lib check
|
|
// and this file causes type errors on `global` access.
|
|
type localGlobal = typeof global & Record<string, unknown>;
|
|
|
|
export function isJest(): boolean {
|
|
return !!process.env.JEST_WORKER_ID;
|
|
}
|
|
|
|
// `isChromeDebugger` also returns true in Jest environment, so `isJest()` check should always be performed first
|
|
export function isChromeDebugger(): boolean {
|
|
return (
|
|
(!(global as localGlobal).nativeCallSyncHook ||
|
|
!!(global as localGlobal).__REMOTEDEV__) &&
|
|
!(global as localGlobal).RN$Bridgeless
|
|
);
|
|
}
|
|
|
|
export function isWeb(): boolean {
|
|
return Platform.OS === 'web';
|
|
}
|
|
|
|
export function isAndroid(): boolean {
|
|
return Platform.OS === 'android';
|
|
}
|
|
|
|
function isWindows(): boolean {
|
|
return Platform.OS === 'windows';
|
|
}
|
|
|
|
export function shouldBeUseWeb() {
|
|
return isJest() || isChromeDebugger() || isWeb() || isWindows();
|
|
}
|
|
|
|
export function isFabric() {
|
|
return !!(global as localGlobal)._IS_FABRIC;
|
|
}
|
|
|
|
export function isWindowAvailable() {
|
|
// the window object is unavailable when building the server portion of a site that uses SSG
|
|
// this function shouldn't be used to conditionally render components
|
|
// https://www.joshwcomeau.com/react/the-perils-of-rehydration/
|
|
// @ts-ignore Fallback if `window` is undefined.
|
|
return typeof window !== 'undefined';
|
|
}
|
|
|
|
export function isReducedMotion() {
|
|
return isWeb()
|
|
? isWindowAvailable()
|
|
? // @ts-ignore Fallback if `window` is undefined.
|
|
!window.matchMedia('(prefers-reduced-motion: no-preference)').matches
|
|
: false
|
|
: !!(global as localGlobal)._REANIMATED_IS_REDUCED_MOTION;
|
|
}
|