# kassomeone/temp-mobile-app architecture

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

- Interactive diagram: https://gitdiagram.com/kassomeone/temp-mobile-app
- Repository: https://github.com/kassomeone/temp-mobile-app

## Overview

1. This is a Kotlin Multiplatform + Compose Multiplatform client for the offer.sa insurance domain. The shared codebase contains most of the UI, state, networking, models, and feature logic, while Android and iOS mainly provide app launchers and platform integrations.

2. The top-level runtime is split by platform:
   - Android entry points live under `composeApp/src/androidMain` with `MainActivity`, `MyApplication`, manifest, resource XML, and platform-specific helpers.
   - iOS entry points live under `composeApp/src/iosMain` with `MainViewController` plus the Swift app shell in `iosApp`.
   - Shared Compose UI is hosted inside those native shells.

3. The central architecture in `commonMain` follows MVVM. Most screens have a dedicated `ViewModel`, with screen-specific state classes and UI state wrappers. UI events flow from Compose screens to ViewModels, then to repositories or network helpers, and results come back as immutable models/state for rendering.

4. Feature boundaries are organized by business area under `presentation/screen` and `presentation/fragments`. Major subsystems include login/signup, onboarding/splash, home/dashboard, profile/settings, quotes, vehicles, drivers, policy holders, purchased policies, orders, tickets, referral, feedback, language selection, biometrics, and payment status. This is the main navigation and business workflow surface of the app.

5. The quote and policy-sale flow is one of the largest subsystems. It spans:
   - quote search and list screens,
   - client/vehicle/driver data collection,
   - image capture and upload,
   - billing and invoice review,
   - payment form and payment web views,
   - policy completion/status screens.
   This is the core transactional path in the app.

6. Networking is centralized in `commonMain/kotlin/network` with Ktor-based HTTP client code, route constants, and a generic API call handler. The app talks to backend APIs through this layer, and the large set of DTOs in `commonMain/kotlin/models` represents the backend contract.

7. There is a meaningful platform/security boundary around networking. Android has a custom trust manager plus `network_security_config.xml` and bundled certs in `res/raw`, suggesting controlled TLS trust for specific environments. iOS has platform-specific networking configuration in `configureForPlatform.kt`.

8. Several device capabilities are abstracted behind `expect/actual` APIs so shared code can call them uniformly:
   - OTP retrieval
   - clipboard copy
   - app exit
   - kiosk detection
   - app-start hooks
   - image capture with metadata
   - camera handling
   - show-toast behavior
   These are implemented separately for Android and iOS.

9. The camera subsystem is split into shared and platform code under `camera_view`. Shared code defines controllers and bitmap conversion, while Android and iOS provide native camera managers. This likely supports identity, vehicle, or document image capture within quote and claims-like workflows.

10. Payment is another explicit cross-platform boundary. Shared code contains payment screens and web view sheets, while Android/iOS provide the concrete navigation/finish behavior for HyperPay. This indicates the payment flow is mediated through native/webview handoff rather than purely shared UI.

11. Local persistence and app context are handled through a small preference layer in `preference`, with platform-specific context adapters. This is likely used for user session data, language choice, kiosk flags, and other lightweight app settings.

12. The UI layer is built from a reusable component library in `presentation/components` and `presentation/bottom_sheets`. It includes dialogs, drawers, sheets, loaders, tabs, pagination, form fields, and toast/loading/error components. Feature screens compose these primitives rather than duplicating them.

13. Resource organization is also split cleanly:
   - shared Compose resources hold most icons and SVG-like assets,
   - Android keeps platform drawables, string XML, raw certs, and security configs,
   - iOS keeps asset catalogs, plist files, and entitlements.
   This matters for the diagram because many visual assets are shared, but platform packaging still exists.

14. In short, the diagram should show a shared Compose/MVVM core in the middle, feature screens branching out by domain, Ktor/backend access below that, and thin Android/iOS adapters on the sides for camera, biometrics, payment, OTP, clipboard, startup, and other device-specific behavior.

