Skip to content

Commit 68be249

Browse files
SUPERCILEXsamtstern
authored andcommitted
Split GitHub provider out into its own module (#1421)
1 parent 0da111b commit 68be249

File tree

24 files changed

+162
-103
lines changed

24 files changed

+162
-103
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ dependencies {
5454
5555
// FirebaseUI for Firebase Auth
5656
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
57+
// FirebaseUI for Firebase Auth GitHub provider
58+
implementation 'com.firebaseui:firebase-ui-auth-github:4.1.0'
5759
5860
// FirebaseUI for Cloud Storage
5961
implementation 'com.firebaseui:firebase-ui-storage:4.1.0'

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencies {
3232
implementation(Config.Libs.Support.multidex)
3333

3434
implementation(project(":auth"))
35+
implementation(project(":auth-github"))
3536
implementation(project(":firestore"))
3637
implementation(project(":database"))
3738
implementation(project(":storage"))

app/src/main/res/values/config.xml

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,14 @@
1-
<resources xmlns:tools="http://schemas.android.com/tools">
2-
<!-- Example: project-id.firebaseapp.com. Used for OAuth redirects -->
1+
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources">
2+
<!-- See auth/src/main/res/values/config.xml for documentation -->
3+
34
<string name="firebase_web_host" translatable="false">CHANGE-ME</string>
45

5-
<!--
6-
The Facebook Application ID associated with this Android application. To
7-
use Facebook accounts with the demo application, register an application
8-
and provide your value here.
9-
-->
106
<string name="facebook_application_id" translatable="false">CHANGE-ME</string>
7+
<string name="facebook_login_protocol_scheme" translatable="false">fbYOUR_APP_ID</string>
118

12-
<!-- Facebook Application ID, prefixed by 'fb'. Enables Chrome Custom tabs. -->
13-
<string name="facebook_login_protocol_scheme" translatable="false" tools:ignore="UnusedResources">fbYOUR_APP_ID</string>
14-
15-
16-
<!--
17-
Your Twitter Consumer Key. To use Twitter accounts with the demo application, register an
18-
application with Twitter and provide the following two values.
19-
-->
209
<string name="twitter_consumer_key" translatable="false">CHANGE-ME</string>
21-
22-
<!--
23-
Your Twitter Consumer Secret.
24-
25-
WARNING: By obtaining your Consumer Key and Consumer Secret other programs can perform API
26-
operations as your app. Embedding the Consumer Key and Consumer Secret in your app, no matter
27-
how obfuscated, makes it vulnerable to being stolen.
28-
-->
2910
<string name="twitter_consumer_secret" translatable="false">CHANGE-ME</string>
3011

31-
32-
<!--
33-
Your GitHub Client ID. To use GitHub accounts with the demo application, register an
34-
application with GitHub and provide the following two values.
35-
-->
3612
<string name="github_client_id" translatable="false">CHANGE-ME</string>
37-
38-
<!--
39-
Your GitHub Client Secret.
40-
41-
WARNING: By obtaining your Client ID and Client Secret other programs can perform API
42-
operations as your app. Embedding the Client ID and Client Secret in your app, no matter
43-
how obfuscated, makes it vulnerable to being stolen.
44-
-->
4513
<string name="github_client_secret" translatable="false">CHANGE-ME</string>
4614
</resources>

auth-github/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dependencies {
2+
compileOnly(project(":auth")) { isTransitive = false }
3+
compileOnly(Config.Libs.Firebase.auth) { isTransitive = false }
4+
5+
implementation(Config.Libs.Support.appCompat)
6+
implementation(Config.Libs.Support.customTabs)
7+
8+
implementation(Config.Libs.Misc.retrofit)
9+
implementation(Config.Libs.Misc.retrofitGson)
10+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
package="com.firebase.ui.auth.ui.github">
6+
7+
<application>
8+
9+
<activity
10+
android:name=".GitHubLoginActivity"
11+
android:label=""
12+
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
13+
android:launchMode="singleTop"
14+
android:theme="@style/FirebaseUI.Transparent">
15+
16+
<intent-filter
17+
android:autoVerify="true"
18+
tools:ignore="UnusedAttribute">
19+
<action android:name="android.intent.action.VIEW" />
20+
21+
<category android:name="android.intent.category.DEFAULT" />
22+
<category android:name="android.intent.category.BROWSABLE" />
23+
24+
<data
25+
android:host="@string/firebase_web_host"
26+
android:path="/__/auth/handler"
27+
android:scheme="https"
28+
tools:ignore="AppLinksAutoVerifyWarning" />
29+
</intent-filter>
30+
31+
</activity>
32+
33+
</application>
34+
35+
</manifest>

auth/src/main/java/com/firebase/ui/auth/data/remote/GitHubSignInHandler.java renamed to auth-github/src/main/java/com/firebase/ui/auth/data/remote/GitHubSignInHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
import com.firebase.ui.auth.ErrorCodes;
1313
import com.firebase.ui.auth.FirebaseUiException;
1414
import com.firebase.ui.auth.IdpResponse;
15-
import com.firebase.ui.auth.R;
1615
import com.firebase.ui.auth.data.model.GitHubProfile;
1716
import com.firebase.ui.auth.data.model.GitHubTokenResponse;
1817
import com.firebase.ui.auth.data.model.Resource;
1918
import com.firebase.ui.auth.data.model.User;
2019
import com.firebase.ui.auth.data.model.UserCancellationException;
2120
import com.firebase.ui.auth.ui.HelperActivityBase;
22-
import com.firebase.ui.auth.ui.provider.GitHubLoginActivity;
21+
import com.firebase.ui.auth.ui.github.GitHubLoginActivity;
22+
import com.firebase.ui.auth.ui.github.R;
2323
import com.firebase.ui.auth.util.ExtraConstants;
2424
import com.firebase.ui.auth.viewmodel.ProviderSignInBase;
2525
import com.firebase.ui.auth.viewmodel.RequestCodes;

auth/src/main/java/com/firebase/ui/auth/ui/provider/GitHubLoginActivity.java renamed to auth-github/src/main/java/com/firebase/ui/auth/ui/github/GitHubLoginActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.firebase.ui.auth.ui.provider;
1+
package com.firebase.ui.auth.ui.github;
22

33
import android.annotation.SuppressLint;
44
import android.content.Context;
@@ -10,7 +10,6 @@
1010
import android.support.customtabs.CustomTabsIntent;
1111
import android.support.v4.content.ContextCompat;
1212

13-
import com.firebase.ui.auth.R;
1413
import com.firebase.ui.auth.data.remote.GitHubSignInHandler;
1514
import com.firebase.ui.auth.ui.HelperActivityBase;
1615
import com.firebase.ui.auth.util.ExtraConstants;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Expect auth resources -->
3+
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName">
4+
<item name="colorPrimary" type="color" />
5+
<item name="FirebaseUI.Transparent" type="style" />
6+
7+
<item name="firebase_web_host" type="string" />
8+
<item name="github_client_id" type="string" />
9+
<item name="github_client_secret" type="string" />
10+
</resources>

0 commit comments

Comments
 (0)