# mesibo/messenger-app-android architecture

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

- Interactive diagram: https://gitdiagram.com/mesibo/messenger-app-android
- Repository: https://github.com/mesibo/messenger-app-android

## Overview

##### Main Components
- Business Logic and Application Layer: The core application classes such as MainApplication.java, AppConfig.java, AppSettings, and various utility classes encapsulate the application’s business logic.
- Mesibo SDK Integration: The project integrates Mesibo SDKs (as noted in the README) that provide messaging, file transfer (MesiboFileTransferHelper), and call UI modules. This layer abstracts the real-time communication functionality.
- Background and Notification Services: Inside the source tree, there are several service classes (e.g., MesiboGcmListenerService, MesiboRegistrationIntentService, MesiboJobIntentService) that deal with Firebase/Google Cloud Messaging for push notifications, a critical component for real-time updates.
- External Services & APIs: The app uses Google Maps and Google Places SDKs for geolocation features, and pushes OTP generation using Mesibo’s backend (as described in the README). Although the backend code is hosted separately, it interacts with this client-side messenger app.

##### Component Relationships and Interactions
- The UI Layer interacts with the business logic (activities and fragments call utility functions and services) and directly initiates operations exposed by the Mesibo SDK (e.g., sending messages, starting calls).
- The Mesibo SDK Component bridges the app’s business logic with the remote real-time messaging infrastructure. It handles tasks like managing messaging sessions, file transfers, and call setup.
- Background Services (FCM-related classes) are triggered by system events (e.g., receipt of a push notification) and then communicate with the Mesibo SDK or update the UI via notifications.
- External APIs such as Google Maps/Places are invoked when location-based features are used (for example, sharing location during chat).

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project clearly segregates UI (activities, fragments, XML layout) from business logic and SDK integration. This separation enhances maintainability and testing.
- Modular and Service-oriented Approach: By isolating functionalities (messaging, notifications, file transfer, geolocation) into dedicated classes and packages, the project achieves a modular design.
- Use of Android Lifecycle Components: The presence of MainApplication and various Activity classes suggests alignment with Android’s architectural practices, even if not strictly MVVM or MVP, ensuring clean state management.

##### Technologies, Frameworks, and Libraries
- Android SDK and Gradle Build System (the project utilizes Gradle build files and configuration scripts)
- Mesibo SDKs: Core for real-time messaging, Messaging UI Module, and Call UI Module.
- Firebase/Google Cloud Messaging for push notifications.
- Google Maps and Google Places SDKs for geolocation.
- Standard Android frameworks for UI (activities, fragments, layouts, resources).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global Entities
    U("User"):::external

    %% Presentation Layer
    subgraph "Presentation Layer (Android UI)"
        A1("StartUpActivity"):::ui
        A2("EditProfileActivity"):::ui
        A3("SettingsActivity"):::ui
        F1("AboutFragment"):::ui
        F2("BasicSettingsFragment"):::ui
        F3("DataUsageFragment"):::ui
        F4("EditProfileFragment"):::ui
        L1("XML Layout Resources"):::ui
    end

    %% Business Logic & Application Layer
    subgraph "Business Logic & Application Layer"
        B1("MainApplication.java"):::business
        B2("AppConfig.java"):::business
        B3("AppSettings"):::business
        B4("AppUtils.java"):::business
        B5("NotifyUser.java"):::business
        B6("UIManager.java"):::business
        B7("UIListener.java"):::business
        B8("SampleAPI.java"):::business
    end

    %% Mesibo SDK Integration
    subgraph "Mesibo SDK Integration"
        M1("MesiboFileTransferHelper.java"):::sdk
        M2("MesiboListeners.java"):::sdk
    end

    %% Background and Notification Services
    subgraph "Background and Notification Services"
        S1("MesiboGcmListenerService.java"):::services
        S2("MesiboInstanceIDListenerService.java"):::services
        S3("MesiboJobIntentService.java"):::services
        S4("MesiboRegistrationIntentService.java"):::services
    end

    %% External Services & APIs
    subgraph "External Services & APIs"
        E1("Mesibo Backend & OTP"):::external
        E2("Google Maps & Places"):::external
        E3("Firebase/GoogleCloudMessaging"):::external
    end

    %% Connections
    U -->|"initiates"| A1
    A1 -->|"triggers"| B1
    A2 -->|"triggers"| B1
    F1 -->|"communicates"| B1
    F2 -->|"communicates"| B1
    F3 -->|"communicates"| B1
    F4 -->|"communicates"| B1
    L1 -->|"provides resource"| A1

    B1 -->|"delegates"| B6
    B6 -->|"invokes"| M1
    M1 -->|"communicates"| E1
    B8 -->|"calls"| E1

    M2 -->|"receives"| E3

    S1 -.->|"pushNotify"| A1
    S2 -.->|"pushNotify"| A1
    S3 -.->|"pushNotify"| A1
    S4 -.->|"pushNotify"| A1

    A2 -->|"sharesLocation"| E2

    %% Click Events for UI Layer
    click A1 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/StartUpActivity.java"
    click A2 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/EditProfileActivity.java"
    click A3 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/SettingsActivity.java"
    click F1 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/AppSettings/AboutFragment.java"
    click F2 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/AppSettings/BasicSettingsFragment.java"
    click F3 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/AppSettings/DataUsageFragment.java"
    click F4 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/AppSettings/EditProfileFragment.java"
    click L1 "https://github.com/mesibo/messenger-app-android/tree/master/app/src/main/res/layout"

    %% Click Events for Business Logic & Application Layer
    click B1 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/MainApplication.java"
    click B2 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/AppConfig.java"
    click B3 "https://github.com/mesibo/messenger-app-android/tree/master/app/src/main/java/org/mesibo/messenger/AppSettings/"
    click B4 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/Utils/AppUtils.java"
    click B5 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/NotifyUser.java"
    click B6 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/UIManager.java"
    click B7 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/UIListener.java"
    click B8 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/SampleAPI.java"

    %% Click Events for Mesibo SDK Integration
    click M1 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/MesiboFileTransferHelper.java"
    click M2 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/MesiboListeners.java"

    %% Click Events for Background and Notification Services
    click S1 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/fcm/MesiboGcmListenerService.java"
    click S2 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/fcm/MesiboInstanceIDListenerService.java"
    click S3 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/fcm/MesiboJobIntentService.java"
    click S4 "https://github.com/mesibo/messenger-app-android/blob/master/app/src/main/java/org/mesibo/messenger/fcm/MesiboRegistrationIntentService.java"

    %% Styling
    classDef ui fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef sdk fill:#FFFACD,stroke:#BDB76B,stroke-width:2px;
    classDef services fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px;
    classDef external fill:#D3D3D3,stroke:#696969,stroke-width:2px;
```