Main entry points: [`composeApp/src/commonMain/kotlin/network`](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/network) (Network layer), [`composeApp/src/commonMain/kotlin/presentation/screen/quotes_screen`](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/quotes_screen) (Quote flow), [`composeApp/src/commonMain/kotlin/App.kt`](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/commonMain/kotlin/App.kt) (App shell), [`composeApp/src/commonMain/kotlin/presentation/screen/payment_webView`](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/payment_webView) (Payment UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared core"]
  node_app_shell["App shell<br/>KMP entry<br/>[App.kt]"]
  node_ui_components["UI kit<br/>Compose widgets"]
  node_ui_states["State models<br/>UI state<br/>[UiState.kt]"]
  node_auth_flow["Auth flow<br/>login/signup"]
  node_home_flow["Home shell<br/>navigation"]
  node_quote_flow["Quote flow<br/>policy sale"]
  node_policy_ops["Policy ops<br/>business screens"]
  node_payment_ui["Payment UI<br/>payment screens"]
  node_network_layer["Network layer<br/>Ktor API"]
  node_domain_models["DTO models<br/>API contract"]
  node_persistence["Preferences<br/>local storage"]
  node_camera_core["Camera core<br/>capture pipeline"]
  node_device_bridge["Device bridge<br/>expect/actual"]
  node_language["Language<br/>i18n"]
end

subgraph group_android["Android"]
  node_android_entry["Android app<br/>launcher<br/>[MainActivity.kt]"]
  node_android_net_sec["Android trust<br/>tls policy"]
  node_android_platform["Android adapters<br/>platform actuals"]
  node_android_payment["Android payment<br/>native handoff"]
end

subgraph group_ios["iOS"]
  node_ios_entry["iOS app<br/>launcher"]
  node_ios_platform["iOS adapters<br/>platform actuals"]
  node_ios_payment["iOS payment<br/>native handoff"]
end

node_app_shell -->|"composes"| node_ui_components
node_app_shell -->|"navigates"| node_auth_flow
node_app_shell -->|"navigates"| node_home_flow
node_home_flow -->|"opens"| node_quote_flow
node_home_flow -->|"opens"| node_policy_ops
node_quote_flow -->|"captures"| node_camera_core
node_quote_flow -->|"hands off"| node_payment_ui
node_quote_flow -->|"uses"| node_domain_models
node_policy_ops -->|"uses"| node_domain_models
node_auth_flow -->|"uses"| node_device_bridge
node_payment_ui -->|"uses"| node_device_bridge
node_network_layer -->|"serializes"| node_domain_models
node_auth_flow -->|"calls"| node_network_layer
node_quote_flow -->|"calls"| node_network_layer
node_policy_ops -->|"calls"| node_network_layer
node_persistence -->|"stores"| node_auth_flow
node_persistence -->|"stores"| node_home_flow
node_device_bridge -->|"actualized on"| node_android_platform
node_device_bridge -->|"actualized on"| node_ios_platform
node_camera_core -->|"implemented by"| node_android_platform
node_camera_core -->|"implemented by"| node_ios_platform
node_payment_ui -->|"bridges to"| node_android_payment
node_payment_ui -->|"bridges to"| node_ios_payment
node_network_layer -->|"platform policy"| node_android_net_sec
node_network_layer -->|"platform config"| node_ios_platform
node_language -->|"renders"| node_ui_components
node_android_entry -->|"hosts"| node_app_shell
node_ios_entry -->|"hosts"| node_app_shell

click node_app_shell "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/commonMain/kotlin/App.kt"
click node_ui_components "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/components"
click node_ui_states "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/commonMain/kotlin/presentation/components/UiState.kt"
click node_auth_flow "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/login"
click node_home_flow "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/home_screen"
click node_quote_flow "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/quotes_screen"
click node_policy_ops "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/fragments"
click node_payment_ui "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/payment_webView"
click node_network_layer "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/network"
click node_domain_models "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/models"
click node_persistence "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/preference"
click node_camera_core "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/camera_view"
click node_device_bridge "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/expect_actual"
click node_language "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/utils/language"
click node_android_entry "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/androidMain/kotlin/com/offer/sa/MainActivity.kt"
click node_android_net_sec "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/androidMain/kotlin/network/AllCertsTrustManager.kt"
click node_android_platform "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/androidMain/kotlin/expect_actual"
click node_android_payment "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/androidMain/kotlin/hyper_pay/startPaymentActivity.kt"
click node_ios_entry "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/iosMain/kotlin/MainViewController.kt"
click node_ios_platform "https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/iosMain/kotlin/expect_actual"
click node_ios_payment "https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/iosMain/kotlin/hyper_pay/startPaymentActivity.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_shell,node_ui_components,node_ui_states,node_auth_flow,node_home_flow,node_quote_flow,node_policy_ops,node_payment_ui,node_network_layer,node_domain_models,node_persistence,node_camera_core,node_device_bridge,node_language toneBlue
class node_android_entry,node_android_net_sec,node_android_platform,node_android_payment toneAmber
class node_ios_entry,node_ios_platform,node_ios_payment toneMint
```

## Components

### Shared core

Common Kotlin Multiplatform app logic and UI.

- [App shell](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/commonMain/kotlin/App.kt): KMP entry · Shared Compose app bootstrap and top-level composition. · `composeApp/src/commonMain/kotlin/App.kt`
- [UI kit](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/components): Compose widgets · Reusable dialogs, scaffolds, sheets, loaders, tabs, and other shared UI primitives. · `composeApp/src/commonMain/kotlin/presentation/components`
- [State models](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/commonMain/kotlin/presentation/components/UiState.kt): UI state · Shared UI state wrappers and loading/error/result patterns. · `composeApp/src/commonMain/kotlin/presentation/components/UiState.kt`
- [Auth flow](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/login): login/signup · Login, signup, OTP, forgot-password, biometrics, and startup flow screens. · `composeApp/src/commonMain/kotlin/presentation/screen/login`
- [Home shell](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/home_screen): navigation · Home, dashboard, onboarding, splash, language, settings, profile, and related app navigation surfaces. · `composeApp/src/commonMain/kotlin/presentation/screen/home_screen`
- [Quote flow](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/quotes_screen): policy sale · Quote search, customer/vehicle/driver capture, image upload, billing, invoice review, and policy completion. · `composeApp/src/commonMain/kotlin/presentation/screen/quotes_screen`
- [Policy ops](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/fragments): business screens · Purchased policies, policy holders, vehicles, orders, tickets, referral, feedback, services, and agent-facing screens. · `composeApp/src/commonMain/kotlin/presentation/fragments`
- [Payment UI](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/presentation/screen/payment_webView): payment screens · Shared payment form, payment status, and web view handoff screens. · `composeApp/src/commonMain/kotlin/presentation/screen/payment_webView`
- [Network layer](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/network): Ktor API · Ktor client, HTTP routes, API handler, and platform-configured networking. · `composeApp/src/commonMain/kotlin/network`
- [DTO models](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/models): API contract · Backend response/request models and UI data models used across features. · `composeApp/src/commonMain/kotlin/models`
- [Preferences](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/preference): local storage · Cross-platform preference and context adapters for session and app settings. · `composeApp/src/commonMain/kotlin/preference`
- [Camera core](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/camera_view): capture pipeline · Shared camera controller and bitmap conversion used by image capture flows. · `composeApp/src/commonMain/kotlin/camera_view`
- [Device bridge](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/expect_actual): expect/actual · Shared abstraction for OTP retrieval, clipboard, app exit, kiosk detection, startup hooks, and image capture metadata. · `composeApp/src/commonMain/kotlin/expect_actual`
- [Language](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/commonMain/kotlin/utils/language): i18n · Language manager and localized string resources. · `composeApp/src/commonMain/kotlin/utils/language`

### Android

Android runtime, platform integrations, and resources.

- [Android app](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/androidMain/kotlin/com/offer/sa/MainActivity.kt): launcher · Android entry activity, application class, manifest, and platform resource packaging. · `composeApp/src/androidMain/kotlin/com/offer/sa/MainActivity.kt`
- [Android trust](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/androidMain/kotlin/network/AllCertsTrustManager.kt): tls policy · Android-specific certificate trust manager and network security config for controlled TLS environments. · `composeApp/src/androidMain/kotlin/network/AllCertsTrustManager.kt`
- [Android adapters](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/androidMain/kotlin/expect_actual): platform actuals · Android actual implementations for camera, OTP, clipboard, kiosk, app start, toast, biometrics, and HyperPay finish behavior. · `composeApp/src/androidMain/kotlin/expect_actual`
- [Android payment](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/androidMain/kotlin/hyper_pay/startPaymentActivity.kt): native handoff · Android payment activity/navigation bridge and web view screen for HyperPay. · `composeApp/src/androidMain/kotlin/hyper_pay/startPaymentActivity.kt`

### iOS

iOS runtime and Swift shell.

- [iOS app](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/iosMain/kotlin/MainViewController.kt): launcher · iOS MainViewController and Swift app shell that hosts the shared Compose UI. · `composeApp/src/iosMain/kotlin/MainViewController.kt`
- [iOS adapters](https://github.com/kassomeone/temp-mobile-app/tree/master/composeApp/src/iosMain/kotlin/expect_actual): platform actuals · iOS actual implementations for camera, OTP, clipboard, kiosk, app start, toast, biometrics, and HyperPay finish behavior. · `composeApp/src/iosMain/kotlin/expect_actual`
- [iOS payment](https://github.com/kassomeone/temp-mobile-app/blob/master/composeApp/src/iosMain/kotlin/hyper_pay/startPaymentActivity.kt): native handoff · iOS payment web view and HyperPay integration boundary. · `composeApp/src/iosMain/kotlin/hyper_pay/startPaymentActivity.kt`

## Connections

- App shell → UI kit: composes · Top-level UI is assembled from reusable shared Compose primitives.
- App shell → Auth flow: navigates · Launch and authentication screens are part of the shared app composition.
- App shell → Home shell: navigates · Main app navigation continues into home, profile, settings, and onboarding surfaces.
- Home shell → Quote flow: opens · Business navigation routes from home into the main quote and policy-sale workflow.
- Home shell → Policy ops: opens · Home surfaces business and account management areas.
- Quote flow → Camera core: captures · Quote flow uses the shared camera pipeline for document and vehicle images.
- Quote flow → Payment UI: hands off · Quote completion transitions into payment form, web view, and status screens.
- Quote flow → DTO models: uses · The transaction flow depends on many quote, invoice, vehicle, and policy DTOs.
- Policy ops → DTO models: uses · Operational screens are driven by shared backend contract models.
- Auth flow → Device bridge: uses · Authentication relies on OTP, biometrics, clipboard, kiosk, and startup hooks.
- Payment UI → Device bridge: uses · Payment flow uses platform handoff and webview-related device integration.
- Network layer → DTO models: serializes · HTTP requests and responses are mapped through shared DTOs.
- Auth flow → Network layer: calls · Login, signup, and recovery screens invoke backend APIs through the network layer.
- Quote flow → Network layer: calls · Quote search, customer data, invoice, and policy-sale actions call backend APIs.
- Policy ops → Network layer: calls · Dashboard, tickets, vehicles, policies, and referral screens fetch and mutate backend data.
- Preferences → Auth flow: stores · Session and user preferences are shared across auth and app startup.
- Preferences → Home shell: stores · Language, kiosk, and app settings are read by the main app shell.
- Device bridge → Android adapters: actualized on · Android provides the concrete platform implementations.
- Device bridge → iOS adapters: actualized on · iOS provides the concrete platform implementations.
- Camera core → Android adapters: implemented by · Android supplies the native camera manager and bitmap bridge.
- Camera core → iOS adapters: implemented by · iOS supplies the native camera manager and bitmap bridge.
- Payment UI → Android payment: bridges to · Android hosts the native/webview payment completion path.
- Payment UI → iOS payment: bridges to · iOS hosts the native/webview payment completion path.
- Network layer → Android trust: platform policy · Android networking is hardened with custom trust and security config.
- Network layer → iOS adapters: platform config · iOS applies its own network configuration for the shared client.
- Language → UI kit: renders · Localized text is consumed by shared UI primitives and screens.
- Android app → App shell: hosts · Android launches the shared Compose application.
- iOS app → App shell: hosts · iOS embeds the shared Compose application in the Swift shell.
