airbnb / mavericks

Mavericks: Android on Autopilot
https://airbnb.io/mavericks/
Apache License 2.0
5.83k stars 500 forks source link

Where do dialogs/snackbars/etc fit into MvRx? #60

Closed SamThompson closed 6 years ago

SamThompson commented 6 years ago

I'd be curious to know how transient ui elements like dialogs/snackbars/etc fit into the overall MvRx pattern (if at all). Is it something like a flag on the state? Or is that outside of the scope of what MvRx is managing?

gpeal commented 6 years ago

Subscribe to state changes. We use asyncSubscribe like:

fun onViewCreated(...) {
    viewModes.asyncSubscribe(YourState::asyncProp, onFail = {
        Snackbar.make(...).show
    {
}
SamThompson commented 6 years ago

Thanks for the info!