bluelinelabs / bluelinelabs/Conductor

Discussion: How to design network calls with the same lifecycle as of controller?

Open
#391 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.9k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

I want to design a network call with same the lifecycle as of controller (start with push and ends when the controller is popped).

The examples in [RxLifecycle 2](https://github.com/bluelinelabs/Conductor/blob/develop/demo/src/main/java/com/bluelinelabs/conductor/demo/controllers/RxLifecycle2Controller.java) module suggests using the same in `constructor` and dispose it in `onDestroy`.

The example leads to [`this`](https://www.ibm.com/developerworks/library/j-jtp0618/index.html) leak another thread which is a bug. Even for the same thread, it is an anti-pattern. In `Activity` and `Fragment` we have onCreate for the same.

Is there any recommended pattern for the same?

Contributor guide

Open the contributing guide

Research direction

Start with demo/src/main/java/com/bluelinelabs/conductor/demo/controllers/RxLifecycle2Controller.java, which the issue cites as an example. Review how its constructor and onDestroy usage relates to the controller lifecycle, then determine what pattern the project should recommend for network calls; done requires an agreed recommendation.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.