wealthfront/magellan

onRequestPermissionResult and onActivityResult support

Opened this issue · 4 comments

onRequestPermissionResult and onActivityResult support in Screen. These methods propagate the request to activity and then propagate the result back to correct screen.

It will make it much easier for the implementors of Screen.

you can make methods / functions in screen/ basescreenview to pass data to the screen from on activity with when / switch case statements implemented in onActivityResult or onRequestPermissionResult.

use language features like abstraction in this case rather getting it implemented in the library.

Methods like this should be in the library. Every single app which is non-trivial needs to deal with permission and going to write same useless repetitive logic on their end (it needs a change in both Activity and Screen).

Also, keeping in library creates a much better abstraction. Conductor does this and is one of the issues as mentioned in this Reddit thread (I'm not sure why their implementation is so complex, why can't permission or activity result be just delegated to the topmost screen).

The only reason it should not be in the library is that the author doesn't need it and anyone can fork and add it to their version.

It's true that we want to be careful about adding too much in the lib, but in this case I agree that this should be part of the library.

Agreed. I think a very simple implementation will make life much easier for other devs. I tried implementing it in a PR #64 and would love to make it even more simple.