damian
02/23/2018, 2:05 PMtimeLeft
in seconds). my first approach was combineLatest(state, Observable.interval(1, TimeUnit.SECONDS))
but the timer seems to start before i even receive a state, thus my countdown is wrong. my next approach would be state.switchMap { state -> Observable.interval(1, TimeUnit.SECONDS). map { elapsedTime -> state.timeLeft - elapsedTime}}
- is there a “better” approach to this?jmfayard
02/23/2018, 2:44 PMcombineLatest(state.startWith(dummyState), Observable.interval(1, TimeUnit.SECONDS))
?damian
02/23/2018, 2:44 PMelapsed