- ADDED: Adds `ScopeKey.Child` interface, which allows the definition of *explicit* parent hierarchy of a given scope.
Even by default, there is an implicit hierarchy between screens: it is possible to look up services defined by previous keys.
However, there are times when we must define scopes that are supersets of multiple screens. In this case, we know we are on a given screen, within a given state, and we require a superscope to exist that is shared across multiple screens.
In this case, the key can define an explicit parent hierarchy of scopes. These scopes are created before the key's own scope (assuming the key is also a ScopeKey).
The parent scopes are only destroyed after all their children are destroyed.
`lookupService()` prefers explicit parents, however will also continue to seek the service across implicit parents, and their explicit parent chain as well.
*This feature is a bit complex, so if you see any unexpected behavior, report it as soon as possible. There are however multiple unit tests to verify that behavior is generally as expected.*
-Simple Stack 1.12.3 (2018-09-02)
--------------------------------
- CHANGE: When `lookupService` cannot find the service, the exception message is improved (and tells you what *could* be wrong in your configuration).
@@ -257,22 +298,42 @@ public void reattachStateChanger() {
* Note that if you use {@link BackstackDelegate} or {@link com.zhuinden.simplestack.navigator.Navigator}, then there is no need to call this method manually.
* Inheriting from {@link ScopeKey} allows defining that our key belongs to a given scope, that a scope is associated with it.
*/
publicinterfaceScopeKey {
/**
* Defines the tag of the scope this key defines the existence of.
*
* @return the tag of the scope
*/
@NonNull
StringgetScopeTag();
/**
* Inheriting from {@link Child} enables defining an explicit parent hierarchy, thus ensuring that
* even if the scopes are not defined by the tags of any existing keys in the {@link Backstack}'s current {@link History},
* the scopes will still be created, bound and shall exist.
*
* During {@link BackstackManager#lookupService(String)}, the explicit parents are traversed first, and implicit parents second. Implicit scope inheritance means that the previous keys' scopes will be traversed as well.
*
* If a {@link Child} is the top-most scope, then its explicit scopes are activated as well, so their services have {@link com.zhuinden.simplestack.ScopedServices.Activated#onScopeActive(String)} called if they implement {@link com.zhuinden.simplestack.ScopedServices.Activated}.
*/
publicinterfaceChild {
/**
* Defines the hierarchy of the parent scope that ought to exist as explicit parents of this key.
*
* The order of the items matters: the top-most scope is the first, the bottom-most parent is the last.
*
* @return the list of scope tags that ought to serve as the key's hierarchy of explicit parents
*/
@NonNull
List<String>getParentScopes();
}
}
Oops, something went wrong.
ProTip!
Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.