GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Specify additonal scopes through code rather than config.xml by amandle · Pull Request #342 · firebase/FirebaseUI-Android

Conversation

@amandle

@amandle amandle commented Oct 6, 2016

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samtstern

samtstern commented Oct 6, 2016

Copy link
Copy Markdown
Contributor

For scopes-only this approach LGTM, but I think we can give ourselves more breathing room if we instead have SignInIntentBuilder take some sort of IDPConfig<> object which has fields, one of which is a List<String> of scopes.

Then instead of calls to setProviders() and setAdditionalGoogleScopes() you could do something like enableProvider(GOOGLE_PROVIDER, mGoogleIdpConfig) or even have one method for each IDP like enableGoogleProvider(mGoogleIdpConfig).

This way if we want to add more customization in the future (IDPs can change underneath us) we don't need a breaking API change, we just add a new field to IDPConfig. It also makes the availability of the options clearer if you pass them at the time of enabling the IDP. This is like how in GmsCore with GoogleApiClient you do .addApi(mApi, mApiOptions).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle

amandle commented Oct 8, 2016

Copy link
Copy Markdown
Contributor Author

I refactored quite heavily. There is now an IdpConfig class as you suggested, and setProviders takes a list of them. So as not to have two classes doing pretty much the same thing, and since the new IdpConfig class needs to be publicly available I removed IDPProviderParcel and replaced it with the IdpConfig class. This cleans things up a bit. This is kind of a large change now, apologies about that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

samtstern
samtstern reviewed Oct 10, 2016
View reviewed changes

@samtstern samtstern left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This refactor looks really good, thanks! A few comments about how we can go even further.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java

