# trianguloy/urlcheck architecture

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

- Interactive diagram: https://gitdiagram.com/trianguloy/urlcheck
- Repository: https://github.com/trianguloy/urlcheck

## Overview

##### Main Components
- Android Application Framework – Representing the overall Android runtime and app lifecycle (managed via Gradle, AndroidManifest.xml, etc.).
- Presentation Layer – This includes all the Activities (such as MainActivity, AboutActivity, AutomationActivity, SettingsActivity, etc.), Fragments (like BrowserButtonsFragment), and Dialogs (e.g., MainDialog). All UI elements and layouts (from app/src/main/res/layout, menu, drawable, XML resources) fall under this category.
- Module/Business Logic Layer – Represented by the “modules” package, which encompasses a wide range of modules (both in “list” and “companions” packages). The ModuleManager and individual module components (like ClearUrlModule, DebugModule, UnshortenModule, etc.) encapsulate the core logic for URL manipulation, tracker removal, affiliate cleaning, and additional features.
- Service and Helper Layer – This covers background or cross-cutting concerns such as services (“services” package, e.g., CustomTabs) and utility classes (in the “utilities” package and its nested packages like methods, wrappers, generics). These classes provide common functionality like HTTP requests (HttpUtils), URL processing (UrlUtils), or file and preference handling.
- Assets and Configuration – Include the assets folder (with JSON data files like data.minify.json for configurations or backup info) and Gradle build files (build.gradle, settings.gradle, gradle properties, and other configuration scripts in GitHub/workflows).
- External/Integration Services – Technologies like VirusTotal (referenced in modules/companions/VirusTotalUtility) and possibly external APIs or system services are involved in verifying or modifying URLs.

##### Relationships and Interactions
- The Android runtime initializes the app’s lifecycle components (Activities, Fragments, Dialogs) using configuration provided in the AndroidManifest.xml.
- In the Presentation Layer, when a user interacts (or a URL is captured), the relevant Activity employs the ModuleManager to dispatch the URL into the appropriate business logic modules.
- The ModuleManager controls different individual modules. Each module (e.g., ClearUrlModule, PatternModule, etc.) processes the URL according to its specific functionality (e.g., removing parts of URLs or checking against patterns/hosts).
- Utility classes are used by both the UI and modules to carry out tasks such as HTTP request handling, string manipulation, or interfacing with the Android settings.
- Services like CustomTabs help integrate with external web browsers or APIs (like fetching results from VirusTotal) thereby ensuring that the URL is transformed and verified before routing to external apps.

##### Architectural Patterns and Design Principles
- Modular Design – Each feature is isolated in its own module package (the “modules” folder and its subdirectories), facilitating plug-and-play capabilities.
- Separation of Concerns – Clear distinction between the UI (activities, fragments, dialogs), the business logic modules (ModuleManager and individual modules), and shared utilities.
- Dependency Inversion – The application likely uses dependency injection or a centralized management (via ModuleManager) to orchestrate operations among modules.
- Use of Standard Android Architectural Patterns – Even if not using a formal MVVM or MVP framework, the project design still conceptually separates view (activities and fragments) from business logic (modules and utilities).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Android Application Core
    subgraph "Android Application Core"
        AM1["AndroidManifest.xml"] 
        G1["app/build.gradle"]
        G2["build.gradle"]
        G3["settings.gradle"]
    end

    %% UI/Presentation Layer
    subgraph "UI/Presentation Layer"
        UI1["Activities"]
        UI2["Fragments"]
        UI3["Dialogs"]
        UI4["Layouts & Resources"]
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        BM1["ModuleManager"]
        BM2["List Modules"]
        BM3["Companion Modules"]
    end

    %% Service & Helper Layer
    subgraph "Service & Helper Layer"
        SH1["Services (CustomTabs)"]
        SH2["Utilities (HttpUtils, UrlUtils)"]
    end

    %% Assets & Configuration
    subgraph "Assets & Configuration"
        AC1["Assets Folder"]
    end

    %% External Integration
    subgraph "External Integration"
        EI1["VirusTotal Utility"]
    end

    %% Connections
    AM1 -->|"initializes"| UI1
    G1 -->|"configures"| UI1
    G2 -->|"configures"| UI1
    G3 -->|"configures"| UI1

    UI1 -->|"triggers"| BM1
    UI2 --> BM1
    UI3 --> BM1
    UI4 --> BM1

    BM1 -->|"dispatches"| BM2
    BM1 -->|"dispatches"| BM3

    BM2 -->|"uses"| SH2
    BM1 -->|"utilizes"| SH2

    BM3 -->|"integrates"| EI1
    SH1 -->|"assists"| EI1

    %% Click Events
    click AM1 "https://github.com/trianguloy/urlcheck/blob/master/app/src/main/AndroidManifest.xml"
    click G1 "https://github.com/trianguloy/urlcheck/blob/master/app/build.gradle"
    click G2 "https://github.com/trianguloy/urlcheck/blob/master/build.gradle"
    click G3 "https://github.com/trianguloy/urlcheck/blob/master/settings.gradle"
    
    click UI1 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/activities"
    click UI2 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/fragments"
    click UI3 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/dialogs"
    click UI4 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/res/layout"
    
    click BM1 "https://github.com/trianguloy/urlcheck/blob/master/app/src/main/java/com/trianguloy/urlchecker/modules/ModuleManager.java"
    click BM2 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/modules/list"
    click BM3 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/modules/companions"
    
    click SH1 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/services"
    click SH2 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/java/com/trianguloy/urlchecker/utilities"
    
    click AC1 "https://github.com/trianguloy/urlcheck/tree/master/app/src/main/assets"
    
    click EI1 "https://github.com/trianguloy/urlcheck/blob/master/app/src/main/java/com/trianguloy/urlchecker/modules/companions/VirusTotalUtility.java"

    %% Styles
    classDef android fill:#fce4ec,stroke:#ad1457,stroke-width:2px;
    classDef ui fill:#e3f2fd,stroke:#1565c0,stroke-width:2px;
    classDef business fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef service fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;
    classDef assets fill:#ede7f6,stroke:#5e35b1,stroke-width:2px;
    classDef external fill:#f3e5f5,stroke:#8e24aa,stroke-width:2px;

    class AM1,G1,G2,G3 android;
    class UI1,UI2,UI3,UI4 ui;
    class BM1,BM2,BM3 business;
    class SH1,SH2 service;
    class AC1 assets;
    class EI1 external;
```
