ConversationShortcutPublisher

class ConversationShortcutPublisher(context: Context, nodeRepository: NodeRepository, packetRepository: PacketRepository, radioConfigRepository: RadioConfigRepository, dispatchers: CoroutineDispatchers)(source)

Single owner of the dynamic conversation shortcuts that link Meshtastic conversations to their notifications.

Publishing lives here in core:service (rather than in a feature module) so that shortcuts exist whenever the mesh service is running — not only during an Android Auto session. This is what lets MeshNotificationManagerImpl attach setShortcutId/setLocusId to message notifications so Android ranks them in the shade's Conversations section and surfaces them to Android Auto/Wear.

Two publishing paths, both keyed by contactKey:

  • startObserving keeps a full set of DM + channel shortcuts in sync with the database for the service lifetime.

  • ensureConversationShortcut publishes a single shortcut on demand when a notification is about to reference one that the observer has not emitted yet (e.g. the very first message of a brand-new conversation).

Constructors

Link copied to clipboard
constructor(context: Context, nodeRepository: NodeRepository, packetRepository: PacketRepository, radioConfigRepository: RadioConfigRepository, dispatchers: CoroutineDispatchers)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun ensureConversationShortcut(contactKey: String, displayName: String)

Ensures a long-lived conversation shortcut exists for contactKey before a notification references it. A no-op when startObserving has already published the shortcut; otherwise publishes a minimal one so the notification's setShortcutId/setLocusId resolve immediately (the observer replaces it with a richer version on its next emission).

Link copied to clipboard
fun startObserving(scope: CoroutineScope)
Link copied to clipboard