# ryandam/infocal architecture

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

- Interactive diagram: https://gitdiagram.com/ryandam/infocal
- Repository: https://github.com/ryandam/infocal

## Overview

a. Data Flow:
- Background Service → Data Factory → Complications
- Settings → Watch Face View → Main Face Components

b. Resource Usage:
- Device Resources → Watch Face View
- Common Resources → Complications

##### Detailed Component Breakdown

a. Complications System (Show as nested components):
- Arc Text Complication
- Bar Complication
- Bar Data Complication
- Graph Complication

b. Main Face Components:
- Analog Dial
- Background View
- Main Dial Hand

##### Resource Stratification
- How resources are organized by device type
- Demonstrate common resource sharing

##### Complication System
- Modular nature of complications
- Data flow from sources to display

##### Background Processing
- How background services interact with the main application
- Weather data update cycle

##### Settings Management
- Demonstrate configuration flow from Garmin Connect to watch face

##### External Services Layer

This structure will effectively communicate both the technical architecture and the user-facing features of the Infocal watch face while maintaining clarity about how different components interact.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#a8d1f0,stroke:#333
    classDef feature fill:#f9d29f,stroke:#333
    classDef resource fill:#c2e0c2,stroke:#333
    classDef external fill:#e6c3e6,stroke:#333
    classDef complication fill:#ffd700,stroke:#333
    classDef mainface fill:#ff9999,stroke:#333
    classDef settings fill:#d3d3d3,stroke:#333

    %% Core Components
    HuwaiiView["Watch Face View Layer"]:::core
    HuwaiiApp["Application Layer"]:::core
    BackgroundService["Background Service Layer"]:::core

    %% Feature Modules
    subgraph ComplicationsSystem["Complications System"]
        BaseComplication["Base Complication"]:::complication
        ArcText["Arc Text Complication"]:::complication
        BarComp["Bar Complication"]:::complication
        BarData["Bar Data Complication"]:::complication
        GraphComp["Graph Complication"]:::complication
    end

    subgraph MainFace["Main Face Components"]
        AnalogDial["Analog Dial"]:::mainface
        BackgroundView["Background View"]:::mainface
        MainDialHand["Main Dial Hand"]:::mainface
    end

    %% Resource Management
    subgraph Resources["Resource Management"]
        CommonRes["Common Resources"]:::resource
        Res218["218x218 Resources"]:::resource
        Res260["260x260 Resources"]:::resource
        Res280["280x280 Resources"]:::resource
        Res390["390x390 Resources"]:::resource
    end

    subgraph Settings["Settings Management"]
        MainSettings["Main Settings"]:::settings
        Properties["Properties"]:::settings
    end

    %% External Services
    Weather(("OpenWeatherMap API")):::external
    GarminConnect(("Garmin Connect")):::external
    Sensors(("Device Sensors")):::external

    %% Data Processing
    DataFactory["Data Factory"]:::core

    %% Relationships
    BackgroundService --> DataFactory
    DataFactory --> ComplicationsSystem
    Settings --> HuwaiiView
    HuwaiiView --> MainFace
    Resources --> HuwaiiView
    Weather --> BackgroundService
    Sensors --> BackgroundService
    GarminConnect --> Settings
    HuwaiiApp --> HuwaiiView
    BaseComplication --> ArcText
    BaseComplication --> BarComp
    BaseComplication --> BarData
    BaseComplication --> GraphComp

    %% Click Events
    click HuwaiiView "https://github.com/RyanDam/Infocal/blob/master/source/HuwaiiView.mc"
    click HuwaiiApp "https://github.com/RyanDam/Infocal/blob/master/source/HuwaiiApp.mc"
    click BackgroundService "https://github.com/RyanDam/Infocal/blob/master/source/BackgroundService.mc"
    click BaseComplication "https://github.com/RyanDam/Infocal/blob/master/source/complication/Complication.mc"
    click ArcText "https://github.com/RyanDam/Infocal/blob/master/source/complication/ArcTextComplication.mc"
    click BarComp "https://github.com/RyanDam/Infocal/blob/master/source/complication/BarComplication.mc"
    click BarData "https://github.com/RyanDam/Infocal/blob/master/source/complication/BarDataComplication.mc"
    click GraphComp "https://github.com/RyanDam/Infocal/blob/master/source/complication/GraphComplication.mc"
    click AnalogDial "https://github.com/RyanDam/Infocal/blob/master/source/mainface/AnalogDial.mc"
    click BackgroundView "https://github.com/RyanDam/Infocal/blob/master/source/mainface/BackgroundView.mc"
    click MainDialHand "https://github.com/RyanDam/Infocal/blob/master/source/mainface/MainDialHand.mc"
    click DataFactory "https://github.com/RyanDam/Infocal/blob/master/source/datafield/DataFactory.mc"
    click CommonRes "https://github.com/RyanDam/Infocal/tree/master/resources/"
    click Res218 "https://github.com/RyanDam/Infocal/tree/master/resources-round-218x218/"
    click Res260 "https://github.com/RyanDam/Infocal/tree/master/resources-round-260x260/"
    click Res280 "https://github.com/RyanDam/Infocal/tree/master/resources-round-280x280/"
    click Res390 "https://github.com/RyanDam/Infocal/tree/master/resources-round-390x390/"
    click MainSettings "https://github.com/RyanDam/Infocal/blob/master/resources/settings/settings.xml"
    click Properties "https://github.com/RyanDam/Infocal/blob/master/resources/settings/properties.xml"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Complications"]:::complication
        L3["Main Face"]:::mainface
        L4["Resources"]:::resource
        L5["External Services"]:::external
        L6["Settings"]:::settings
    end
```
