# bharathbhargavgb/digital-quarantine architecture

> Architecture diagram of the GitHub repository bharathbhargavgb/digital-quarantine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bharathbhargavgb/digital-quarantine
- Repository: https://github.com/bharathbhargavgb/digital-quarantine

## Overview

- User preferences → BrightnessManager
- MischiefMonitor → BrightnessManager
- EventMonitor → Core Services

- BrightnessManager → DDC
- BrightnessManager → System Brightness Controls

##### Key Architectural Elements to Highlight

a. Persistence:
- User Preferences Storage
- System Launch Configuration

b. System Integration:
- External Monitor Support
- Auto-launch Mechanism
- System Event Handling

##### Additional Details

- Installer component separately
- Test coverage boundaries
- System permission requirements

##### The monitoring and intervention cycle

- The complete flow from user interaction to system response
- The intervention cycle (20-20-20 rule implementation)
- The failsafe mechanisms
- The preference management system
- The external monitor support architecture

Remember to include a brief textual description of critical paths and any special considerations for future maintenance or updates.

This design should reflect both the technical architecture and the application's core purpose of enforcing digital wellbeing through controlled system manipulation.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef system fill:#e67e22,stroke:#d35400,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef persistence fill:#9b59b6,stroke:#8e44ad,color:white

    %% UI Layer
    subgraph UI
        AppEntry["Status Bar Entry Point"]
        MainView["Main View Controller"]
        PrefDialog["Preference Dialog"]
        UILayout["UI Layout"]
    end

    %% Core Services Layer
    subgraph CoreServices
        BrightMgr["Brightness Manager"]
        MischMon["Mischief Monitor"]
        EventMon["Event Monitor"]
        UserPref["User Preferences"]
        Constants["Constants/Config"]
        Utility["Utility Functions"]
    end

    %% System Integration Layer
    subgraph SystemIntegration
        DDCInt["DDC Integration"]
        LaunchD["Launch Daemon"]
        SysBright["System Brightness Controls"]
    end

    %% Security Zone
    subgraph SecurityZone
        NoQuit["No-Quit Protection"]
        AutoRestart["Auto-Restart"]
        Override["Override Prevention"]
    end

    %% Persistence Layer
    subgraph Persistence
        PrefStorage["Preferences Storage"]
        SysConfig["System Configuration"]
    end

    %% Relationships
    AppEntry --> MainView
    AppEntry --> PrefDialog
    MainView --> BrightMgr
    PrefDialog --> UserPref
    BrightMgr --> DDCInt
    BrightMgr --> SysBright
    MischMon --> BrightMgr
    EventMon --> BrightMgr
    UserPref --> BrightMgr
    UserPref --> PrefStorage
    LaunchD --> AutoRestart
    Constants --> BrightMgr
    Constants --> MischMon
    Utility --> CoreServices

    %% Click Events
    click MainView "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/ViewController.swift"
    click PrefDialog "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/PreferenceViewController.swift"
    click UILayout "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/Base.lproj/Main.storyboard"
    click BrightMgr "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/BrightnessManager.swift"
    click MischMon "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/MischiefMonitor.swift"
    click EventMon "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/EventMonitor.swift"
    click UserPref "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/UserPreferences.swift"
    click DDCInt "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/DDC.swift"
    click LaunchD "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/installer/Scripts/com.unnecessary-labs.mac.DQ.plist"
    click AppEntry "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/AppDelegate.swift"
    click Constants "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/Constants.swift"
    click Utility "https://github.com/bharathbhargavgb/digital-quarantine/blob/master/Digital Quarantine/Utility.swift"

    %% Style Applications
    class AppEntry,MainView,PrefDialog,UILayout ui
    class BrightMgr,MischMon,EventMon,UserPref,Constants,Utility core
    class DDCInt,LaunchD,SysBright system
    class NoQuit,AutoRestart,Override security
    class PrefStorage,SysConfig persistence

    %% Legend
    subgraph Legend
        UI_Comp["UI Component"]:::ui
        Core_Comp["Core Service"]:::core
        Sys_Comp["System Integration"]:::system
        Sec_Comp["Security Feature"]:::security
        Per_Comp["Persistence"]:::persistence
    end
```
