24
24
25
25
import com .facebook .login .LoginManager ;
26
26
import com .firebase .ui .auth .data .model .FlowParameters ;
27
- import com .firebase .ui .auth .data .remote .TwitterSignInHandler ;
28
27
import com .firebase .ui .auth .ui .idp .AuthMethodPickerActivity ;
29
28
import com .firebase .ui .auth .util .CredentialUtils ;
30
29
import com .firebase .ui .auth .util .ExtraConstants ;
61
60
import com .google .firebase .auth .PhoneAuthProvider ;
62
61
import com .google .firebase .auth .TwitterAuthProvider ;
63
62
import com .google .firebase .auth .UserInfo ;
64
- import com .twitter .sdk .android .core .TwitterCore ;
65
63
66
64
import java .lang .annotation .Retention ;
67
65
import java .lang .annotation .RetentionPolicy ;
@@ -139,18 +137,18 @@ public final class AuthUI {
139
137
Collections .unmodifiableSet (new HashSet <>(Arrays .asList (
140
138
MICROSOFT_PROVIDER ,
141
139
YAHOO_PROVIDER ,
142
- APPLE_PROVIDER
140
+ APPLE_PROVIDER ,
141
+ TwitterAuthProvider .PROVIDER_ID
143
142
)));
144
143
145
144
/**
146
- * The set of social authentication providers supported in Firebase Auth UI.
145
+ * The set of social authentication providers supported in Firebase Auth UI using their SDK .
147
146
*/
148
147
@ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
149
148
public static final Set <String > SOCIAL_PROVIDERS =
150
149
Collections .unmodifiableSet (new HashSet <>(Arrays .asList (
151
150
GoogleAuthProvider .PROVIDER_ID ,
152
151
FacebookAuthProvider .PROVIDER_ID ,
153
- TwitterAuthProvider .PROVIDER_ID ,
154
152
GithubAuthProvider .PROVIDER_ID )));
155
153
156
154
@ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
@@ -203,6 +201,13 @@ public static AuthUI getInstance() {
203
201
*/
204
202
@ NonNull
205
203
public static AuthUI getInstance (@ NonNull FirebaseApp app ) {
204
+ if (ProviderAvailability .IS_TWITTER_AVAILABLE ) {
205
+ String releaseUrl = "https://github.com/firebase/FirebaseUI-Android/releases/tag/6.2.0" ;
206
+ Log .w (TAG , String .format ("Beginning with FirebaseUI 6.2.0 you no longer need to " +
207
+ "include the TwitterKit SDK to sign in with Twitter. " +
208
+ "Go to %s for more information" , releaseUrl ));
209
+ }
210
+
206
211
AuthUI authUi ;
207
212
synchronized (INSTANCES ) {
208
213
authUi = INSTANCES .get (app );
@@ -455,10 +460,6 @@ private Task<Void> signOutIdps(@NonNull Context context) {
455
460
if (ProviderAvailability .IS_FACEBOOK_AVAILABLE ) {
456
461
LoginManager .getInstance ().logOut ();
457
462
}
458
- if (ProviderAvailability .IS_TWITTER_AVAILABLE ) {
459
- TwitterSignInHandler .initializeTwitter ();
460
- TwitterCore .getInstance ().getSessionManager ().clearActiveSession ();
461
- }
462
463
return GoogleSignIn .getClient (context , GoogleSignInOptions .DEFAULT_SIGN_IN ).signOut ();
463
464
}
464
465
@@ -483,7 +484,8 @@ public SignInIntentBuilder createSignInIntentBuilder() {
483
484
})
484
485
485
486
@ Retention (RetentionPolicy .SOURCE )
486
- public @interface SupportedProvider {}
487
+ public @interface SupportedProvider {
488
+ }
487
489
488
490
/**
489
491
* Configuration for an identity provider.
@@ -1068,29 +1070,6 @@ public FacebookBuilder setPermissions(@NonNull List<String> permissions) {
1068
1070
}
1069
1071
}
1070
1072
1071
- /**
1072
- * {@link IdpConfig} builder for the Twitter provider.
1073
- */
1074
- public static final class TwitterBuilder extends Builder {
1075
- public TwitterBuilder () {
1076
- super (TwitterAuthProvider .PROVIDER_ID );
1077
- if (!ProviderAvailability .IS_TWITTER_AVAILABLE ) {
1078
- throw new RuntimeException (
1079
- "Twitter provider cannot be configured " +
1080
- "without dependency. Did you forget to add " +
1081
- "'com.twitter.sdk.android:twitter-core:VERSION' dependency?" );
1082
- }
1083
- Preconditions .checkConfigured (getApplicationContext (),
1084
- "Twitter provider unconfigured. Make sure to add your key and secret." +
1085
- " See the docs for more info:" +
1086
- " https://github" +
1087
- ".com/firebase/FirebaseUI-Android/blob/master/auth/README" +
1088
- ".md#twitter" ,
1089
- R .string .twitter_consumer_key ,
1090
- R .string .twitter_consumer_secret );
1091
- }
1092
- }
1093
-
1094
1073
/**
1095
1074
* {@link IdpConfig} builder for the GitHub provider.
1096
1075
*/
@@ -1138,6 +1117,19 @@ public AnonymousBuilder() {
1138
1117
}
1139
1118
}
1140
1119
1120
+ /**
1121
+ * {@link IdpConfig} builder for the Twitter provider.
1122
+ */
1123
+ public static final class TwitterBuilder extends GenericOAuthProviderBuilder {
1124
+ private static final String PROVIDER_NAME = "Twitter" ;
1125
+
1126
+ public TwitterBuilder () {
1127
+ super (TwitterAuthProvider .PROVIDER_ID , PROVIDER_NAME ,
1128
+ R .layout .fui_idp_button_twitter );
1129
+ }
1130
+ }
1131
+
1132
+
1141
1133
/**
1142
1134
* {@link IdpConfig} builder for the Apple provider.
1143
1135
*/
0 commit comments