How nhoxbypass/fastfoodfinder works
Project Type and Purpose
• Fastfood Finder is an Android mobile application (client-side) that locates nearby fast‐food and convenience stores for users.
• It uses an MVPC (Model‑View‑Presenter‑Contract) architecture, layered modularization via Gradle multi‑modules, and integrates remote APIs (Firebase Auth/Store, Google Maps Directions), local persistence (Realm DB + SharedPreferences), background tasks (WorkManager), and cross‐component communication (EventBus).
File Structure
• Top-level Gradle modules:
• app – Android application module (UI, presenters, services)
• core/… – six core libraries (analytics, common utilities, location, logger, network, notifications, worker abstractions)
• data/… – four data modules (database, datastore, model, stores)
• app/src/main/java/com/iceteaviet/fastfoodfinder:
• ui/… – Activities, Fragments organized by feature (login, main, profile, store info, routing, settings, etc.)
• service/… – SyncService, WorkManager workers, EventBus
• data/… – DataManager and domain repositories (user, store, prefs, routing)
• data/local/… – DAOs, data sources, entities
• data/remote/… – API helpers for Firebase and Google Maps routing
• location/… – ILocationManager abstractions + implementations
• utils/… – app‑wide helper classes + Rx schedulers
• app/src/mock and app/src/prod – flavor-specific injection + fake implementations for testing
• tests cover presenters, data managers, DAOs, API helpers
README Insights
• Confirms MVPC architecture, SOLID principles, and heavy use of JUnit/Mockito for unit tests.
• Key libraries: Retrofit (network), Glide (images), WorkManager, RxJava2, EventBus, Realm.
a. Main Components
1. UI Layer (Activities, Fragments + Views + Contracts)
2. Presenter Layer (Presenters implementing business logic, invoking DataManager)
3. Service Layer
• SyncService & SyncDatabaseWorker (WorkManager)
• EventBus (RobotBus)
4. Data Layer
– DataManager (AppDataManager implements DataManager)
– Domain Repositories (UserRepository, StoreRepository, RoutingRepository, PreferencesRepository)
– Local Sources: Realm DB DAOs & SharedPreferences Helper
– Remote Sources:
• FirebaseAuth, FirebaseUserApiHelper, FirebaseStoreApiHelper
• GoogleMapsRoutingApiHelper using Retrofit
5. Core Libraries
– core/network (Retrofit + OkHttp abstraction)
– core/location (ILocationManager)
– core/worker (ComputationWorker, IOWorker, SerialWorker)
– core/common, core/logger, core/notifications, core/analytics
6. External Services
– Firebase (Auth, Firestore/Database)
– Google Maps Directions API
b. Relationships & Interactions
• UI invokes Presenter methods; Presenter calls DataManager.
• DataManager orchestrates calls to LocalSource and RemoteSource, returns Observables via RxJava.
• On app start or user actions, LocationManager fetches GPS coordinates; Presenter triggers routing via RoutingRepository->GoogleMaps API.
• SyncService schedules periodic SyncDatabaseWorker to sync remote store/user data into local DB.
• EventBus carries search results or background events back to UI.
c. Architectural Patterns & Principles
• MVPC pattern separates Views, Presenters, and Contracts.
• Repository pattern for DataManager with clear local/remote splits.
• Dependency Injection (Injection.kt) differentiates prod vs. mock for testing.
• SOLID: single‐responsibility modules (core, data, app), Interface-based abstractions (ILocationManager, DataManager).
d. Key Technologies & Frameworks
• Retrofit2 (HTTP client)
• Realm (local DB) + SharedPreferences
• WorkManager & Worker abstractions (core/worker)
• RxJava2 & SchedulerProvider
• EventBus (greenrobot)
• Glide (image loading)
Detailed Capture of Architectural Elements
• Injection component providing dependencies to Presenter and DataManager.
• EventBus as a bi‐directional bus between Service & UI.
• WorkManager scheduler invoking SyncDatabaseWorker, feeding into DataManager local DB.