- 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
94 lines
2.9 KiB
C++
94 lines
2.9 KiB
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.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <ReactCommon/RuntimeExecutor.h>
|
|
#include <cxxreact/MessageQueueThread.h>
|
|
#include <jserrorhandler/JsErrorHandler.h>
|
|
#include <jsi/jsi.h>
|
|
#include <jsinspector-modern/ReactCdp.h>
|
|
#include <jsireact/JSIExecutor.h>
|
|
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
|
#include <react/runtime/BufferedRuntimeExecutor.h>
|
|
#include <react/runtime/JSRuntimeFactory.h>
|
|
#include <react/runtime/TimerManager.h>
|
|
|
|
namespace facebook::react {
|
|
|
|
struct CallableModule {
|
|
explicit CallableModule(jsi::Function factory)
|
|
: factory(std::move(factory)) {}
|
|
jsi::Function factory;
|
|
};
|
|
|
|
class ReactInstance final : private jsinspector_modern::InstanceTargetDelegate {
|
|
public:
|
|
using BindingsInstallFunc = std::function<void(jsi::Runtime& runtime)>;
|
|
|
|
ReactInstance(
|
|
std::unique_ptr<JSRuntime> runtime,
|
|
std::shared_ptr<MessageQueueThread> jsMessageQueueThread,
|
|
std::shared_ptr<TimerManager> timerManager,
|
|
JsErrorHandler::JsErrorHandlingFunc JsErrorHandlingFunc,
|
|
jsinspector_modern::PageTarget* parentInspectorTarget = nullptr);
|
|
|
|
RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
|
|
|
RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
|
|
|
std::shared_ptr<RuntimeScheduler> getRuntimeScheduler() noexcept;
|
|
|
|
struct JSRuntimeFlags {
|
|
bool isProfiling = false;
|
|
const std::string runtimeDiagnosticFlags = "";
|
|
};
|
|
|
|
void initializeRuntime(
|
|
JSRuntimeFlags options,
|
|
BindingsInstallFunc bindingsInstallFunc) noexcept;
|
|
|
|
void loadScript(
|
|
std::unique_ptr<const JSBigString> script,
|
|
const std::string& sourceURL);
|
|
|
|
void registerSegment(uint32_t segmentId, const std::string& segmentPath);
|
|
|
|
void callFunctionOnModule(
|
|
const std::string& moduleName,
|
|
const std::string& methodName,
|
|
const folly::dynamic& args);
|
|
|
|
void handleMemoryPressureJs(int pressureLevel);
|
|
|
|
/**
|
|
* Unregisters the instance from the inspector. This method must be called
|
|
* on the main (non-JS) thread.
|
|
*/
|
|
void unregisterFromInspector();
|
|
|
|
void* getJavaScriptContext();
|
|
|
|
private:
|
|
std::shared_ptr<JSRuntime> runtime_;
|
|
std::shared_ptr<MessageQueueThread> jsMessageQueueThread_;
|
|
std::shared_ptr<BufferedRuntimeExecutor> bufferedRuntimeExecutor_;
|
|
std::shared_ptr<TimerManager> timerManager_;
|
|
std::unordered_map<std::string, std::shared_ptr<CallableModule>> modules_;
|
|
std::shared_ptr<RuntimeScheduler> runtimeScheduler_;
|
|
JsErrorHandler jsErrorHandler_;
|
|
|
|
// Whether there are errors caught during bundle loading
|
|
std::shared_ptr<bool> hasFatalJsError_;
|
|
|
|
jsinspector_modern::InstanceTarget* inspectorTarget_{nullptr};
|
|
jsinspector_modern::RuntimeTarget* runtimeInspectorTarget_{nullptr};
|
|
jsinspector_modern::PageTarget* parentInspectorTarget_{nullptr};
|
|
};
|
|
|
|
} // namespace facebook::react
|