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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Flow with a custom Dispatcher that supports showing multiple keys/screens at the same time (in my case, an underlying screen and modal(s) on top). When my Dispatcher is restoring History from a stopped state, I figure out which keys/screens need to be inflated, and then I call this helper method:
private fun inflateNewView(screen: Screen, traversal: Traversal): View {
val context = traversal.createContext(screen, activity)
val layoutResId = screen.layoutResId()!!
val inflated = LayoutInflater.from(context).inflate(layoutResId, screenContainer, false)
inflated.tag = layoutResId
val incomingState = traversal.getState(screen)
incomingState.restore(inflated)
return inflated
}
However, it looks like PendingTraversal only sets up a context for the top of the History, so when I try to inflate one of the non-top screens, it blows up:
Caused by: java.lang.IllegalStateException: No services currently exists for key StayScreen(placeID=LaTaqueria)
at flow.KeyManager.findServices(KeyManager.java:72)
at flow.Traversal.createContext(Traversal.java:44)
at mypackage.FlowDispatcher.inflateNewView(FlowDispatcher.kt:295)
at mypackage.FlowDispatcher.doMainScreenTransition(FlowDispatcher.kt:170)
at mypackage.FlowDispatcher.dispatch(FlowDispatcher.kt:140)
at flow.Flow$PendingTraversal.bootstrap(Flow.java:364)
at flow.Flow$2.doExecute(Flow.java:139)
at flow.Flow$PendingTraversal.execute(Flow.java:381)
at flow.Flow.move(Flow.java:270)
at flow.Flow.setDispatcher(Flow.java:137)
at flow.InternalLifecycleIntegration.onActivityCreated(InternalLifecycleIntegration.java:141)
I think the fix is probably just to pre-create contexts for the entire History, but I don't know if that should be in bootstrap or dispatch. Or am I just doing this custom Dispatcher wrong?
The text was updated successfully, but these errors were encountered:
Talked to @loganj offline: the sanctioned way to do this is to use MultiKey. Both KeyManager and KeyDispatcher have custom logic to handle MultiKey and do what i'm currently doing manually.
I'm using Flow with a custom Dispatcher that supports showing multiple keys/screens at the same time (in my case, an underlying screen and modal(s) on top). When my Dispatcher is restoring History from a stopped state, I figure out which keys/screens need to be inflated, and then I call this helper method:
However, it looks like
PendingTraversal
only sets up a context for the top of the History, so when I try to inflate one of the non-top screens, it blows up:I think the fix is probably just to pre-create contexts for the entire History, but I don't know if that should be in
bootstrap
ordispatch
. Or am I just doing this custom Dispatcher wrong?The text was updated successfully, but these errors were encountered: