TLDR: Single-shot event bus with priority-based co...
# coroutines
m
TLDR: Single-shot event bus with priority-based collectors? I have an app-wide single-shot event bus which exposes a
Flow
of events and is collected in a (Android) lifecycle-way such that whichever
Fragment
is visible (let’s assume only one visible at a time) will collect the event and handle it. However, there are some fragments where it doesn’t make sense to collect these events but instead have some generic behavior which would make more sense in the
Activity
(assume single Activity app). I’m trying to work out how to do this. Essentially, if nothing collects an event (ideally: no collector is active, or (less ideally) perhaps using a timeout) then let some
Activity
collector handle it instead. Or perhaps the
Activity
collector somehow has lower priority than a visible-fragment collector.
m
hi @Mark Little bit late, but have you managed to make this work somehow? I have to deal with same issue, in Compose. I have external barcode scanner integrated using Android SDK from vendor. Exposing flow of events. But need to handle those events on certain screens or dialogs in nav graph.
m
Sadly not
sad panda 1