Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / globalesim / AGENTS.md

AGENTS.md3.7 KiBRenderedCodeRaw
1# AGENTS.md — globalesim/ (':globalesim')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `globalesim/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install globalesim (dev by default)._
6- Gradle: :globalesim / dir: globalesim/
7- Package roots present: ui, data, domain, platform, network
8- Entry files: MainActivity.kt, Route.kt, Navigation.kt
9- Deps: :library:network, :library:log, :library:ui (via conventions), androidx.datastore.preferences, stripe-android
10- Metadata: metadata_data/globalesim.md (present)
11- Rust: no / screenshotTest: yes
12
13## Overview
14**Purpose:** Travel data eSIM storefront. One global eSIM per anonymous account — top up USD credit, data deducts at the local per-country rate. Credit never expires.
15**Key features:**
16- Pay-first: no eSIM until the first top-up ($5 min, card or crypto); the server keeps a $3 setup fee and funds the rest
17- Anonymous account (client-minted UUIDv4, no PII). The account id is the only credential and is shown as the "SIM ID": Copy SIM ID on the old phone, Claim on a phone without an eSIM
18- Rate catalog (server-scaled to the wallet's face value), Stripe card and NOWPayments crypto (+5%) top-ups, $5–$20 per payment
19- One-tap install via the standard `https://esimsetup.android.com/esim_qrcode_provisioning?carddata=LPA:1$<smdp>$<code>` link (unpinned ACTION_VIEW, raw carddata)
20**Architecture / data-flow:** `ui/` screens → `platform/EsimViewModel` (single `EsimUiState`) → `network/EsimApi` (own `/esim/v1/*` on api.maproj.org, FIRST_PARTY) with pure `domain/QuoteMath` and `data/AnonymousIdStore` (DataStore UUID). The reseller vendor is server-only (`location_share_server/src/handlers/esim*.rs`) and never named here.
21**Entry points + reading order:** `Route.Purchase` / `Route.Pricing` (sibling tab routes, no other routes) → `MainActivity.kt` → `Navigation.kt` → `platform/EsimViewModel.kt` → `network/EsimApi.kt`.
22**Gotchas:**
23- After any payment the ViewModel polls `/status` until the wallet rises (server-owned pending checkout + `pending_credit_cents` keep it going); pull-to-refresh on Purchase reloads status
24- One open crypto checkout per account, owned by the server and restored from `/status`
25- PaymentSheet presents each client secret once (saved across recreation); cleared on done/cancel
26- ViewModel messages are shown once by the tab host in `Navigation.kt`, not by the screens
27- Never log the account id / SIM ID; the clipboard copy is flagged sensitive
28- Install shows no QR/code — same-phone QR is unscannable; direct LPA handoff only
29- `rememberPaymentSheet` is deprecated in stripe-android 23.x (same as fooddelivery)
30
31## Key files
32### Root — entry + navigation
33- com/vayunmathur/globalesim/MainActivity.kt
34- com/vayunmathur/globalesim/Navigation.kt
35- com/vayunmathur/globalesim/Route.kt
36### data/ — anonymous id
37- com/vayunmathur/globalesim/data/AnonymousIdStore.kt
38### domain/ — pure logic (no Android)
39- com/vayunmathur/globalesim/domain/QuoteMath.kt — payment bounds, cents formatting/parsing
40- com/vayunmathur/globalesim/domain/CheckoutUrls.kt
41- com/vayunmathur/globalesim/domain/EsimActivationCode.kt
42### network/ — storefront API client
43- com/vayunmathur/globalesim/network/EsimApi.kt — BASE_URL + url(path) + NetworkClient calls
44- com/vayunmathur/globalesim/network/EsimDtos.kt — generic DTOs only, no vendor strings
45### platform/ — ViewModel
46- com/vayunmathur/globalesim/platform/EsimViewModel.kt
47### ui/ — one public @Composable per file
48- com/vayunmathur/globalesim/ui/HomeScreen.kt — Purchase tab (balance, top-up, install, Copy SIM ID / Claim)
49- com/vayunmathur/globalesim/ui/PricingScreen.kt — Pricing tab
50
51## Verify (this module only)
52```
53./gradlew :globalesim:compileDevKotlin
54./gradlew :globalesim:lint
55./gradlew :globalesim:testDevUnitTest
56```