-
Notifications
You must be signed in to change notification settings - Fork 104
Completes our navigation story #1313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The default implementation of `Unwrappable.unwrap` creates a `Sequence` that is almost never necessary (but it is at least fail-safe so I think we should keep it). Here we provide improved implementations for `Wrapper` and `BackStackScreen`.
a311082
to
d5f09d6
Compare
skipFirstScreen: Boolean = false, | ||
private val onNavigate: (Any) -> Unit = { println(it) } | ||
) { | ||
private var lastKey: String? = if (skipFirstScreen) null else "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pyricau @steve-the-edwards We have only ever used our flavor of this on the main thread with the Main.Immediate dispatcher, so this simple implementation has been just fine. Should we stick with what we know, or should this field be marked @Volatile
, or…?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut is to leave it this way. It's such a trivial class that anyone doing something more interesting and finding flaws could so easily fork it.
Should I put something in the kdoc warning of its limitations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enforce that it's single threaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or make it volatile it's simple enough and not that expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's the sanity check I was hoping for, "@Volatile
is just fine."
Takes advantage of `unwrap()` and `Compatible.keyFor()` to provide navigation logging by reporting the top (read: last-most inner-most) sub-rendering, which conventionally is the one that is visible and accessible to the user. Reports each time the `Compatible.keyFor` the top is unequal to the previous one, which conventionally indicates that a new view object will replace the previous one.
Optimize central
unwrap
implementations.The default implementation of
Unwrappable.unwrap
creates aSequence
that is almost never necessary (but it is at least fail-safe so I think we should keep it). Here we provide improved implementations forWrapper
andBackStackScreen
.Introduces NavigationMonitor
Takes advantage of
unwrap()
andCompatible.keyFor()
to provide navigation logging by reporting the top (read: last-most inner-most) sub-rendering, which conventionally is the one that is visible and accessible to the user. Reports each time theCompatible.keyFor
the top is unequal to the previous one, which conventionally indicates that a new view object will replace the previous one.