This project is an experiment with AutoDispose library (https://github.com/uber/AutoDispose), which is a library built by Uber with the aim of "automatically" handling the disposition/cancellation of rxjava streams.
In the most of the Android projects following a "clean architecture" approach, the subscriptions to rx streams are performed on view models or presenters. However, the library doesn't provide a built-in solution for this kind of components.
In this project we have implemented a sample where we work with a simple scope for view models in order to automatically disposing all of its streams (scopes are the approach the library follows to handle the automatical cancelation/disposition).
The sample consists on a screen which shows the seconds that elapsed since it appeared.
These seconds are the stream we will work with in order to test the library.
There are two samples, one for a view model where the scope is used with composition and one where it's used with inheritance.
The screen contains some UI controls that allow us to simulate the creation/destruction of the view model and watch the result.
Moreover, a test have been added for the implemented scope to make easier understanding how that scope and its events work. You can find it at ViewModelScopeTest.kt file
To install the app just clone the repo and execute the next command from the project base directory:
./gradlew assembleDebug
And to run the mentioned test just execute the next command:
./gradlew test