- 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
50 lines
1.2 KiB
Swift
50 lines
1.2 KiB
Swift
import ExpoModulesCore
|
|
|
|
protocol CameraEvent {
|
|
var onPictureSaved: EventDispatcher { get }
|
|
}
|
|
|
|
func takePictureForSimulator(
|
|
_ appContext: AppContext?,
|
|
_ event: CameraEvent,
|
|
_ options: TakePictureOptions,
|
|
_ promise: Promise
|
|
) throws {
|
|
if options.fastMode {
|
|
promise.resolve()
|
|
}
|
|
let result = try generatePictureForSimulator(appContext: appContext, options: options)
|
|
|
|
if options.fastMode {
|
|
event.onPictureSaved([
|
|
"data": result,
|
|
"id": options.id
|
|
])
|
|
} else {
|
|
promise.resolve(result)
|
|
}
|
|
}
|
|
|
|
func generatePictureForSimulator(
|
|
appContext: AppContext?,
|
|
options: TakePictureOptions
|
|
) throws -> [String: Any?] {
|
|
let path = FileSystemUtilities.generatePathInCache(
|
|
appContext,
|
|
in: "Camera",
|
|
extension: ".jpg"
|
|
)
|
|
|
|
let generatedPhoto = ExpoCameraUtils.generatePhoto(of: CGSize(width: 200, height: 200))
|
|
guard let photoData = generatedPhoto.jpegData(compressionQuality: options.quality) else {
|
|
throw CameraInvalidPhotoData()
|
|
}
|
|
|
|
return [
|
|
"uri": ExpoCameraUtils.write(data: photoData, to: path),
|
|
"width": generatedPhoto.size.width,
|
|
"height": generatedPhoto.size.height,
|
|
"base64": options.base64 ? photoData.base64EncodedString() : nil
|
|
]
|
|
}
|