Skip to content
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

Lifecycle events can be missing #44

Open
Nublo opened this issue May 1, 2019 · 3 comments
Open

Lifecycle events can be missing #44

Nublo opened this issue May 1, 2019 · 3 comments
Assignees

Comments

@Nublo
Copy link
Contributor

Nublo commented May 1, 2019

Let's consider next situation.
You added container RIB with Screen1Rib.
Than during work with this RIB you decided to replace it to another Screen2Rib inside same container.
Screen2Rib will not receive onStart and onResume events because of this code:

fun onAttach(savedInstanceState: Bundle?) {
    tag = savedInstanceState?.getString(KEY_TAG) ?: tag
    lifecycleRelay.accept(ACTIVE)
    ribLifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
    onAttach(ribLifecycleRegistry, savedInstanceState)
}

I think when you attaching/replacing RIB you should receive lifecycleEvents.

@zsoltk zsoltk self-assigned this May 22, 2019
@zsoltk
Copy link
Contributor

zsoltk commented May 22, 2019

@Nublo start/stop can be done trivially (all Nodes that go to back stack, basically have their views detached, are stopped).

Pause/resume is more tricky in case of overlays, as content below overlays should be conceptually paused. I can see how it can be done probably after #53 is merged.

Also, most cases (currently in all our cases) overlays result in an AlertDialog being showed, which will trigger onPause on hosting Activity, which will pause all on-screen Nodes. That means that even the Node inside the AlertDialog will be paused 😬 . Probably can be solved by not forwarding pause to non-view-parented Nodes?

Anyway, pause/resume seems trickier. If start/stop is enough for now, it can be added relatively easily, so we can probably do it in two parts. What do you think?

@Nublo
Copy link
Contributor Author

Nublo commented May 28, 2019

Sure, splitting into to separate issues is totally fine. Right now we have issues only with start/stop.

@zsoltk
Copy link
Contributor

zsoltk commented Sep 17, 2019

I believe showing a dialog as an overlay through portal (introduced in #83) solves the tricky case I mentioned in my last comment, which means this ticket is probably solved. Will check later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants