Taksh Kothari 5e9287fae1
Keep composer drafts across mesh, geohash, and DM switches (#1569)
* feat: add ComposerDraftStore for per-conversation drafts

Keep unfinished composer text keyed by mesh, geohash, or DM peer so
channel switches stop silently discarding what someone was typing.

* feat: restore composer drafts across channel and DM switches

Save on leave and background, reload on enter, clear after send, and
wipe drafts during panic clear.

* test: cover ComposerDraftStore isolation, truncation, and reset

Pinned cases for mesh/geo/DM keys and the panic-wipe clear path.

* test: assert composer draft map stays within maxDraftCount

Newest keys win when the store is already full so prefs cannot grow without bound.

* fix: import BitFoundation so ComposerDraftStore sees PeerID

iOS target build failed without the module import that SPM resolved
transitively but Xcode did not. Also keep the eviction test inside the
test suite type.

* fix: clear in-memory composer draft on panic wipe

ComposerDraftStore.reset() alone left messageText in ContentView, so the
next background transition could persist the pre-wipe draft again.

* Address Jack review: keep composer drafts in memory only (#1569).

* ci: retrigger after unrelated SimulatedMesh flake

* ci: retrigger checks after simulator flake

* test: serialize ComposerDraftStoreTests

The in-memory draft map is process-global; parallel tests were racing
replaceAllForTesting and under-counting during eviction checks.
2026-09-24 09:35:50 +02:00
..