Skip to content

Commit 92965d8

Browse files
lsiracsamtstern
authored andcommitted
Updates regarding our support of Github sign-in (#1646)
1 parent 1cad147 commit 92965d8

File tree

8 files changed

+7
-235
lines changed

8 files changed

+7
-235
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ dependencies {
5656
// FirebaseUI for Firebase Auth
5757
implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
5858
59-
// FirebaseUI for Firebase Auth (GitHub provider)
60-
implementation 'com.firebaseui:firebase-ui-auth-github:5.0.0'
61-
6259
// FirebaseUI for Cloud Storage
6360
implementation 'com.firebaseui:firebase-ui-storage:5.0.0'
6461
}

app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public class AuthUiActivity extends AppCompatActivity {
7272
@BindView(R.id.google_provider) CheckBox mUseGoogleProvider;
7373
@BindView(R.id.facebook_provider) CheckBox mUseFacebookProvider;
7474
@BindView(R.id.twitter_provider) CheckBox mUseTwitterProvider;
75-
@BindView(R.id.github_provider) CheckBox mUseGitHubProvider;
7675
@BindView(R.id.email_provider) CheckBox mUseEmailProvider;
7776
@BindView(R.id.email_link_provider) CheckBox mUseEmailLinkProvider;
7877
@BindView(R.id.phone_provider) CheckBox mUsePhoneProvider;
@@ -101,10 +100,6 @@ public class AuthUiActivity extends AppCompatActivity {
101100
@BindView(R.id.facebook_permission_friends) CheckBox mFacebookPermissionFriends;
102101
@BindView(R.id.facebook_permission_photos) CheckBox mFacebookPermissionPhotos;
103102

104-
@BindView(R.id.github_permissions_header) TextView mGitHubPermissionsHeader;
105-
@BindView(R.id.github_permission_repo) CheckBox mGitHubPermissionRepo;
106-
@BindView(R.id.github_permission_gist) CheckBox mGitHubPermissionGist;
107-
108103
@BindView(R.id.credential_selector_enabled) CheckBox mEnableCredentialSelector;
109104
@BindView(R.id.hint_selector_enabled) CheckBox mEnableHintSelector;
110105
@BindView(R.id.allow_new_email_accounts) CheckBox mAllowNewEmailAccounts;
@@ -157,21 +152,6 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
157152
mUseTwitterProvider.setText(R.string.twitter_label_missing_config);
158153
}
159154

160-
if (ConfigurationUtils.isGitHubMisconfigured(this)) {
161-
mUseGitHubProvider.setChecked(false);
162-
mUseGitHubProvider.setEnabled(false);
163-
mUseGitHubProvider.setText(R.string.github_label_missing_config);
164-
setGitHubPermissionsEnabled(false);
165-
} else {
166-
setGitHubPermissionsEnabled(mUseGitHubProvider.isChecked());
167-
mUseGitHubProvider.setOnCheckedChangeListener(new OnCheckedChangeListener() {
168-
@Override
169-
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
170-
setGitHubPermissionsEnabled(checked);
171-
}
172-
});
173-
}
174-
175155
mUseEmailLinkProvider.setOnCheckedChangeListener(new OnCheckedChangeListener() {
176156
@Override
177157
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@@ -199,7 +179,6 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
199179

200180
mUseFacebookProvider.setChecked(false);
201181
mUseTwitterProvider.setChecked(false);
202-
mUseGitHubProvider.setChecked(false);
203182
mUseEmailLinkProvider.setChecked(false);
204183
mUsePhoneProvider.setChecked(false);
205184
mUseAnonymousProvider.setChecked(false);
@@ -209,8 +188,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
209188

210189
if (ConfigurationUtils.isGoogleMisconfigured(this)
211190
|| ConfigurationUtils.isFacebookMisconfigured(this)
212-
|| ConfigurationUtils.isTwitterMisconfigured(this)
213-
|| ConfigurationUtils.isGitHubMisconfigured(this)) {
191+
|| ConfigurationUtils.isTwitterMisconfigured(this)) {
214192
showSnackbar(R.string.configuration_required);
215193
}
216194

@@ -414,12 +392,6 @@ private List<IdpConfig> getSelectedProviders() {
414392
selectedProviders.add(new IdpConfig.TwitterBuilder().build());
415393
}
416394

417-
if (mUseGitHubProvider.isChecked()) {
418-
selectedProviders.add(new IdpConfig.GitHubBuilder()
419-
.setPermissions(getGitHubPermissions())
420-
.build());
421-
}
422-
423395
if (mUseEmailProvider.isChecked()) {
424396
selectedProviders.add(new IdpConfig.EmailBuilder()
425397
.setRequireName(mRequireName.isChecked())
@@ -490,12 +462,6 @@ private void setFacebookPermissionsEnabled(boolean enabled) {
490462
mFacebookPermissionPhotos.setEnabled(enabled);
491463
}
492464

493-
private void setGitHubPermissionsEnabled(boolean enabled) {
494-
mGitHubPermissionsHeader.setEnabled(enabled);
495-
mGitHubPermissionRepo.setEnabled(enabled);
496-
mGitHubPermissionGist.setEnabled(enabled);
497-
}
498-
499465
private List<String> getGoogleScopes() {
500466
List<String> result = new ArrayList<>();
501467
if (mGoogleScopeYoutubeData.isChecked()) {
@@ -518,17 +484,6 @@ private List<String> getFacebookPermissions() {
518484
return result;
519485
}
520486

521-
private List<String> getGitHubPermissions() {
522-
List<String> result = new ArrayList<>();
523-
if (mGitHubPermissionRepo.isChecked()) {
524-
result.add("repo");
525-
}
526-
if (mGitHubPermissionGist.isChecked()) {
527-
result.add("gist");
528-
}
529-
return result;
530-
}
531-
532487
private void showSnackbar(@StringRes int errorMessageRes) {
533488
Snackbar.make(mRootView, errorMessageRes, Snackbar.LENGTH_LONG).show();
534489
}

app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import com.google.firebase.auth.FirebaseAuth;
4343
import com.google.firebase.auth.FirebaseAuthProvider;
4444
import com.google.firebase.auth.FirebaseUser;
45-
import com.google.firebase.auth.GithubAuthProvider;
4645
import com.google.firebase.auth.GoogleAuthProvider;
4746
import com.google.firebase.auth.PhoneAuthProvider;
4847
import com.google.firebase.auth.TwitterAuthProvider;
@@ -180,9 +179,6 @@ private void populateProfile(@Nullable IdpResponse response) {
180179
case TwitterAuthProvider.PROVIDER_ID:
181180
providers.add(getString(R.string.providers_twitter));
182181
break;
183-
case GithubAuthProvider.PROVIDER_ID:
184-
providers.add(getString(R.string.providers_github));
185-
break;
186182
case EmailAuthProvider.PROVIDER_ID:
187183
providers.add(getString(R.string.providers_email));
188184
break;

app/src/main/java/com/firebase/uidemo/util/ConfigurationUtils.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ public static boolean isTwitterMisconfigured(@NonNull Context context) {
3737
return twitterConfigs.contains(AuthUI.UNCONFIGURED_CONFIG_VALUE);
3838
}
3939

40-
public static boolean isGitHubMisconfigured(@NonNull Context context) {
41-
List<String> gitHubConfigs = Arrays.asList(
42-
context.getString(R.string.firebase_web_host),
43-
context.getString(R.string.github_client_id),
44-
context.getString(R.string.github_client_secret)
45-
);
46-
47-
return gitHubConfigs.contains(AuthUI.UNCONFIGURED_CONFIG_VALUE);
48-
}
49-
5040
@NonNull
5141
public static List<AuthUI.IdpConfig> getConfiguredProviders(@NonNull Context context) {
5242
List<AuthUI.IdpConfig> providers = new ArrayList<>();
@@ -63,10 +53,6 @@ public static List<AuthUI.IdpConfig> getConfiguredProviders(@NonNull Context con
6353
providers.add(new AuthUI.IdpConfig.TwitterBuilder().build());
6454
}
6555

66-
if (!isGitHubMisconfigured(context)) {
67-
providers.add(new AuthUI.IdpConfig.GitHubBuilder().build());
68-
}
69-
7056
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder()
7157
.setAndroidPackageName("com.firebase.uidemo", true, null)
7258
.setHandleCodeInApp(true)

app/src/main/res/layout/auth_ui_layout.xml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@
7474
android:checked="true"
7575
android:text="@string/providers_twitter" />
7676

77-
<CheckBox
78-
android:id="@+id/github_provider"
79-
android:layout_width="wrap_content"
80-
android:layout_height="wrap_content"
81-
android:checked="true"
82-
android:text="@string/providers_github" />
83-
8477
<CheckBox
8578
android:id="@+id/email_provider"
8679
android:layout_width="wrap_content"
@@ -289,29 +282,6 @@
289282
android:checked="false"
290283
android:text="@string/facebook_permission_photos" />
291284

292-
<TextView
293-
android:id="@+id/github_permissions_header"
294-
style="@style/Base.TextAppearance.AppCompat.Subhead"
295-
android:layout_width="wrap_content"
296-
android:layout_height="wrap_content"
297-
android:layout_marginTop="16dp"
298-
android:layout_marginBottom="8dp"
299-
android:text="@string/github_permissions_header" />
300-
301-
<CheckBox
302-
android:id="@+id/github_permission_repo"
303-
android:layout_width="wrap_content"
304-
android:layout_height="wrap_content"
305-
android:checked="false"
306-
android:text="@string/github_permission_repo" />
307-
308-
<CheckBox
309-
android:id="@+id/github_permission_gist"
310-
android:layout_width="wrap_content"
311-
android:layout_height="wrap_content"
312-
android:checked="false"
313-
android:text="@string/github_permission_gist" />
314-
315285
<TextView
316286
style="@style/Base.TextAppearance.AppCompat.Subhead"
317287
android:layout_width="wrap_content"

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<string name="providers_header">Auth providers</string>
2626
<string name="providers_google">Google</string>
2727
<string name="providers_facebook">Facebook</string>
28-
<string name="providers_github">GitHub</string>
2928
<string name="providers_twitter">Twitter</string>
3029
<string name="providers_email">Email</string>
3130
<string name="providers_email_link">Email link</string>
@@ -60,10 +59,6 @@
6059
<string name="facebook_permission_friends">Friends</string>
6160
<string name="facebook_permission_photos">Photos</string>
6261

63-
<string name="github_permissions_header">Example extra GitHub permissions</string>
64-
<string name="github_permission_repo">Repo</string>
65-
<string name="github_permission_gist">Gist</string>
66-
6762
<string name="options_header">Other Options</string>
6863
<string name="options_enable_credential_selector">Enable Smart Lock\'s credential selector</string>
6964
<string name="options_enable_hint_selector">Enable Smart Lock\'s hint selector</string>
@@ -74,7 +69,6 @@
7469
<string name="google_label_missing_config">Google configuration missing</string>
7570
<string name="facebook_label_missing_config">Facebook configuration missing</string>
7671
<string name="twitter_label_missing_config">Twitter configuration missing</string>
77-
<string name="github_label_missing_config">GitHub configuration missing</string>
7872

7973
<string name="sign_in_cancelled">Sign in cancelled</string>
8074
<string name="no_internet_connection">No internet connection</string>

0 commit comments

Comments
 (0)