How chimple/crcontainer works
Project type and purpose
• CRcontainer is an Android full-stack client application (a “container” web browser) that runs on mobile. It displays web-based literacy content packaged by Curious Learning, persisting a manifest locally and fetching updates remotely.
Top-level architectural overview
• This is an Android MVVM-style architecture with the following layers:
• Presentation (Activities, Adapters, ViewModels)
• Domain/Business (WebAppRepository)
• Data (Local database via Room, Remote API via Retrofit)
• External services (Firebase, Install Referrer, Slack, etc.)
• Utilities (image loading, caching, deep-linking, config loading)
Main components
A. User Interface Layer (on the left)
– MainActivity & other BaseActivity subclasses
– WebAppActivity (hosts WebView)
– RecyclerView with WebAppsAdapter
– Language & settings pop-ups
B. Presentation/ViewModel Layer
– HomeViewModel (coordinates UI requests)
C. Repository/Domain Layer
– WebAppRepository (single source of truth)
D. Data Sources Layer
– Local Database (Room)
• WebAppDatabase
• WebAppDao
• Entities: WebApp, AppManifest
– Remote API (Retrofit)
• RetrofitInstance → ApiService → WebAppResponse
E. External Services & SDKs
– Firebase Analytics (AnalyticsUtils)
– Install Referrer (InstallReferrerManager)
– Slack notifications (SlackUtils)
F. Utilities & Helpers
– ConfigLoader (loads web_apps_manifest.json from assets)
– DeepLinkHelper (handles external URIs)
– CacheUtils, ImageLoader, AudioPlayer, etc.
Interactions and data flow
2. ViewModel → Repository: request list of WebApps
3. Repository checks Local DB (WebAppDao) → if stale or missing, calls Remote API (Retrofit)
4. RetrofitInstance fetches WebAppResponse → Repository saves to Local DB → returns data
7. WebAppActivity loads WebView with remote content
8. Utilities & SDKs are invoked as needed (e.g., AnalyticsUtils.logEvent, InstallReferrerManager.retrieveReferrer)
Architectural patterns & design principles
• MVVM separation of concerns
• Single source of truth in Repository
• Clean layering: Presentation → Domain → Data
• Dependency inversion: Activities & ViewModels depend on abstractions (Repository, DAO, ApiService)
• Local cache + remote fallback pattern
• Use of Android Jetpack components (Room, LiveData)