Backend (Spring Boot 3.2 / Java 21 / PostgreSQL): - JWT auth with BCrypt password hashing - User profile + Mifflin-St Jeor BMR calculator - Food search + barcode via OpenFoodFacts API with local cache - Meal CRUD with user data isolation and ownership checks - AI photo analysis (OpenAI Vision) with confidence intervals - AI correction feedback loop for personalisation - Flyway DB migrations + RFC-7807 error responses Mobile (React Native / TypeScript): - Full navigation stack (Auth → Tabs → Home stack) - Design tokens (WCAG 2.2 AA colours, 8px grid, 48px touch targets) - 10 screens: Login, Register, Home, Search, Camera, AI Result, Edit Meal, Daily Details, History, Profile - Confidence-aware calorie display (kcal ± range) - Repeat last meal shortcut + macro tracking Docs: - docs/PLAN-AND-REQUIREMENTS.md - docs/traceability.csv (35 requirements, all Implemented)
24 lines
685 B
TypeScript
24 lines
685 B
TypeScript
// Generated by GitHub Copilot
|
|
import React, { useEffect, useState } from 'react';
|
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
import Navigator from './src/navigation/AppNavigator';
|
|
|
|
/**
|
|
* App root — checks for a stored JWT to decide the initial navigation route.
|
|
*/
|
|
export default function App() {
|
|
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
useEffect(() => {
|
|
AsyncStorage.getItem('jwt_token').then(token => {
|
|
setIsAuthenticated(!!token);
|
|
setLoading(false);
|
|
});
|
|
}, []);
|
|
|
|
if (loading) return null;
|
|
|
|
return <Navigator isAuthenticated={isAuthenticated} />;
|
|
}
|