GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Specify additonal scopes through code rather than config.xml by amandle · Pull Request #342 · firebase/FirebaseUI-Android Conversation
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
samtstern
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
| public FacebookProvider (Context appContext, IDPProviderParcel facebookParcel) { | ||
| public FacebookProvider ( | ||
| Context appContext, | ||
| List<String> scopes) { |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public GoogleProvider(FragmentActivity activity, IDPProviderParcel parcel, @Nullable String email) { | ||
| public GoogleProvider( | ||
| FragmentActivity activity, | ||
| @Nullable String email, |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| List<String> scopes) { | ||
| mActivity = activity; | ||
| String mClientId = parcel.getProviderExtra().getString(CLIENT_ID_KEY); | ||
| String mClientId = activity.getString(R.string.default_web_client_id); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| * 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 { |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| } else { | ||
| mScopes = scopes; | ||
| } | ||
| String applicationId = appContext.getString(R.string.facebook_application_id); |
There was a problem 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.
There was an error while loading. Please reload this page.
| .requestIdToken(mClientId); | ||
|
|
||
| // Add additional scopes | ||
| String[] extraScopes = mActivity.getResources().getStringArray(R.array.google_permissions); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good idea, added.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
|
|
||
| if (appContext.getResources().getIdentifier( | ||
| "google_permissions", "array", appContext.getPackageName()) != 0) { | ||
| Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.facebook_permissions but that" |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oops, good catch.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * {@link SignInIntentBuilder#setProviders}. | ||
| */ | ||
| public static final String EMAIL_PROVIDER = "email"; | ||
| public static final String EMAIL_PROVIDER = EmailAuthProvider.PROVIDER_ID; |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
|
@amandle FYI you can carry my approval through from before. Merge when ready and the tests are green. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@SUPERCILEX Thanks, I'll give that a try! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@amandle I did some more Googling: see this issue travis-ci/travis-ci#5582 and this solution srsudar/MamasDelRioAndroid@ec64465. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
See #358 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CLAs look good, thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Maybe undo f40ce5a to force a rerun? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@samtstern I still don't see that button :-( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@samtstern unfortunately, that button is only available to repository admins (the person who set up Travis). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@amandle Looks like a compile error: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
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? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@SUPERCILEX @amandle I merged master into 1.0.0-dev, the only changes were |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes! Thanks @samtstern it worked! Also, look at that build time!!! 4mins vs the usual ~10mins! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.