Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): resolve issue with activity result API registration for fragments #4402

Merged
merged 18 commits into from
Apr 12, 2021

Conversation

carlpoole
Copy link
Member

@carlpoole carlpoole commented Mar 28, 2021

Prerequisite: #4405

@carlpoole carlpoole self-assigned this Mar 28, 2021
@carlpoole carlpoole changed the title fix(android): resolve issue with activity result API registration on BridgeFragment fix(android): resolve issue with activity result API registration for fragments Mar 28, 2021
@carlpoole carlpoole marked this pull request as ready for review April 2, 2021 14:01
Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could have a helper on Bridge class that help us get the activity or fragment that is going to register for result, something like this:

    public ActivityResultCaller getResultCaller() {
        if (this.fragment != null) {
            return this.fragment;
        } else {
            return this.context;
        }
    }

This way we can avoid having the fragment null check and having to duplicate the code that is called once with getFragment and another one with getActivity when registerForActivityResult` is used

@carlpoole
Copy link
Member Author

I think we could have a helper on Bridge class that help us get the activity or fragment that is going to register for result

Thanks for the idea, this does make it cleaner. Take a look what I added

@jcesarmobile
Copy link
Member

Looks good, can you use it in BridgeWebChromeClient too?

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@carlpoole carlpoole merged commit ac6c6bc into main Apr 12, 2021
@carlpoole carlpoole deleted the fragment-perms branch April 12, 2021 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants