How anilibapp/anilib works
Project Type and Purpose
• This is a full‑stack Android client app (written in Kotlin + Jetpack Compose) for the AniList GraphQL API.
• Its purpose is to let users track anime/manga, browse details, manage lists, view notifications, and host widgets—all from a mobile interface.
High‑Level File Structure Analysis
• Top‑level “app” module: contains all Android code (UI screens, viewmodels, data services, sources, stores, workers, widgets).
• “i18n” submodule: hosts multi‑language resource strings.
• “buildSrc”: centralizes Gradle dependencies and build helper extensions.
• GraphQL schema & queries under app/src/main/graphql: drives code‑gen of Apollo models & services.
• Standard Android config: manifests, resources, flavors (debug, release, standard), ProGuard rules.
• WorkManager and Widget code under app/src/main/kotlin/.../worker and widget.
Key Architectural Insights from README
• Uses Apollo GraphQL client under the hood for all network calls.
• Employs MVVM: Compose UI screens ← ViewModels ← Services/Repositories ← Apollo.
• Local storage via DataStore (for preferences & filters).
• Background workers for notifications and widget updates.
Main Components to Capture
a. UI Layer
• Jetpack Compose screens & components (e.g., BrowseScreen, MediaScreen, etc.)
• Widgets (AiringScheduleWidgetReceiver → AiringScheduleWidget)
b. ViewModel Layer
• Feature‑specific ViewModels (e.g., BrowseViewModel, MediaViewModel)
• SharedActivityViewModel, BaseViewModel
c. Domain/Service Layer
• Service interfaces & implementations (e.g., MediaServiceImpl)
• Repository modules (ApolloRepositoryImpl)
d. Data Layer
• Apollo GraphQL client
• DataStore stores & serializers (e.g., MediaFilterDataStore)
• PagingSources for network data pagination
e. External Services
• AniList GraphQL API (cloud)
• Google Play services (for push notifications, analytics)
f. Background Workers
• NotificationWorker
• AiringScheduleWidgetWorker
g. Localization Module
• i18n strings resource module
Relationships & Data Flows
• UI → ViewModel: user actions, screen state updates.
• ViewModel → Service/Repository: function calls to fetch data.
• Service → Apollo Client: GraphQL query/mutation over HTTP.
• Apollo → Service: parsed Kotlin models.
• Service → ViewModel → UI: exposed state flows/LiveData.
• ViewModel → DataStore: read/write filter & preference settings.
• Workers → Services: periodic refresh of notifications/widgets.
• Workers → App: send notifications via OS and update widget UI.
Architectural Patterns & Design Principles
• MVVM (separation of UI, state, business logic).
• Layered architecture (UI, ViewModel, Domain, Data).
• Dependency Injection via Modules (RepositoryModule, ServiceModule, WorkerModules).
• Single source of truth for network via Apollo.
• Feature‑based packaging (airing, browse, character, etc.).