- 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
67 lines
2.2 KiB
JavaScript
67 lines
2.2 KiB
JavaScript
import { Platform } from 'expo-modules-core';
|
|
import { PixelRatio } from 'react-native';
|
|
// Returns the Metro dev server-specific asset location.
|
|
function getScaledAssetPath(asset) {
|
|
const scale = AssetSourceResolver.pickScale(asset.scales, PixelRatio.get());
|
|
const scaleSuffix = scale === 1 ? '' : '@' + scale + 'x';
|
|
const type = !asset.type ? '' : `.${asset.type}`;
|
|
if (__DEV__) {
|
|
return asset.httpServerLocation + '/' + asset.name + scaleSuffix + type;
|
|
}
|
|
else {
|
|
return asset.httpServerLocation.replace(/\.\.\//g, '_') + '/' + asset.name + scaleSuffix + type;
|
|
}
|
|
}
|
|
export default class AssetSourceResolver {
|
|
serverUrl;
|
|
// where the jsbundle is being run from
|
|
// NOTE(EvanBacon): Never defined on web.
|
|
jsbundleUrl;
|
|
// the asset to resolve
|
|
asset;
|
|
constructor(serverUrl, jsbundleUrl, asset) {
|
|
this.serverUrl = serverUrl || 'https://expo.dev';
|
|
this.jsbundleUrl = null;
|
|
this.asset = asset;
|
|
}
|
|
// Always true for web runtimes
|
|
isLoadedFromServer() {
|
|
return true;
|
|
}
|
|
// Always false for web runtimes
|
|
isLoadedFromFileSystem() {
|
|
return false;
|
|
}
|
|
defaultAsset() {
|
|
return this.assetServerURL();
|
|
}
|
|
/**
|
|
* @returns absolute remote URL for the hosted asset.
|
|
*/
|
|
assetServerURL() {
|
|
const fromUrl = new URL(getScaledAssetPath(this.asset), this.serverUrl);
|
|
fromUrl.searchParams.set('platform', Platform.OS);
|
|
fromUrl.searchParams.set('hash', this.asset.hash);
|
|
return this.fromSource(
|
|
// Relative on web
|
|
fromUrl.toString().replace(fromUrl.origin, ''));
|
|
}
|
|
fromSource(source) {
|
|
return {
|
|
__packager_asset: true,
|
|
width: this.asset.width ?? undefined,
|
|
height: this.asset.height ?? undefined,
|
|
uri: source,
|
|
scale: AssetSourceResolver.pickScale(this.asset.scales, PixelRatio.get()),
|
|
};
|
|
}
|
|
static pickScale(scales, deviceScale) {
|
|
for (let i = 0; i < scales.length; i++) {
|
|
if (scales[i] >= deviceScale) {
|
|
return scales[i];
|
|
}
|
|
}
|
|
return scales[scales.length - 1] || 1;
|
|
}
|
|
}
|
|
//# sourceMappingURL=AssetSourceResolver.js.map
|