iex
02/26/2020, 7:20 AMdoOnSubscribe
• Now we navigate forwards and back. This causes the observer (fragment/view) to re-subscribe.
• The api calls are not performed again, but doOnSubscribe is called, making the progress indicator show for a very short moment.
-> How can we show the indicator only when the requests are being performed?pg
02/26/2020, 7:41 AMiex
02/26/2020, 7:48 AMSingle ) vs. "nothing"iex
02/26/2020, 7:49 AMiex
02/26/2020, 7:51 AMiex
02/26/2020, 7:59 AMZach Klippenstein (he/him) [MOD]
02/26/2020, 11:51 AMsubscribeOn or observeOn anywhere?iex
03/16/2020, 5:12 PMZach Klippenstein (he/him) [MOD]
03/16/2020, 5:13 PMiex
04/15/2020, 7:51 AMsubscribeOn / observeOn to call the remote request using the IO scheduleriex
04/15/2020, 7:52 AMBehaviorSubject to the view model (as cache) and showing the progress indicator only if it's not set yetiex
04/15/2020, 9:42 AMBehaviorSubject to view model with the downloaded data, subscribe to this in fragment
• Added an onFragmentCreated() function to view model, where I fetch the data from the api and set the behavior subject
The fragment's onCreate is called only when navigating (forwards) to it, so it behaves as expected.