# Payfrit Food Android Native Android app for the Payfrit Food product intelligence platform. ## What It Does Users scan food product barcodes, get health scores (0-100), NOVA processing classification (1-4), nutrition facts, ingredient analysis, and discover healthier alternatives from sponsors. ## Stack - **Language**: Kotlin - **UI**: Jetpack Compose + Material 3 - **Architecture**: MVVM (ViewModel + StateFlow) - **Networking**: Retrofit 2 + kotlinx.serialization - **Image Loading**: Coil - **Barcode Scanning**: CameraX + ML Kit - **Auth Storage**: EncryptedSharedPreferences (Jetpack Security) - **Min SDK**: 26 (Android 8.0) - **Target SDK**: 34 ## API Base URLs - **Production**: `https://food.payfrit.com/api` - **Dev**: `https://dev.payfrit.com/api` (set via BuildConfig) ## Key Endpoints - `GET /scan.php?barcode=X` — product lookup - `GET /search.php?q=X` — product search - `GET /alternatives.php?productID=X` — healthier alternatives - `POST /user/login.php` — email/password login - `POST /user/register.php` — registration - `GET /user/account.php` — profile - `GET /user/scans.php` — scan history - `GET /user/favorites.php` — favorites list - `POST /user/favorites.php` — add favorite - `DELETE /user/favorites.php?productID=X` — remove favorite - `DELETE /user/account.php` — delete account (GDPR) ## Auth - Bearer token via `Authorization: Bearer ` header - Token stored in EncryptedSharedPreferences - Public endpoints (scan, search, alternatives) work without auth - User endpoints (history, favorites, account) require auth ## Project Structure ``` com.payfrit.food/ ├── PayfritFoodApp.kt # Application class ├── MainActivity.kt # Single activity ├── data/ │ ├── model/Models.kt # All data classes │ ├── local/AuthStorage.kt # Encrypted token storage │ ├── remote/FoodApiClient.kt # Retrofit API client │ └── repository/ # ProductRepository, UserRepository ├── navigation/FoodNavHost.kt # Bottom tab + detail navigation └── ui/ ├── theme/ # Material 3 theme ├── components/ # ScoreRing, NOVABadge, DietaryPills, ProductCard └── screens/ ├── scan/ # Camera barcode scanner + manual entry ├── product/ # Product detail with scores, nutrition, ingredients ├── alternatives/ # Filtered alternatives list with sponsor cards ├── favorites/ # Saved products ├── history/ # Scan history └── account/ # Login/register/profile/GDPR ``` ## Building - Keystore passwords in `keystore.properties` (gitignored) - Debug builds point to dev API - Release builds point to production API