Fixed Back Navigation Issues + Misc Updates #12
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What Changed
1.5.0-beta01
1.7.3
navigation-core
moduleBack Navigation Issue
Previously, the
Navigator
would retain a stack of forwardNavigationEvents
(context and destination changes). It would use that stack for back navigation purposes. There was a Backwards Navigation Strategy which would be used to determine how the back navigation worked. However, this wouldn't work whenIN_CONTEXT
navigation was set and the previous navigation event was a context change. This should have popped the destination stack to the previous item within the current context in that case, but instead it just did nothing and returned false.The coordination of context and destination changes is rather difficult and was causing a lot of issues. So, the solution I came up with was to separate the back navigation into two distinct operations (similar to the forward navigation events): back context and back destination change. This simplifies the
Navigator
implementation with the coordination of the back operations. However, this requires the call-site to explicitly state which back navigation operation they would like to perform. Along with this fix, I decided to change the API so that the navigation functions were easier to work with.API Changes
Fixing the back navigation issues introduced a new back operation. This change required renaming the
goBack
function and introducing another "goBack" function but for context changes. As these are essentially stack operations, I decided to rename the functions along the lines with expected stack functions, and change the forward navigation function names as well. The following chart breaks down the changes:There still exists
goTo
andchangeContext
functions, but those are deprecated. This is done to ease the transition to the new API.Also, the Kotlin Binary Compatibility Plugin was added so that it is known when future breaking changes occur and makes it easier to limit any breaking changes. This will be helpful as this API becomes more stable and reaches a
1.0.0
release.Release
This should be released shortly after this PR is merged so that the changes can be tested in applications, and because I have a project that depends on this library which is where I encountered the back navigation issue.