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.