feat(smart-app): implement complete mobile app MVP

- 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
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,41 @@
#ifdef RCT_NEW_ARCH_ENABLED
#include "PropsRegistry.h"
namespace reanimated {
std::lock_guard<std::mutex> PropsRegistry::createLock() const {
return std::lock_guard<std::mutex>(mutex_);
}
void PropsRegistry::update(
const ShadowNode::Shared &shadowNode,
folly::dynamic &&props) {
const auto tag = shadowNode->getTag();
const auto it = map_.find(tag);
if (it == map_.cend()) {
// we need to store ShadowNode because `ShadowNode::getFamily`
// returns `ShadowNodeFamily const &` which is non-owning
map_[tag] = std::make_pair(shadowNode, props);
} else {
// no need to update `.first` because ShadowNode's family never changes
// merge new props with old props
it->second.second.update(props);
}
}
void PropsRegistry::for_each(std::function<void(
const ShadowNodeFamily &family,
const folly::dynamic &props)> callback) const {
for (const auto &[_, value] : map_) {
callback(value.first->getFamily(), value.second);
}
}
void PropsRegistry::remove(const Tag tag) {
map_.erase(tag);
}
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,58 @@
#pragma once
#ifdef RCT_NEW_ARCH_ENABLED
#include <react/renderer/components/root/RootShadowNode.h>
#include <react/renderer/core/ShadowNode.h>
#include <unordered_map>
#include <utility>
using namespace facebook;
using namespace react;
namespace reanimated {
class PropsRegistry {
public:
std::lock_guard<std::mutex> createLock() const;
// returns a lock you need to hold when calling any of the methods below
void update(const ShadowNode::Shared &shadowNode, folly::dynamic &&props);
void for_each(std::function<void(
const ShadowNodeFamily &family,
const folly::dynamic &props)> callback) const;
void remove(const Tag tag);
void pleaseSkipReanimatedCommit() {
shouldReanimatedSkipCommit_ = true;
}
bool shouldReanimatedSkipCommit() {
#if REACT_NATIVE_MINOR_VERSION >= 73
// In RN 0.73+ we have a mount hook that will properly unset this flag
// after a non-Reanimated commit.
return shouldReanimatedSkipCommit_;
#else
return shouldReanimatedSkipCommit_.exchange(false);
#endif
}
#if REACT_NATIVE_MINOR_VERSION >= 73
void resetReanimatedSkipCommitFlag() {
shouldReanimatedSkipCommit_ = false;
}
#endif
private:
std::unordered_map<Tag, std::pair<ShadowNode::Shared, folly::dynamic>> map_;
mutable std::mutex mutex_; // Protects `map_`.
std::atomic<bool> shouldReanimatedSkipCommit_;
};
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,71 @@
#ifdef RCT_NEW_ARCH_ENABLED
#include <react/renderer/core/ComponentDescriptor.h>
#include "ReanimatedCommitHook.h"
#include "ReanimatedCommitMarker.h"
#include "ShadowTreeCloner.h"
using namespace facebook::react;
namespace reanimated {
ReanimatedCommitHook::ReanimatedCommitHook(
const std::shared_ptr<PropsRegistry> &propsRegistry,
const std::shared_ptr<UIManager> &uiManager)
: propsRegistry_(propsRegistry), uiManager_(uiManager) {
uiManager_->registerCommitHook(*this);
}
ReanimatedCommitHook::~ReanimatedCommitHook() noexcept {
uiManager_->unregisterCommitHook(*this);
}
RootShadowNode::Unshared ReanimatedCommitHook::shadowTreeWillCommit(
ShadowTree const &,
RootShadowNode::Shared const &,
#if REACT_NATIVE_MINOR_VERSION >= 73
RootShadowNode::Unshared const &newRootShadowNode) noexcept {
#else
RootShadowNode::Unshared const &newRootShadowNode) const noexcept {
#endif
if (ReanimatedCommitMarker::isReanimatedCommit()) {
// ShadowTree commited by Reanimated, no need to apply updates from
// PropsRegistry
return newRootShadowNode;
}
// ShadowTree not commited by Reanimated, apply updates from PropsRegistry
auto rootNode = newRootShadowNode->ShadowNode::clone(ShadowNodeFragment{});
{
auto lock = propsRegistry_->createLock();
propsRegistry_->for_each(
[&](const ShadowNodeFamily &family, const folly::dynamic &props) {
auto newRootNode =
cloneShadowTreeWithNewProps(rootNode, family, RawProps(props));
if (newRootNode == nullptr) {
// this happens when React removed the component but Reanimated
// still tries to animate it, let's skip update for this specific
// component
return;
}
rootNode = newRootNode;
});
}
// If the commit comes from React Native then skip one commit from Reanimated
// since the ShadowTree to be committed by Reanimated may not include the new
// changes from React Native yet and all changes of animated props will be
// applied in ReanimatedCommitHook by iterating over PropsRegistry.
propsRegistry_->pleaseSkipReanimatedCommit();
return std::static_pointer_cast<RootShadowNode>(rootNode);
}
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,51 @@
#pragma once
#ifdef RCT_NEW_ARCH_ENABLED
#include <react/renderer/uimanager/UIManagerCommitHook.h>
#include <memory>
#include "PropsRegistry.h"
using namespace facebook::react;
namespace reanimated {
class ReanimatedCommitHook : public UIManagerCommitHook {
public:
ReanimatedCommitHook(
const std::shared_ptr<PropsRegistry> &propsRegistry,
const std::shared_ptr<UIManager> &uiManager);
~ReanimatedCommitHook() noexcept override;
#if REACT_NATIVE_MINOR_VERSION >= 73
void commitHookWasRegistered(UIManager const &) noexcept override {}
void commitHookWasUnregistered(UIManager const &) noexcept override {}
RootShadowNode::Unshared shadowTreeWillCommit(
ShadowTree const &shadowTree,
RootShadowNode::Shared const &oldRootShadowNode,
RootShadowNode::Unshared const &newRootShadowNode) noexcept override;
#else
void commitHookWasRegistered(UIManager const &) const noexcept override {}
void commitHookWasUnregistered(UIManager const &) const noexcept override {}
RootShadowNode::Unshared shadowTreeWillCommit(
ShadowTree const &shadowTree,
RootShadowNode::Shared const &oldRootShadowNode,
RootShadowNode::Unshared const &newRootShadowNode)
const noexcept override;
#endif
private:
std::shared_ptr<PropsRegistry> propsRegistry_;
std::shared_ptr<UIManager> uiManager_;
};
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,26 @@
#ifdef RCT_NEW_ARCH_ENABLED
#include "ReanimatedCommitMarker.h"
#include <react/debug/react_native_assert.h>
namespace reanimated {
thread_local bool ReanimatedCommitMarker::reanimatedCommitFlag_{false};
ReanimatedCommitMarker::ReanimatedCommitMarker() {
react_native_assert(reanimatedCommitFlag_ != true);
reanimatedCommitFlag_ = true;
}
ReanimatedCommitMarker::~ReanimatedCommitMarker() {
reanimatedCommitFlag_ = false;
}
bool ReanimatedCommitMarker::isReanimatedCommit() {
return reanimatedCommitFlag_;
}
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,23 @@
#pragma once
#ifdef RCT_NEW_ARCH_ENABLED
namespace reanimated {
// This class is used to mark shadow tree commit as coming from Reanimated.
// During the life of this object, isReanimatedCommit() will return true, false
// otherwise. isReanimatedCommit() value change is restricted to the thread that
// created the object.
class ReanimatedCommitMarker {
public:
ReanimatedCommitMarker();
~ReanimatedCommitMarker();
static bool isReanimatedCommit();
private:
static thread_local bool reanimatedCommitFlag_;
};
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,31 @@
#if defined(RCT_NEW_ARCH_ENABLED) && REACT_NATIVE_MINOR_VERSION >= 73
#include "ReanimatedMountHook.h"
#include "ReanimatedCommitMarker.h"
namespace reanimated {
ReanimatedMountHook::ReanimatedMountHook(
const std::shared_ptr<PropsRegistry> &propsRegistry,
const std::shared_ptr<UIManager> &uiManager)
: propsRegistry_(propsRegistry), uiManager_(uiManager) {
uiManager_->registerMountHook(*this);
}
ReanimatedMountHook::~ReanimatedMountHook() noexcept {
uiManager_->unregisterMountHook(*this);
}
void ReanimatedMountHook::shadowTreeDidMount(
RootShadowNode::Shared const &,
double) noexcept {
// When commit from React Native has finished, we reset the skip commit flag
// in order to allow Reanimated to commit its tree
if (!ReanimatedCommitMarker::isReanimatedCommit()) {
propsRegistry_->resetReanimatedSkipCommitFlag();
}
}
} // namespace reanimated
#endif // defined(RCT_NEW_ARCH_ENABLED) && REACT_NATIVE_MINOR_VERSION >= 73

View File

@@ -0,0 +1,33 @@
#pragma once
#if defined(RCT_NEW_ARCH_ENABLED) && REACT_NATIVE_MINOR_VERSION >= 73
#include "PropsRegistry.h"
#include <react/renderer/uimanager/UIManagerMountHook.h>
#include <memory>
namespace reanimated {
using namespace facebook::react;
class ReanimatedMountHook : public UIManagerMountHook {
public:
ReanimatedMountHook(
const std::shared_ptr<PropsRegistry> &propsRegistry,
const std::shared_ptr<UIManager> &uiManager);
~ReanimatedMountHook() noexcept override;
void shadowTreeDidMount(
RootShadowNode::Shared const &rootShadowNode,
double mountTime) noexcept override;
private:
const std::shared_ptr<PropsRegistry> propsRegistry_;
const std::shared_ptr<UIManager> uiManager_;
};
} // namespace reanimated
#endif // defined(RCT_NEW_ARCH_ENABLED) && REACT_NATIVE_MINOR_VERSION >= 73

View File

@@ -0,0 +1,65 @@
#ifdef RCT_NEW_ARCH_ENABLED
#include <utility>
#include "ShadowTreeCloner.h"
namespace reanimated {
ShadowNode::Unshared cloneShadowTreeWithNewProps(
const ShadowNode::Shared &oldRootNode,
const ShadowNodeFamily &family,
RawProps &&rawProps) {
// adapted from ShadowNode::cloneTree
auto ancestors = family.getAncestors(*oldRootNode);
if (ancestors.empty()) {
return ShadowNode::Unshared{nullptr};
}
auto &parent = ancestors.back();
auto &source = parent.first.get().getChildren().at(parent.second);
PropsParserContext propsParserContext{
source->getSurfaceId(), *source->getContextContainer()};
const auto props = source->getComponentDescriptor().cloneProps(
propsParserContext, source->getProps(), std::move(rawProps));
auto newChildNode = source->clone({/* .props = */ props, ShadowNodeFragment::childrenPlaceholder(), source->getState()});
for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
auto &parentNode = it->first.get();
auto childIndex = it->second;
auto children = parentNode.getChildren();
const auto &oldChildNode = *children.at(childIndex);
react_native_assert(ShadowNode::sameFamily(oldChildNode, *newChildNode));
if (!parentNode.getSealed()) {
// Optimization: if a ShadowNode is unsealed, we can directly update its
// children instead of cloning the whole path to the root node.
auto &parentNodeNonConst = const_cast<ShadowNode &>(parentNode);
parentNodeNonConst.replaceChild(oldChildNode, newChildNode, childIndex);
// Unfortunately, `replaceChild` does not update Yoga nodes, so we need to
// update them manually here.
static_cast<YogaLayoutableShadowNode *>(&parentNodeNonConst)
->updateYogaChildren();
return std::const_pointer_cast<ShadowNode>(oldRootNode);
}
children[childIndex] = newChildNode;
newChildNode = parentNode.clone({
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<ShadowNode::ListOfShared>(children),
parentNode.getState()
});
}
return std::const_pointer_cast<ShadowNode>(newChildNode);
}
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED

View File

@@ -0,0 +1,22 @@
#pragma once
#ifdef RCT_NEW_ARCH_ENABLED
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/uimanager/UIManager.h>
#include <memory>
#include <set>
using namespace facebook;
using namespace react;
namespace reanimated {
ShadowNode::Unshared cloneShadowTreeWithNewProps(
const ShadowNode::Shared &oldRootNode,
const ShadowNodeFamily &family,
RawProps &&rawProps);
} // namespace reanimated
#endif // RCT_NEW_ARCH_ENABLED