# ayushsingh-22/salesstudio architecture

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

- Interactive diagram: https://gitdiagram.com/ayushsingh-22/salesstudio
- Repository: https://github.com/ayushsingh-22/salesstudio

## Overview

##### Project Type and Purpose
- Sales Studio is an Android TV launcher built with Kotlin and Jetpack Compose.
- It is tailored specifically for Android TV with a focus on usability (enhanced navigation), secure exit via a PIN-protected mechanism, and automated handling of overlay permissions.
- The README clearly identifies key features, including Material Design 3 integration for TV and specialized UI theming.

##### Analyzing the File Structure
- The project consists of a primary "app" module with Android-specific directories:
- The “app/src/main/java/com/example/salesstudio” directory houses most of the business logic and UI components.
- Files like AppInfo.kt, ExitDesign.kt, and design.kt define metadata, exit dialog (PIN-protected) logic, and additional UI component definitions.
- MainActivity.kt serves as the entry point handling the app lifecycle and navigation.
- Additional files and Gradle configurations help set up the build environment, dependency management, and Android manifest which governs app behavior on Android TV devices.

##### Key Architectural Components
a. User Interface Layer:
- MainActivity.kt: Acts as the primary entry point, handling lifecycle events.
- design.kt & Jetpack Compose components: Define UI components and layout, embracing Material Design 3 principles.
b. Security & Permissions:
- ExitDesign.kt: Implements the PIN-protected exit mechanism.
- Permission.kt: Handles overlay permission requests ensuring secure and smooth operations.
c. Application Metadata:
- AppInfo.kt: Provides configuration data and constants used across the application.
d. External Integration:
- Android TV Material 3 (dependency and theming framework) and the Android OS overlay permissions via Permission API.

##### Relationships and Interactions
- Data flow should be depicted from user inputs (e.g., remote control actions) captured in MainActivity to the underlying UI components defined in design.kt.
- Direct interactions:
- MainActivity invokes permission checking via methods in Permission.kt.
- When an exit is attempted (via Back or Home), ExitDesign.kt is triggered to provide a secure PIN validation dialogue.
- Permission management (overlay permissions via Permission.kt).
- Secure exit (ExitDesign.kt) and navigation logic.
- UI rendering components (using Jetpack Compose and design.kt elements).

##### Architectural Patterns and Design Principles
- Modular Design: The clear separation of theming, permission handling, and core app logic promotes maintainability and extensibility.
- Emphasis on device-specific design: The project is engineered with Android TV requirements in mind (large-screen UI, remote navigation, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    TVRemote["Android TV Remote"]:::external
    AndroidOS["Android OS Overlay Permissions"]:::external

    %% User Interface Layer Subgraph
    subgraph "User Interface Layer"
        direction TB
        MainActivity["MainActivity (Entry Point)"]:::uiLayer
        DesignComponents["Design Components (design.kt)"]:::uiComp
        ThemingComponents["Theming & UI Components (ui/theme)"]:::uiComp
    end

    %% Security & Permissions Subgraph
    subgraph "Security & Permissions"
        direction TB
        ExitHandler["PIN-Protected Exit Handler (ExitDesign.kt)"]:::secComp
        PermissionHandler["Overlay Permission Handler (Permission.kt)"]:::secComp
    end

    %% Application Metadata
    AppMetadata["App Configuration & Metadata (AppInfo.kt)"]:::metaComp

    %% External connections
    TVRemote -->|"triggers"| MainActivity

    %% UI Layer connections
    MainActivity -->|"renders_UI"| DesignComponents
    MainActivity -->|"uses_UI_Components"| ThemingComponents
    MainActivity -->|"checks_permission"| PermissionHandler
    MainActivity -->|"calls_exit"| ExitHandler
    MainActivity -->|"reads_metadata"| AppMetadata

    %% Security & Permissions connections
    ExitHandler -->|"exit_success"| MainActivity
    PermissionHandler -->|"calls_OS_permission"| AndroidOS

    %% Click Events
    click MainActivity "https://github.com/ayushsingh-22/salesstudio/blob/main/app/src/main/java/com/example/salesstudio/MainActivity.kt"
    click DesignComponents "https://github.com/ayushsingh-22/salesstudio/blob/main/app/src/main/java/design.kt"
    click ThemingComponents "https://github.com/ayushsingh-22/salesstudio/tree/main/app/src/main/java/com/example/salesstudio/ui/theme"
    click ExitHandler "https://github.com/ayushsingh-22/salesstudio/blob/main/app/src/main/java/com/example/salesstudio/ExitDesign.kt"
    click PermissionHandler "https://github.com/ayushsingh-22/salesstudio/blob/main/app/src/main/java/com/example/salesstudio/ui/theme/Permission.kt"
    click AppMetadata "https://github.com/ayushsingh-22/salesstudio/blob/main/app/src/main/java/com/example/salesstudio/AppInfo.kt"

    %% Styles
    classDef uiLayer fill:#B3E5FC,stroke:#01579B,stroke-width:2px,font-size:12px;
    classDef uiComp fill:#81D4FA,stroke:#01579B,stroke-width:2px,font-size:12px;
    classDef secComp fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px,font-size:12px;
    classDef metaComp fill:#C5E1A5,stroke:#558B2F,stroke-width:2px,font-size:12px;
    classDef external fill:#E1BEE7,stroke:#4A148C,stroke-width:2px,font-size:12px;
```
