mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 23:08:11 +00:00
Move the two RAM history rings (channel + DM) out of the 1988-line QuickMsgScreen into a self-contained MessageHistory.h component, mirroring the WaypointsView extraction from TrailScreen. The store owns the ring buffers, per-entry delivery state (channel relay echo, DM end-to-end ACK + auto-resend) and the per-channel unread counters; the screen keeps all view state (selection, scroll, fullscreen readers, the unread "viewing session" bookkeeping) and reaches entries through accessors. Behaviour-preserving: - The shared types (AckState, ChHistEntry, DmHistEntry, MSG_TEXT_BUF) are file-scope in MessageHistory.h, so the phase machine still refers to them unqualified — only data + storage logic moved. - addChannelMsg keeps a thin screen forwarder that computes the "viewing" flag (a phase fact the store can't see) and returns the ring pos; afterSend uses armChannelRelay(pos, seq) instead of poking the ring. - The public API called via UITask/MyMesh/the bot (addChannelMsg, addDMMsg, markDmDelivered, markChannelRelayed, tickDmResends, clearAllChannelUnread, getTotalChannelUnread, getRecentDMContacts) stays on QuickMsgScreen as forwarders, so no caller changes. QuickMsgScreen 1988 -> 1738 lines; MessageHistory.h 324. Both solo boards build. Single-TU fragment: included by UITask.cpp before QuickMsgScreen.h. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>