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

Modern-Apps.git / share / AGENTS.md

AGENTS.md3.7 KiBRenderedCodeRaw
1# AGENTS.md — share/ (':share')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `share/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install share (dev by default)._
6<!-- last-reviewed: 2026-10-16 -->
7- Gradle: :share / dir: share/
8- Package roots present: ui, domain, platform, network
9- Entry files: MainActivity.kt, Route.kt, Navigation.kt + SharePopupActivity.kt (share-sheet entry)
10- Deps: (none declared — raw TCP/BLE transports, Rust protocol core)
11- Metadata: metadata_data/share.md (present)
12- Rust: yes / screenshotTest: yes
13
14## Overview
15**Purpose:** Offline Quick Share-compatible nearby file transfer — real protocol interop with stock Android, E2EE via UKEY2, device-to-device with no server.
16**Key features:**
17- Send from the system share sheet (`SharePopupActivity` → `SharePopupSheet`); discovery over BLE + NSD mDNS
18- Encrypted TCP transport (`TcpTransport`, Rust `ShareNative` protocol core); receive with the app closed (Quick Settings tile + boot-gated controller)
19- Received files stay app-private in `ReceivedFileStore` until the user saves/shares them
20**Architecture / data-flow:** Send: share intent → popup → `ShareViewModel` → discovery managers → `ShareTransferService` → `TcpTransport`. Receive: tile/boot → `ShareReceiveController` → `PostGate` → notifier → `ShareSaveActivity`. `domain/protocol/ShareSession` models the handshake; `protocol/ShareNative` is the Rust JNI bridge.
21**Entry points + reading order:** `SharePopupActivity.kt` (send) / `platform/receive/ShareReceiveController.kt` (receive) → `Route` → `Navigation.kt` → `platform/ShareViewModel.kt` → `domain/protocol/ShareSession.kt`.
22**Gotchas:**
23- `protocol/` is NOT a closed package root — pending migration; don't add more files there
24- Protocol interop with stock Android is version-sensitive — changes need cross-device testing, not just unit tests
25- Receive path must work with the app closed; never assume an Activity context there
26
27## Key files
28### Root — UI entry + share-sheet entry
29- com/vayunmathur/share/MainActivity.kt
30- com/vayunmathur/share/Navigation.kt
31- com/vayunmathur/share/Route.kt
32- com/vayunmathur/share/SharePopupActivity.kt — share-sheet entry
33### domain/protocol/ — session model
34- com/vayunmathur/share/domain/protocol/ShareSession.kt
35### network/transport/ — encrypted TCP
36- com/vayunmathur/share/network/transport/TcpTransport.kt
37### platform/ — ViewModel, permissions, receive pipeline
38- com/vayunmathur/share/platform/ShareViewModel.kt
39- com/vayunmathur/share/platform/ShareUiContract.kt
40- com/vayunmathur/share/platform/SharePermissions.kt
41- com/vayunmathur/share/platform/ReceivedFileStore.kt
42- com/vayunmathur/share/platform/discovery/BleDiscoveryManager.kt
43- com/vayunmathur/share/platform/discovery/NsdDiscoveryManager.kt
44- com/vayunmathur/share/platform/discovery/NearbyDevice.kt
45- com/vayunmathur/share/platform/receive/ShareReceiveController.kt
46- com/vayunmathur/share/platform/receive/PostGate.kt
47- com/vayunmathur/share/platform/receive/ShareReceiveNotifier.kt
48- com/vayunmathur/share/platform/receive/ShareNotificationReceiver.kt
49- com/vayunmathur/share/platform/receive/ShareSaveActivity.kt
50- com/vayunmathur/share/platform/receive/ShareBootReceiver.kt
51- com/vayunmathur/share/platform/receive/ShareReceiveTileService.kt
52- com/vayunmathur/share/platform/transfer/ShareTransferService.kt
53### protocol/ — Rust bridge (pending migration to closed roots)
54- com/vayunmathur/share/protocol/ShareNative.kt
55### ui/ — popup sheet + send screen
56- com/vayunmathur/share/ui/SharePopupSheet.kt
57- com/vayunmathur/share/ui/ShareSendScreen.kt
58
59## Verify (this module only)
60```
61./gradlew :share:compileDevKotlin
62./gradlew :share:lint
63./gradlew :share:checkMetadata
64```