Nice article. I also try to rx-ify things like that, and
onActivityResult is a great use case for that: the request codes and the code checking is just so non-OOP and I prefer not to have it in my Activities.
I’ve got two concerns though:
- Since you are not unsubscribing, I think you are leaking the originating activity. That’s just a problem of the sample code though, nothing wrong with the library I think.
- What happens if an Activity starts an
RxActivityResult, and then is destroyed and recreated? Maybe you could add a mechanism that would deliver the result to the recreated activity, without having to repeat the process. Something like