protected IdpConfig(Parcel in) {
mProviderId = in.readString();
mScopes = in.createStringArrayList();

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This creates a new one, but it should read the value instead.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

createStringArrayList actually does read the list, it just handles the creation of the list for you: https://developer.android.com/reference/android/os/Parcel.html#createStringArrayList()

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samtstern samtstern Oct 13, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Whoops, TIL!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java
* https://developers.facebook.com/docs/facebook-login/android
* https://developers.facebook.com/docs/facebook-login/permissions
*
* For Google permissions see:

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What about twitter?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Twitter scopes are configured only through the developer console. I will add that to the comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java Outdated
private int mLogo = NO_LOGO;
private int mTheme = getDefaultTheme();
private List<String> mProviders = Collections.singletonList(EMAIL_PROVIDER);
private List<IdpConfig> mProviders = new ArrayList<>();

@samtstern samtstern Oct 10, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Should this be a set? Seems like you want set-like properties in subsequent logic.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We do need set like properties, but we also need to retain the order. It looks like LinkedHashSet will do what we want.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java Outdated
public FacebookProvider (Context appContext, IDPProviderParcel facebookParcel) {
public FacebookProvider (
Context appContext,
List<String> scopes) {

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Why not just pass through the IDPConfig here? That way you only have to change this once.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java Outdated
public GoogleProvider(FragmentActivity activity, IDPProviderParcel parcel, @Nullable String email) {
public GoogleProvider(
FragmentActivity activity,
@Nullable String email,

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Same question here about just passing IDPConfig (and elsewhere, I'll stop repeating myself)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java
List<String> scopes) {
mActivity = activity;
String mClientId = parcel.getProviderExtra().getString(CLIENT_ID_KEY);
String mClientId = activity.getString(R.string.default_web_client_id);

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is this equivalent behavior before? What if they want to pass another client ID?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The behavior is the same, the clientId is still read from config.xml if they want to change it (same as before) but we are not sticking in a parcel and then reading it back, we're just using it directly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java
* In the simplest case, you can supply the provider ID and build the config like this:
* {@code new IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()}
*/
public static class IdpConfig implements Parcelable {

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Would it be better if each provider had a subclass of this? so new GoogleIdpConfig.Builder().build(), etc. This way you have more control over provider differences. For example doesn't look like you're supporting Twitter scopes so that builder would not have setScopes(). It would also hide the GOOGLE_PROVIDER and other Strings from the dev.

This one is up to you, I can see arguments both ways.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I tried this, but it makes parceling and passing a list of providers around much uglier. I would prefer to keep it this way.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samtstern samtstern Oct 13, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ok that's a good reason, keeping it as it is SGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java
} else {
mScopes = scopes;
}
String applicationId = appContext.getString(R.string.facebook_application_id);

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

If you took my suggestion of IdpConfig subclasses, these strings could be part of the builders and we could eliminate the resource-based config entirely.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java
.requestIdToken(mClientId);

// Add additional scopes
String[] extraScopes = mActivity.getResources().getStringArray(R.array.google_permissions);

@samtstern samtstern Oct 10, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Bonus points: since we're removing these scopes as resources, maybe we could log a big warning message if we see them defined and they're non empty. Something like "DEVELOPER_WARNING: you have defined R.array.google_permissions but that is no longer respected as of FirebaseUI 1.0.0. See README"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good idea, added.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samtstern

samtstern commented Oct 10, 2016

Copy link
Copy Markdown
Contributor

Also I merged master into version-1.0.0-dev today, I forgot this PR was outstanding so I apologize if there are conflicts for you (they should be simple if there are any)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle
amandle force-pushed the issue_294_2 branch from 9368dd1 to f9c002f Compare October 13, 2016 18:30
samtstern
samtstern approved these changes Oct 13, 2016
View reviewed changes

@samtstern samtstern left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

One last comment but LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java

if (appContext.getResources().getIdentifier(
"google_permissions", "array", appContext.getPackageName()) != 0) {
Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.facebook_permissions but that"

@samtstern samtstern Oct 13, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This says facebook_permissions in one place and google_permissions in another.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@amandle amandle Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oops, good catch.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@amandle
amandle force-pushed the issue_294_2 branch from c66b209 to 85f16cd Compare October 14, 2016 21:01
amandle
amandle commented Oct 14, 2016
View reviewed changes
Comment thread auth/src/main/java/com/firebase/ui/auth/AuthUI.java
* {@link SignInIntentBuilder#setProviders}.
*/
public static final String EMAIL_PROVIDER = "email";
public static final String EMAIL_PROVIDER = EmailAuthProvider.PROVIDER_ID;

@amandle amandle Oct 14, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We had discussed this change previously and I was against it then, but since we are now exposing IdpConfig to the user of the library, the mapping is necessarily one to one, so I think this change makes sense now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samtstern samtstern Oct 14, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Agreed, seems like a sensible change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samtstern

samtstern commented Oct 14, 2016

Copy link
Copy Markdown
Contributor

@amandle FYI you can carry my approval through from before. Merge when ready and the tests are green.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 16, 2016

Copy link
Copy Markdown
Contributor

@amandle Travis failed with exit code 137. I've been having that issue too, just restart the build or push some whitespace to get it going again. It's really random, but apparently it has something to do with the Travis sandbox only having 3GB of RAM available and us exceeding that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle

amandle commented Oct 16, 2016

Copy link
Copy Markdown
Contributor Author

@SUPERCILEX Thanks, I'll give that a try!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 16, 2016

Copy link
Copy Markdown
Contributor

@amandle I did some more Googling: see this issue travis-ci/travis-ci#5582 and this solution srsudar/MamasDelRioAndroid@ec64465.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 16, 2016

Copy link
Copy Markdown
Contributor

See #358

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@googlebot

googlebot commented Oct 17, 2016

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle
amandle force-pushed the issue_294_2 branch from 2b4f4a2 to f40ce5a Compare October 17, 2016 18:04
@googlebot

googlebot commented Oct 17, 2016

Copy link
Copy Markdown

CLAs look good, thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 17, 2016

Copy link
Copy Markdown
Contributor

Maybe undo f40ce5a to force a rerun?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle
amandle force-pushed the issue_294_2 branch from f40ce5a to c4266b5 Compare October 17, 2016 18:15
@samtstern

samtstern commented Oct 17, 2016

Copy link
Copy Markdown
Contributor

Note: when a build fails there is a Restart Build button on the page you can use:
screen shot 2016-10-17 at 11 21 47 am

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle

amandle commented Oct 17, 2016

Copy link
Copy Markdown
Contributor Author

@samtstern I still don't see that button :-(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 17, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@samtstern unfortunately, that button is only available to repository admins (the person who set up Travis).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 17, 2016

Copy link
Copy Markdown
Contributor

@amandle Looks like a compile error:

/home/travis/build/firebase/FirebaseUI-Android/auth/src/main/java/com/firebase/ui/auth/ui/idp/IDPSignInContainerActivity.java:67: error: incompatible types: String cannot be converted to IdpConfig
            mIDPProvider = new GoogleProvider(this, mEmail, providerConfig);
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SUPERCILEX

SUPERCILEX commented Oct 17, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I'm sorry, I just realized that I merged the Travis fix into master instead of 1.0.0. @samtstern could you merge master into dev or @amandle you could just merge master into this PR directly since I think the Travis fix is the only difference between master and dev?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@samtstern

samtstern commented Oct 17, 2016

Copy link
Copy Markdown
Contributor

@SUPERCILEX @amandle I merged master into 1.0.0-dev, the only changes were travis.yml and your small change to SaveCredentialsActivity

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Aaron Mandle added 6 commits October 17, 2016 13:35
Aaron Mandle
Specify additonal scopes thorugh code rather than config.xml
d4953f9
Aaron Mandle
Refactor to use IdpConfig to configure IDPs, and remove IDPProviderPa…
d86dd6f
…rcel
Aaron Mandle
review feedback
cc855b1
Aaron Mandle
Fix facebook_permissions resource check
428a97e
Aaron Mandle
Fix tests
146bab6
Aaron Mandle
Update the README to reflect the new API changes
38aa969
Aaron Mandle added 4 commits October 17, 2016 13:35
Aaron Mandle
Add sources to javadoc task
3d514fe
Aaron Mandle
Force rerun of Travis
0f707e7
Aaron Mandle
Revert "Force rerun of Travis"
9884147
This reverts commit 327bf1b.
Aaron Mandle
fix merge mistake
a03e918
@amandle
amandle force-pushed the issue_294_2 branch from 5437179 to a03e918 Compare October 17, 2016 20:35
@SUPERCILEX

SUPERCILEX commented Oct 17, 2016

Copy link
Copy Markdown
Contributor

Yes! Thanks @samtstern it worked! Also, look at that build time!!! 4mins vs the usual ~10mins!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amandle amandle changed the title Specify additonal scopes thorugh code rather than config.xml Specify additonal scopes through code rather than config.xml Oct 17, 2016
@amandle
amandle merged commit 897b455 into firebase:version-1.0.0-dev Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@samtstern samtstern samtstern approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@amandle @samtstern @SUPERCILEX @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.