mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
address review: replay one dismissal so a recreated screen still sees it
A notification tap can fire the dismissal before the route's collector subscribes (activity recreated with a restored options sheet), and a replay-zero broadcast drops it. Replaying one is a no-op on default state and the new ContextMenuHost test guards it.
This commit is contained in:
@@ -151,7 +151,9 @@ class ContextMenuHost {
|
||||
var actions by mutableStateOf(ItemActions())
|
||||
private set
|
||||
|
||||
private val transientDismissals = MutableSharedFlow<Unit>(extraBufferCapacity = 1)
|
||||
// Replay one so a screen recreated by the notification (whose collector subscribes after the
|
||||
// event fires) still sees the dismissal; every onDismiss is a harmless no-op on default state.
|
||||
private val transientDismissals = MutableSharedFlow<Unit>(replay = 1)
|
||||
|
||||
// Fires when an external event (opening now playing) should close menu-like UI the host does
|
||||
// not own, such as the library's list options sheet.
|
||||
|
||||
@@ -420,6 +420,7 @@ fun LibraryScreen(
|
||||
var searchActive by rememberSaveable { mutableStateOf(false) }
|
||||
val searchFocus = remember { FocusRequester() }
|
||||
|
||||
// Search mode is left open so the typed query survives; MainNavigation dismisses the keyboard.
|
||||
DismissOnRequest(dismissals) { showOptions = false }
|
||||
|
||||
LaunchedEffect(pagerState) {
|
||||
|
||||
Reference in New Issue
Block a user