bluelinelabs / bluelinelabs/Conductor
Controller rebindIfNeeded
- Dominant language
- Java
- Stars
- 3.9k
- Forks
- 338
- PR merge metrics
- No merged PRs in 30d
Description
Controller.rebindIfNeeded has a wrong behavior on controller changing.
Inside that method, the performControllerChange method has always the "from" parameter had set to null. This means that from.changeStarted is never called in "executeChange" and this cause that the Controllers in the backstack will be not notified about "PUSH_EXIT".
Bug demonstration:
- in developer options enable "don't keep activities"
- open demo app and click "Drag Dismiss"
- put app in BG
- back app in FG
- menu from HomeController appear in DragDismissController
Possible solution:
in Controller.rebindIfNeeded keep preview RouterTransaction reference for performControllerChange
@UiThread
public void rebindIfNeeded() {
ThreadUtils.ensureMainThread();
RouterTransaction preview = null;
Iterator backstackIterator = backstack.reverseIterator();
while (backstackIterator.hasNext()) {
RouterTransaction transaction = backstackIterator.next();
if (transaction.controller.getNeedsAttach()) {
performControllerChange(transaction, preview , true, new SimpleSwapChangeHandler(false));
preview = transaction;
}
}
}
Contributor guide
Research direction
Start in Controller.rebindIfNeeded and trace how it calls performControllerChange and how executeChange invokes changeStarted. Reproduce the issue with “don’t keep activities” enabled using the Drag Dismiss demo, then verify that controllers in the backstack receive PUSH_EXIT notifications after returning to the foreground.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100