# mptwaktusolat/app_waktu_solat_malaysia architecture

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

- Interactive diagram: https://gitdiagram.com/mptwaktusolat/app_waktu_solat_malaysia
- Repository: https://github.com/mptwaktusolat/app_waktu_solat_malaysia

## Overview

##### Project Overview & Purpose
- This is a full-stack mobile application built with Flutter that displays prayer times for various locations in Malaysia. It also integrates features like feedback submission, updates checking, location determination, and a Qibla/Kompas Kiblat module.
- The app relies on a mix of internal Flutter features (UI, business logic, state management) and external APIs (e.g., Waktu Solat App API, other backup prayer time APIs).

##### Main Architectural Components

a. UI / Presentation Layer:
- Flutter views and widgets contained in the “lib/views” directory. Group related UI pages/components (e.g., Home Page, Settings, Onboarding, Feedback, Kompas Kiblat, and Prayer Time views).
- Modular separation in screens to follow the principle of separation of concerns.

b. Business Logic & State Management:
- “lib/providers” folder which hosts various providers (Locale, Location, Setting, Timetable, Updater). These handle state management and business logic.
- Feature-specific services and controllers (such as update_checker_service for check updates and feedback_submission_service for feedback).
- Directional data flow from these providers into the UI layer.

c. Data & Integration Layer:
- Detail the “lib/networking” folder, which contains API communication logic (e.g., mpt_fetch_api.dart). This connects the app to external prayer time APIs.
- “lib/models” and JSON parsing utilities as part of the data model layer.
- “lib/location_utils” as a module that supports geolocation and location data fetching.

d. Feature Modules:
- Check Updates: Show its models, services, and views, noting its responsibilities for ensuring app version compatibility.
- Feedback: Separate component handling feedback submission.
- Kompas Kiblat: Module for Qibla calculation and sensor integration, including error widgets for device limitations.

e. Asset and Resource Layer:
- “assets” folder (images, fonts, json) which supports the UI.

f. Native & Platform Integration:
- Android-specific components (native integration, Gradle build scripts, and AndroidManifest files from the “android” folder).
- This layer is responsible for platform-specific functionality like scheduling notifications, handling permissions (e.g., alarm/notification permissions), and interfacing with device-level services.

g. External APIs & Services:
- Waktu Solat App API (primary API)
- Other backup prayer time APIs (AzanPro, E-solat JAKIM, etc.)
- Firebase (for push notifications, analytics, if applicable)

##### Relationships & Interactions
- From the UI components to Providers (for user actions).
- From Providers/services to the networking layer (for API calls).
- Between native Android module and Flutter for platform-specific functionality.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI / Presentation Layer
    subgraph "UI / Presentation Layer"
        UI["Flutter Views & Widgets"]:::ui
        homeViews["Home Views"]:::ui
        feedbackViews["Feedback Views"]:::ui
        kompasKiblatViews["Kompas Kiblat Views"]:::ui
        onboardingViews["Onboarding Views"]:::ui
        sharingViews["Sharing Views"]:::ui
    end

    %% Business Logic & State Management
    subgraph "Business Logic & State Management"
        providers["Providers (State Management)"]:::business
        updateChecker["Update Checker Service"]:::business
        feedbackSubmission["Feedback Submission Service"]:::business
    end

    %% Data & Integration Layer
    subgraph "Data & Integration Layer"
        networking["Networking (API Communication)"]:::data
        models["Data Models & JSON Parsing"]:::data
        locationUtils["Location Utilities"]:::data
    end

    %% Feature Modules
    subgraph "Feature Modules"
        checkUpdates["Check Updates Module"]:::feature
        feedbackModule["Feedback Module"]:::feature
        kompasKiblatModule["Kompas Kiblat Module"]:::feature
        onboardingModule["Onboarding Module"]:::feature
        sharingModule["Sharing Module"]:::feature
    end

    %% Asset & Resource Layer
    subgraph "Asset & Resource Layer"
        assets["Assets & Resources"]:::asset
    end

    %% Native & Platform Integration
    subgraph "Native & Platform Integration"
        native["Android Native Components"]:::native
    end

    %% External APIs & Services
    subgraph "External APIs & Services"
        waktuSolatAPI["Waktu Solat App API"]:::external
        backupAPIs["Backup Prayer Time APIs"]:::external
        firebase["Firebase Services"]:::external
    end

    %% Relationships & Data Flow
    UI -->|"userAction"| providers
    homeViews --> UI
    feedbackViews --> UI
    kompasKiblatViews --> UI
    onboardingViews --> UI
    sharingViews --> UI

    providers -->|"API_Call"| networking
    providers -->|"stateUpdate"| UI
    networking -->|"parseData"| models
    locationUtils -->|"provideLocation"| providers

    checkUpdates -->|"triggerUpdate"| updateChecker
    updateChecker -->|"notifyUpdate"| providers
    feedbackModule -->|"submitFeedback"| feedbackSubmission
    feedbackSubmission -->|"notifyFeedback"| providers
    kompasKiblatModule -->|"calculateQibla"| providers
    onboardingModule -->|"initUser"| providers
    sharingModule -->|"shareContent"| providers

    UI -->|"displayFeature"| checkUpdates
    UI -->|"displayFeature"| feedbackModule
    UI -->|"displayFeature"| kompasKiblatModule
    UI -->|"displayFeature"| onboardingModule
    UI -->|"displayFeature"| sharingModule

    networking -->|"fetchData"| waktuSolatAPI
    networking -->|"fetchData"| backupAPIs

    native -->|"platformChannel"| UI
    native -->|"notify"| providers
    firebase -->|"analytics/notifications"| native

    UI -->|"usesAssets"| assets

    %% Click Events
    click UI "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/views"
    click homeViews "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/home/views"
    click feedbackViews "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/feedback/views"
    click kompasKiblatViews "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/kompas_kiblat/views"
    click onboardingViews "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/onboarding/views"
    click sharingViews "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/sharing/views"

    click providers "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/providers"
    click updateChecker "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/blob/master/lib/features/check_updates/services/update_checker_service.dart"
    click feedbackSubmission "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/blob/master/lib/features/feedback/services/feedback_submission_service.dart"

    click networking "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/blob/master/lib/networking/mpt_fetch_api.dart"
    click models "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/models"
    click locationUtils "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/location_utils"

    click checkUpdates "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/check_updates"
    click feedbackModule "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/feedback"
    click kompasKiblatModule "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/kompas_kiblat"
    click onboardingModule "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/onboarding"
    click sharingModule "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/lib/features/sharing"

    click assets "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/assets"
    click native "https://github.com/mptwaktusolat/app_waktu_solat_malaysia/tree/master/android"

    %% Styles
    classDef ui fill:#d0eaff,stroke:#0277bd,stroke-width:2px
    classDef business fill:#dcedc8,stroke:#558b2f,stroke-width:2px
    classDef data fill:#fff9c4,stroke:#f9a825,stroke-width:2px
    classDef feature fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px
    classDef asset fill:#e1bee7,stroke:#8e24aa,stroke-width:2px
    classDef native fill:#ffcc80,stroke:#fb8c00,stroke-width:2px
    classDef external fill:#eeeeee,stroke:#757575,stroke-width:2px
```
