# you-apps/wallyou architecture

> Architecture diagram of the GitHub repository you-apps/wallyou, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/you-apps/wallyou
- Repository: https://github.com/you-apps/wallyou

## Overview

##### Main Components
- Android Application Core – This includes the overall mobile app structure and lifecycle (the “app” folder with its AndroidManifest, Gradle builds, and resources).
- Presentation Layer – Represented by activities (MainActivity, BaseActivity) and UI components (dialogs, bottom bar components, custom views, etc.) under the “ui” directory. Also include navigation components (AppNavHost, DrawerScreens) and pages (AboutPage, WallpaperPage, FavoritesPage, etc.).
- Business Logic & Models – Encompassing the view models (MainModel, WallpaperHelperModel), extension utilities (in the “ext” and “util” packages), and the theme management (WallYouTheme, Type).
- Data Layer – Comprising the local database (AppDatabase, DatabaseHolder, DAO interfaces like FavoritesDao) and schema definition (the “schemas” folder), as well as shared preferences and file storage support for functionalities such as backup, history, and favorites.
- API Integration Layer – A significant portion of the project is dedicated to managing external wallpaper and image sources. Represent these as a set of API modules grouped in the “api” package. Submodules include integrations for different services (e.g., “bi” for Bing, “le” for Lemmy, “na” for NASA, “ps” for Picsum, “px” for Pixel, “re” for Reddit, “sp” for Spotlight, “us” for Unsplash, “wh” for Wallhaven, “wi” for WikiPOTD, etc.). This layer handles networking, parsing, and interacting with external RESTful services.
- Background Services – Include components like BackgroundWorker, WallpaperChangerTileService, and any utilities that help schedule tasks or perform background image downloads and updates.
- External Dependencies/Build Configs – Noting the build system (Gradle with Kotlin DSL) and integration with continuous integration (CI workflows in .github/workflows) and deployment scripts (Fastlane configs). These illustrate aspects related to automated testing, building, and release management.

##### Relationships and Interactions
- The Business Logic makes calls to both the Data Layer (for local persistence of favorites, wallpapers, user preferences) and the API Integration Layer (to fetch wallpapers from external sources).
- The API Integration modules are interfaced by a centralized Retrofit-like helper (as seen in RetrofitHelper.kt) that abstracts the network requests.
- The Data Layer (including the database and schema) communicates with the Business Logic for caching and providing offline data.

##### Architectural Patterns and Design Principles
- Modular Organization: The clear separation between API, UI, and Data modules suggests a layered design (often aligned with MVVM or Clean Architecture principles).
- Separation of Concerns: Each group of components (UI, business logic, data, external API integration) is in its own package, emphasizing modularity and testability.
- Asynchronous Processing: Background services and workers indicate an asynchronous design that updates wallpapers and performs network operations off the main thread.

##### Technologies, Frameworks, and Libraries
- Kotlin (evident from the Kotlin Gradle scripts and file names).
- Android SDK with Material Design 3 (MD3) for UI.
- Retrofit or similar HTTP client (as suggested by RetrofitHelper) for networking.
- Room or an equivalent ORM for the local database.
- External API libraries or JSON parsers integrated for each API channel.
- Fastlane for deployment and CI/CD workflows managed via GitHub Actions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Android Application Core"
        Core1["AndroidManifest.xml"]
        Core2["Gradle Build Files"]
    end

    subgraph "Presentation Layer"
        UI1["UI Activities"]
        UI2["UI Components"]
        UI3["Navigation"]
        UI4["Pages"]
    end

    subgraph "Business Logic & Models"
        Logic1["View Models"]
        Logic2["Extension Utilities"]
        Logic3["Theme Management"]
        Logic4["Other Utilities"]
    end

    subgraph "Data Layer"
        Data1["Local Database & DAOs"]
        Data2["Schema Definitions"]
    end

    subgraph "API Integration Layer"
        API1["API Modules"]
        API2["Centralized Networking"]
    end

    subgraph "Background Services"
        Back1["Background Workers & Services"]
        Back2["System Receivers"]
    end

    subgraph "External Dependencies / Build Configs"
        BS1["build.gradle.kts"]
        BS2["app/build.gradle.kts"]
        BS3["settings.gradle"]
        BS4["gradle.properties"]
        CD["CI/CD Workflows"]
        DP["Deployment Scripts"]
    end

    %% Connections
    Core1 -->|"supports"| UI1
    Core2 -->|"defines"| BS2
    UI1 -->|"triggers"| Logic1
    UI3 -->|"handles"| UI4
    Logic1 -->|"queries"| Data1
    Logic1 -->|"fetches"| API1
    Logic4 -->|"utilizes"| API2
    Back1 -->|"updates"| Data1
    Back1 -->|"calls"| API1

    %% Click Events
    click Core1 "https://github.com/you-apps/wallyou/blob/main/app/src/main/AndroidManifest.xml"
    click Core2 "https://github.com/you-apps/wallyou/blob/main/app/build.gradle.kts"
    click UI1 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ui/activities"
    click UI2 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ui/components"
    click UI3 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ui/nav"
    click UI4 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ui/pages"
    click Logic1 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ui/models"
    click Logic2 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ext"
    click Logic3 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/ui/theme"
    click Logic4 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/util"
    click Data1 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/db"
    click Data2 "https://github.com/you-apps/wallyou/blob/main/app/schemas/com.bnyro/wallpaper.db.AppDatabase"
    click API1 "https://github.com/you-apps/wallyou/tree/main/app/src/main/java/com/bnyro/wallpaper/api"
    click API2 "https://github.com/you-apps/wallyou/blob/main/app/src/main/java/com/bnyro/wallpaper/api/Api.kt"
    click Back1 "https://github.com/you-apps/wallyou/blob/main/app/src/main/java/com/bnyro/wallpaper/util/BackgroundWorker.kt"
    click Back2 "https://github.com/you-apps/wallyou/blob/main/app/src/main/java/com/bnyro/wallpaper/receivers/BootReceiver.kt"
    click BS1 "https://github.com/you-apps/wallyou/blob/main/build.gradle.kts"
    click BS2 "https://github.com/you-apps/wallyou/blob/main/app/build.gradle.kts"
    click BS3 "https://github.com/you-apps/wallyou/blob/main/settings.gradle"
    click BS4 "https://github.com/you-apps/wallyou/blob/main/gradle.properties"
    click CD "https://github.com/you-apps/wallyou/tree/main/.github/workflows"
    click DP "https://github.com/you-apps/wallyou/tree/main/fastlane"

    %% Styling
    classDef core fill:#FFDDC1,stroke:#333,stroke-width:2px;
    classDef ui fill:#C1FFC1,stroke:#333,stroke-width:2px;
    classDef logic fill:#C1D4FF,stroke:#333,stroke-width:2px;
    classDef data fill:#FFFACD,stroke:#333,stroke-width:2px;
    classDef api fill:#FFD1DC,stroke:#333,stroke-width:2px;
    classDef background fill:#E0FFFF,stroke:#333,stroke-width:2px;
    classDef build fill:#FDE2FF,stroke:#333,stroke-width:2px;

    class Core1,Core2 core;
    class UI1,UI2,UI3,UI4 ui;
    class Logic1,Logic2,Logic3,Logic4 logic;
    class Data1,Data2 data;
    class API1,API2 api;
    class Back1,Back2 background;
    class BS1,BS2,BS3,BS4,CD,DP build;
```
