# zzc10086/tiebalite architecture

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

- Interactive diagram: https://gitdiagram.com/zzc10086/tiebalite
- Repository: https://github.com/zzc10086/tiebalite

## Overview

##### Project type and purpose
- This is an Android mobile client (“Tieba Lite”) for the Baidu Tieba service. It’s a single APK that implements its own UI (XML + Jetpack Compose), an MVVM architecture, networking via Retrofit & Protobuf, local persistence (SQLite via LitePal and DataStore), and background tasks (JobService, BroadcastReceiver).

##### File structure
- Top-level “app” module: AndroidManifest, assets (JS scripts, JSON, XML), src/main/java structure
- Packages:
- ui & components: Activities/Fragments/Compose widgets
- arch: BaseViewModel, PartialChange, UiIntent/UiState → MVVM core
- repository: data‐source façade classes
- api: domain API interfaces & models + adapters/casters
- api/retrofit: RetrofitTiebaApi, converters, call adapters, interceptors
- models/database: LitePal entities, DataStore
- services & receivers: background job triggers and execution
- utils: utility functions
- Build files: Gradle Kotlin DSL, Protobuf definitions under src/main/protos, LitePal config, proguard rules

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Platform Layer"
        OS["Android OS"]:::os
    end

    subgraph "External Services"
        External["Baidu Tieba Servers (HTTP/Protobuf)"]:::external
    end

    subgraph "Application Layer"
        AppConfig["App Entry & Config"]:::config
        Utils["Utilities & Cross-Cutting Concerns"]:::util
        Assets["Assets & Scripts"]:::assets
    end

    subgraph "UI Layer"
        UI["UI Layer (Activities/Fragments)"]:::ui
        Compose["Compose & XML Widgets"]:::ui
    end

    subgraph "ViewModel Layer"
        VMCore["MVVM Core (BaseViewModel, Intent/State)"]:::vm
        ScreenVM["Screen ViewModels"]:::vm
    end

    subgraph "Repository Layer"
        Repo["Repository Layer"]:::repo
    end

    subgraph "API Layer"
        DomainAPI["Domain API Interfaces & Models"]:::api
        Retrofit["Retrofit Client & Adapters"]:::api
        Protobuf["Protobuf Definitions"]:::api
    end

    subgraph "Local Data Layer"
        LocalDB["SQLite (LitePal Entities)"]:::db
        DataStore["Jetpack DataStore"]:::db
    end

    subgraph "Background Tasks"
        Receivers["Broadcast Receivers & Alarms"]:::svc
        Services["Background Services (JobService/TileService)"]:::svc
    end

    %% Connections
    OS --> UI
    UI --> Compose
    UI --> ScreenVM
    Compose --> ScreenVM
    ScreenVM --> VMCore
    ScreenVM --> Repo
    Repo --> DomainAPI
    Repo --> LocalDB
    Repo --> DataStore
    DomainAPI --> Retrofit
    DomainAPI --> Protobuf
    Retrofit --> External
    Receivers --> Services
    Services --> Repo
    Assets --> UI
    AppConfig --> UI
    AppConfig --> Receivers
    AppConfig --> Services
    Utils --> Repo
    Utils --> Retrofit
    Utils --> ScreenVM

    %% Click Events
    click UI "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/ui"
    click Compose "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/ui/widgets"
    click Compose "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/res/layout"
    click VMCore "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/arch"
    click ScreenVM "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/ui/page"
    click Repo "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/repository"
    click DomainAPI "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/ITiebaApi.kt"
    click DomainAPI "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/LiteApi.kt"
    click DomainAPI "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/TiebaApi.kt"
    click DomainAPI "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/models"
    click Retrofit "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/RetrofitTiebaApi.kt"
    click Retrofit "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/adapter"
    click Retrofit "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/converter"
    click Retrofit "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interceptors"
    click Protobuf "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/protos"
    click LocalDB "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/models/database"
    click DataStore "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/DataStore.kt"
    click Services "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/services/NotifyJobService.kt"
    click Services "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/services/OKSignService.kt"
    click Services "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/services/OKSignTileService.java"
    click Receivers "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/receivers/AutoSignAlarm.kt"
    click Receivers "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/receivers/BootCompleteSignReceiver.kt"
    click Assets "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/assets"
    click Utils "https://github.com/zzc10086/tiebalite/tree/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/utils"
    click AppConfig "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/App.kt"
    click AppConfig "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/java/com/huanchengfly/tieba/post/Consts.kt"
    click AppConfig "https://github.com/zzc10086/tiebalite/blob/4.0-dev/app/src/main/AndroidManifest.xml"

    %% Styles
    classDef ui fill:#0099ff,stroke:#0066cc,color:#fff;
    classDef vm fill:#00cc44,stroke:#009933,color:#fff;
    classDef repo fill:#ff9933,stroke:#cc7a00,color:#fff;
    classDef api fill:#ff3333,stroke:#cc0000,color:#fff;
    classDef db fill:#bbbbbb,stroke:#888888,color:#000;
    classDef svc fill:#999999,stroke:#666666,color:#000;
    classDef os fill:#eeeeee,stroke:#cccccc,color:#000;
    classDef external fill:#dddddd,stroke:#aaaaaa,color:#000;
    classDef config fill:#ccccff,stroke:#8888cc,color:#000;
    classDef util fill:#ffff99,stroke:#cccc66,color:#000;
    classDef assets fill:#ccffcc,stroke:#88cc88,color:#000;
```
