-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Split GitHub provider out into its own module #1421
Changes from 1 commit
afd31da
6a1e309
3ff948b
b984e91
c681878
0036341
e34d442
49b06fd
0c16546
df554e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies { | ||
compileOnly(project(":auth")) | ||
|
||
implementation(Config.Libs.Support.appCompat) | ||
implementation(Config.Libs.Support.customTabs) | ||
|
||
implementation(Config.Libs.Misc.retrofit) | ||
implementation(Config.Libs.Misc.retrofitGson) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.firebase.ui.auth.github"> | ||
|
||
<application> | ||
|
||
<activity | ||
android:name=".GitHubLoginActivity" | ||
android:label="" | ||
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" | ||
android:launchMode="singleTop" | ||
android:theme="@style/FirebaseUI.Transparent"> | ||
|
||
<intent-filter | ||
android:autoVerify="true" | ||
tools:ignore="UnusedAttribute"> | ||
<action android:name="android.intent.action.VIEW" /> | ||
|
||
<category android:name="android.intent.category.DEFAULT" /> | ||
<category android:name="android.intent.category.BROWSABLE" /> | ||
|
||
<data | ||
android:host="@string/firebase_web_host" | ||
android:path="/__/auth/handler" | ||
android:scheme="https" | ||
tools:ignore="AppLinksAutoVerifyWarning" /> | ||
</intent-filter> | ||
|
||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.firebase.ui.auth.data.remote; | ||
package com.firebase.ui.auth.github; | ||
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. Should this be in |
||
|
||
import android.app.Application; | ||
import android.content.Intent; | ||
|
@@ -12,14 +12,12 @@ | |
import com.firebase.ui.auth.ErrorCodes; | ||
import com.firebase.ui.auth.FirebaseUiException; | ||
import com.firebase.ui.auth.IdpResponse; | ||
import com.firebase.ui.auth.R; | ||
import com.firebase.ui.auth.data.model.GitHubProfile; | ||
import com.firebase.ui.auth.data.model.GitHubTokenResponse; | ||
import com.firebase.ui.auth.data.model.Resource; | ||
import com.firebase.ui.auth.data.model.User; | ||
import com.firebase.ui.auth.data.model.UserCancellationException; | ||
import com.firebase.ui.auth.github.model.GitHubProfile; | ||
import com.firebase.ui.auth.github.model.GitHubTokenResponse; | ||
import com.firebase.ui.auth.ui.HelperActivityBase; | ||
import com.firebase.ui.auth.ui.provider.GitHubLoginActivity; | ||
import com.firebase.ui.auth.util.ExtraConstants; | ||
import com.firebase.ui.auth.viewmodel.ProviderSignInBase; | ||
import com.firebase.ui.auth.viewmodel.RequestCodes; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Expect auth resources --> | ||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName"> | ||
<item name="colorPrimary" type="color" /> | ||
<item name="FirebaseUI.Transparent" type="style" /> | ||
|
||
<item name="firebase_web_host" type="string" /> | ||
<item name="github_client_id" type="string" /> | ||
<item name="github_client_secret" type="string" /> | ||
</resources> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.firebase.ui.auth.data.remote; | ||
|
||
import android.support.annotation.RestrictTo; | ||
|
||
import com.firebase.ui.auth.AuthUI; | ||
import com.firebase.ui.auth.viewmodel.ProviderSignInBase; | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
public final class GitHubSignInHandlerBridge { | ||
public static final Class<ProviderSignInBase<AuthUI.IdpConfig>> HANDLER_CLASS; | ||
|
||
static { | ||
try { | ||
//noinspection unchecked | ||
HANDLER_CLASS = (Class<ProviderSignInBase<AuthUI.IdpConfig>>) | ||
Class.forName("com.firebase.ui.auth.github.GitHubSignInHandler"); | ||
} catch (ClassNotFoundException e) { | ||
throw new IllegalStateException( | ||
"Check for availability with ProviderAvailability first.", e); | ||
} | ||
} | ||
|
||
private GitHubSignInHandlerBridge() { | ||
throw new AssertionError("No instance for you!"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,13 @@ | ||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName"> | ||
<!-- Example: project-id.firebaseapp.com. Used for OAuth redirects --> | ||
<string name="default_web_client_id" translatable="false">CHANGE-ME</string> | ||
<string name="firebase_web_host" translatable="false">CHANGE-ME</string> | ||
|
||
<!-- | ||
The Facebook Application ID associated with this Android application. This | ||
must be overridden by users of FirebaseUI auth in order to support Facebook | ||
accounts in the authentication flow. | ||
|
||
See: | ||
https://developers.facebook.com/docs/facebook-login/android | ||
--> | ||
<string name="facebook_application_id" translatable="false">CHANGE-ME</string> | ||
|
||
<!-- | ||
To enable Chrome Custom Tabs for Facebook Login on devices without the Facebook app | ||
installed, change this value to your Facebook App ID prefixed with 'fb'. This should be | ||
'fb' + the value of the facebook_application_id string above | ||
|
||
See: | ||
https://developers.facebook.com/docs/facebook-login/android#chrome_custom_tabs | ||
--> | ||
<string name="facebook_login_protocol_scheme" translatable="false">fbYOUR_APP_ID</string> | ||
|
||
<!-- | ||
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. Any particular reason to kill these comments? 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. Our documentation in the |
||
The Google web client ID associated with this Android application. The | ||
google-services gradle plugin will automatically provide this value. | ||
|
||
See: | ||
https://developers.google.com/identity/sign-in/web/devconsole-project | ||
https://developers.google.com/android/guides/google-services-plugin | ||
--> | ||
<string name="default_web_client_id" translatable="false">CHANGE-ME</string> | ||
|
||
<!-- Your Twitter Consumer Key. --> | ||
<string name="twitter_consumer_key" translatable="false">CHANGE-ME</string> | ||
<!-- Your Twitter Consumer Secret. --> | ||
<string name="twitter_consumer_secret" translatable="false">CHANGE-ME</string> | ||
|
||
<!-- Your GitHub Client ID. --> | ||
<string name="github_client_id" translatable="false">CHANGE-ME</string> | ||
<!-- Your GitHub Client Secret. --> | ||
<string name="github_client_secret" translatable="false">CHANGE-ME</string> | ||
</resources> |
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 two questions about this string:
strings.xml
entries forfirebase_web_host
in bothauth/.../strings.xml
andauth-github/.../strings.xml
... is there a reason it needs to exist outside of the GitHub module? I feel like we only use it there but could be forgetting something.-github
module, should we explode at runtime if this string is still equal toCHANGE-ME
? I think that might be helpful.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.
Yup, both those birds were killed with the same stone in the original implementation 😁:
FirebaseUI-Android/auth/src/main/java/com/firebase/ui/auth/AuthUI.java
Lines 973 to 977 in f83c621
firebase_web_host
in the auth module to do that checkThere 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.
D'oh