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

Modern-Apps.git / share / AGENTS.md

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