Skip to content

Handle dynamic list of identity providers #1799

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

Closed
wants to merge 3 commits into from

Conversation

robapaul88
Copy link
Contributor

This will take care of also hiding buttons from the custom layout when adding them for all possible identity providers, but the actual list is dynamic so some won't be available.

Issue: #1775

trietbui85 and others added 2 commits March 27, 2020 11:56
The Facebook Android SDK link is quite old. We should point to the official Facebook Android SDK changelog in Github: https://github.com/facebook/facebook-android-sdk/blob/master/CHANGELOG.md
@robapaul88 robapaul88 requested a review from samtstern as a code owner June 22, 2020 18:47
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@robapaul88
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@robapaul88
Copy link
Contributor Author

@googlebot I fixed it.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@samtstern samtstern changed the base branch from master to version-6.3.0-dev June 22, 2020 19:54
@samtstern
Copy link
Contributor

@robapaul88 thanks for this contribution! BTW I changed the target branch to version-6.3.0-dev since that's where we're working at the moment.

Copy link
Contributor

@samtstern samtstern left a comment

Choose a reason for hiding this comment

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

Some small changes but mostly LGTM!

View loginButton = findViewById(buttonId);
handleSignInOperation(idpConfig, loginButton);
}
//hide custom layout buttons that don't have their identity provider set
for (String providerBtnId : providerButtonIds.keySet()) {
if (providerBtnId == null) continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we try not to use single-line if statements

Suggested change
if (providerBtnId == null) continue;
if (providerBtnId == null) {
continue;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}
if (!hasProvider) {
Integer resId = providerButtonIds.get(providerBtnId);
if (resId == null) continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (resId == null) continue;
if (resId == null) {
continue;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}
if (!hasProvider) {
Integer resId = providerButtonIds.get(providerBtnId);
if (resId == null) continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this null condition even possible? How would we get into this state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's an unboxing, In theory I know that map should only have provider ids and layout res ids. But since that Map is passed around by reference, placing an Integer in it that's later nullified, you can end up with a null here. Better safe than sorry.

@robapaul88
Copy link
Contributor Author

Created #1800 to have this pushed to the right branch, redirecting this from master seems to also affect some other files (probably reverting some other commits from 6.3.0-dev).

@robapaul88 robapaul88 closed this Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants