88
88
* See the <a href="https://github.com/firebase/FirebaseUI-Android/blob/master/auth/README.md#table-of-contents">README</a>
89
89
* for examples on how to get started with FirebaseUI Auth.
90
90
*/
91
- public class AuthUI {
91
+ public final class AuthUI {
92
92
93
93
private static final String TAG = "AuthUI" ;
94
94
@@ -102,79 +102,6 @@ public class AuthUI {
102
102
@ Retention (RetentionPolicy .SOURCE )
103
103
public @interface SupportedProvider {}
104
104
105
- /**
106
- * Provider identifier for email and password credentials, for use with {@link
107
- * SignInIntentBuilder#setAvailableProviders(List)}.
108
- *
109
- * @deprecated this constant is no longer needed, use the {@link IdpConfig.EmailBuilder}
110
- * directly or {@link EmailAuthProvider#PROVIDER_ID} if needed.
111
- */
112
- @ Deprecated
113
- public static final String EMAIL_PROVIDER = EmailAuthProvider .PROVIDER_ID ;
114
-
115
- /**
116
- * Provider identifier for Google, for use with {@link SignInIntentBuilder#setAvailableProviders(List)}.
117
- *
118
- * @deprecated this constant is no longer needed, use the {@link IdpConfig.GoogleBuilder}
119
- * directly or {@link GoogleAuthProvider#PROVIDER_ID} if needed.
120
- */
121
- @ Deprecated
122
- public static final String GOOGLE_PROVIDER = GoogleAuthProvider .PROVIDER_ID ;
123
-
124
- /**
125
- * Provider identifier for Facebook, for use with {@link SignInIntentBuilder#setAvailableProviders(List)}.
126
- *
127
- * @deprecated this constant is no longer needed, use the {@link IdpConfig.FacebookBuilder}
128
- * directly or {@link FacebookAuthProvider#PROVIDER_ID} if needed.
129
- */
130
- @ Deprecated
131
- public static final String FACEBOOK_PROVIDER = FacebookAuthProvider .PROVIDER_ID ;
132
-
133
- /**
134
- * Provider identifier for Twitter, for use with {@link SignInIntentBuilder#setAvailableProviders(List)}.
135
- *
136
- * @deprecated this constant is no longer needed, use the {@link IdpConfig.TwitterBuilder}
137
- * directly or {@link TwitterAuthProvider#PROVIDER_ID} if needed.
138
- */
139
- @ Deprecated
140
- public static final String TWITTER_PROVIDER = TwitterAuthProvider .PROVIDER_ID ;
141
-
142
- /**
143
- * Provider identifier for Phone, for use with {@link SignInIntentBuilder#setAvailableProviders(List)}.
144
- *
145
- * @deprecated this constant is no longer needed, use the {@link IdpConfig.PhoneBuilder}
146
- * directly or {@link PhoneAuthProvider#PROVIDER_ID} if needed.
147
- */
148
- @ Deprecated
149
- public static final String PHONE_VERIFICATION_PROVIDER = PhoneAuthProvider .PROVIDER_ID ;
150
-
151
- /**
152
- * Bundle key for the default full phone number parameter.
153
- *
154
- * @deprecated this constant is no longer needed, use {@link IdpConfig.PhoneBuilder#setDefaultNumber(String)}
155
- * instead.
156
- */
157
- @ Deprecated
158
- public static final String EXTRA_DEFAULT_PHONE_NUMBER = ExtraConstants .PHONE ;
159
-
160
- /**
161
- * Bundle key for the default phone country code parameter.
162
- *
163
- * @deprecated this constant is no longer needed, use {@link IdpConfig.PhoneBuilder#setDefaultNumber(String,
164
- * String)} instead.
165
- */
166
- @ Deprecated
167
- public static final String EXTRA_DEFAULT_COUNTRY_CODE = ExtraConstants .COUNTRY_ISO ;
168
-
169
- /**
170
- * Bundle key for the default national phone number parameter.
171
- *
172
- * @deprecated this constant is no longer needed, use {@link IdpConfig.PhoneBuilder#setDefaultNumber(String,
173
- * String)} instead.
174
- */
175
- @ Deprecated
176
- public static final String EXTRA_DEFAULT_NATIONAL_NUMBER = ExtraConstants .NATIONAL_NUMBER ;
177
-
178
105
/**
179
106
* Default value for logo resource, omits the logo from the {@link AuthMethodPickerActivity}.
180
107
*/
@@ -502,7 +429,7 @@ public SignInIntentBuilder createSignInIntentBuilder() {
502
429
/**
503
430
* Configuration for an identity provider.
504
431
*/
505
- public static class IdpConfig implements Parcelable {
432
+ public static final class IdpConfig implements Parcelable {
506
433
public static final Creator <IdpConfig > CREATOR = new Creator <IdpConfig >() {
507
434
@ Override
508
435
public IdpConfig createFromParcel (Parcel in ) {
@@ -536,32 +463,6 @@ public String getProviderId() {
536
463
return mProviderId ;
537
464
}
538
465
539
- /**
540
- * @deprecated use the lists of scopes you passed in directly, or get a provider-specific
541
- * implementation from {@link #getParams()}.
542
- */
543
- @ Deprecated
544
- @ NonNull
545
- public List <String > getScopes () {
546
- List <String > permissions ;
547
- if (mProviderId .equals (GoogleAuthProvider .PROVIDER_ID )) {
548
- Scope [] array = ((GoogleSignInOptions )
549
- mParams .getParcelable (ExtraConstants .GOOGLE_SIGN_IN_OPTIONS ))
550
- .getScopeArray ();
551
-
552
- List <String > scopes = new ArrayList <>();
553
- for (Scope scope : array ) {
554
- scopes .add (scope .toString ());
555
- }
556
- permissions = scopes ;
557
- } else if (mProviderId .equals (FacebookAuthProvider .PROVIDER_ID )) {
558
- permissions = mParams .getStringArrayList (ExtraConstants .FACEBOOK_PERMISSIONS );
559
- } else {
560
- permissions = null ;
561
- }
562
- return permissions == null ? Collections .<String >emptyList () : permissions ;
563
- }
564
-
565
466
/**
566
467
* @return provider-specific options
567
468
*/
@@ -613,16 +514,7 @@ public static class Builder {
613
514
@ SupportedProvider private final String mProviderId ;
614
515
private final Bundle mParams = new Bundle ();
615
516
616
- /**
617
- * Builds the configuration parameters for an identity provider.
618
- *
619
- * @param providerId An ID of one of the supported identity providers. e.g. {@link
620
- * AuthUI#GOOGLE_PROVIDER}. See {@link AuthUI#SUPPORTED_PROVIDERS} for
621
- * the complete list of supported Identity providers
622
- * @deprecated use the provider's specific builder, for example, {@link GoogleBuilder}
623
- */
624
- @ Deprecated
625
- public Builder (@ SupportedProvider @ NonNull String providerId ) {
517
+ protected Builder (@ SupportedProvider @ NonNull String providerId ) {
626
518
if (!SUPPORTED_PROVIDERS .contains (providerId )) {
627
519
throw new IllegalArgumentException ("Unknown provider: " + providerId );
628
520
}
@@ -631,69 +523,13 @@ public Builder(@SupportedProvider @NonNull String providerId) {
631
523
632
524
@ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
633
525
@ NonNull
634
- protected Bundle getParams () {
526
+ protected final Bundle getParams () {
635
527
return mParams ;
636
528
}
637
529
638
- /**
639
- * @deprecated additional phone verification options are now available on the phone
640
- * builder: {@link PhoneBuilder#setDefaultNumber(String, String)}.
641
- */
642
- @ NonNull
643
- @ Deprecated
644
- public Builder setParams (@ Nullable Bundle params ) {
645
- mParams .clear ();
646
- mParams .putAll (params == null ? new Bundle () : params );
647
- return this ;
648
- }
649
-
650
- /**
651
- * Specifies the additional permissions that the application will request for this
652
- * identity provider.
653
- * <p>
654
- * For Facebook permissions see:
655
- * https://developers.facebook.com/docs/facebook-login/android
656
- * https://developers.facebook.com/docs/facebook-login/permissions
657
- * <p>
658
- * For Google permissions see:
659
- * https://developers.google.com/identity/protocols/googlescopes
660
- * <p>
661
- * Twitter permissions are only configurable through the
662
- * <a href="https://apps.twitter.com/">Twitter developer console</a>.
663
- *
664
- * @deprecated use the provider's specific builder. For Google, use {@link
665
- * GoogleBuilder#setScopes(List)}. For Facebook, use {@link FacebookBuilder#setPermissions(List)}.
666
- */
667
- @ NonNull
668
- @ Deprecated
669
- public Builder setPermissions (@ Nullable List <String > permissions ) {
670
- if (permissions == null ) {
671
- mParams .clear ();
672
- return this ;
673
- }
674
-
675
- Bundle params ;
676
- if (mProviderId .equals (GOOGLE_PROVIDER )) {
677
- params = new GoogleBuilder ().setScopes (permissions ).build ().getParams ();
678
- } else if (mProviderId .equals (FACEBOOK_PROVIDER )) {
679
- params = new FacebookBuilder ().setPermissions (permissions ).build ().getParams ();
680
- } else {
681
- params = new Bundle ();
682
- }
683
- setParams (params );
684
- return this ;
685
- }
686
-
687
530
@ CallSuper
688
531
@ NonNull
689
532
public IdpConfig build () {
690
- // Ensures deprecated Google provider builder backcompat
691
- if (mProviderId .equals (GoogleAuthProvider .PROVIDER_ID )
692
- && getClass () == Builder .class
693
- && mParams .isEmpty ()) {
694
- return new GoogleBuilder ().build ();
695
- }
696
-
697
533
return new IdpConfig (mProviderId , mParams );
698
534
}
699
535
}
@@ -703,7 +539,6 @@ && getClass() == Builder.class
703
539
*/
704
540
public static final class EmailBuilder extends Builder {
705
541
public EmailBuilder () {
706
- //noinspection deprecation taking a hit for the backcompat team
707
542
super (EmailAuthProvider .PROVIDER_ID );
708
543
}
709
544
@@ -736,7 +571,6 @@ public EmailBuilder setRequireName(boolean requireName) {
736
571
*/
737
572
public static final class PhoneBuilder extends Builder {
738
573
public PhoneBuilder () {
739
- //noinspection deprecation taking a hit for the backcompat team
740
574
super (PhoneAuthProvider .PROVIDER_ID );
741
575
}
742
576
@@ -809,7 +643,6 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
809
643
*/
810
644
public static final class GoogleBuilder extends Builder {
811
645
public GoogleBuilder () {
812
- //noinspection deprecation taking a hit for the backcompat team
813
646
super (GoogleAuthProvider .PROVIDER_ID );
814
647
Preconditions .checkConfigured (getApplicationContext (),
815
648
"Check your google-services plugin configuration, the" +
@@ -873,7 +706,6 @@ public static final class FacebookBuilder extends Builder {
873
706
private static final String TAG = "FacebookBuilder" ;
874
707
875
708
public FacebookBuilder () {
876
- //noinspection deprecation taking a hit for the backcompat team
877
709
super (FacebookAuthProvider .PROVIDER_ID );
878
710
if (!ProviderAvailability .IS_FACEBOOK_AVAILABLE ) {
879
711
throw new RuntimeException (
@@ -897,7 +729,6 @@ public FacebookBuilder() {
897
729
* Facebook Login SDK. Available permissions can be found <a
898
730
* href="https://developers.facebook.com/docs/facebook-login/permissions">here</a>.
899
731
*/
900
- @ SuppressWarnings ({"deprecation" , "NullableProblems" }) // For backcompat
901
732
@ NonNull
902
733
public FacebookBuilder setPermissions (@ NonNull List <String > permissions ) {
903
734
getParams ().putStringArrayList (
@@ -911,7 +742,6 @@ public FacebookBuilder setPermissions(@NonNull List<String> permissions) {
911
742
*/
912
743
public static final class TwitterBuilder extends Builder {
913
744
public TwitterBuilder () {
914
- //noinspection deprecation taking a hit for the backcompat team
915
745
super (TwitterAuthProvider .PROVIDER_ID );
916
746
if (!ProviderAvailability .IS_TWITTER_AVAILABLE ) {
917
747
throw new RuntimeException (
@@ -942,8 +772,6 @@ private abstract class AuthIntentBuilder<T extends AuthIntentBuilder> {
942
772
boolean mEnableCredentials = true ;
943
773
boolean mEnableHints = true ;
944
774
945
- private AuthIntentBuilder () {}
946
-
947
775
/**
948
776
* Specifies the theme to use for the application flow. If no theme is specified, a default
949
777
* theme will be used.
@@ -1013,34 +841,6 @@ public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) {
1013
841
return (T ) this ;
1014
842
}
1015
843
1016
- /**
1017
- * Specified the set of supported authentication providers. At least one provider must be
1018
- * specified. There may only be one instance of each provider.
1019
- * <p>
1020
- * <p>If no providers are explicitly specified by calling this method, then the email
1021
- * provider is the default supported provider.
1022
- *
1023
- * @param idpConfigs a list of {@link IdpConfig}s, where each {@link IdpConfig} contains the
1024
- * configuration parameters for the IDP.
1025
- * @see IdpConfig
1026
- * @deprecated because the order in which providers were displayed was the inverse of the
1027
- * order in which they were supplied. Use {@link #setAvailableProviders(List)} to display
1028
- * the providers in the order in which they were supplied.
1029
- */
1030
- @ Deprecated
1031
- public T setProviders (@ NonNull List <IdpConfig > idpConfigs ) {
1032
- setAvailableProviders (idpConfigs );
1033
-
1034
- // Ensure email provider is at the bottom to keep backwards compatibility
1035
- int emailProviderIndex = mProviders .indexOf (new IdpConfig .Builder (EMAIL_PROVIDER ).build ());
1036
- if (emailProviderIndex != -1 ) {
1037
- mProviders .add (0 , mProviders .remove (emailProviderIndex ));
1038
- }
1039
- Collections .reverse (mProviders );
1040
-
1041
- return (T ) this ;
1042
- }
1043
-
1044
844
/**
1045
845
* Enables or disables the use of Smart Lock for Passwords in the sign in flow. To
1046
846
* (en)disable hint selector and credential selector independently use {@link
@@ -1088,45 +888,10 @@ public Intent build() {
1088
888
* Builder for the intent to start the user authentication flow.
1089
889
*/
1090
890
public final class SignInIntentBuilder extends AuthIntentBuilder <SignInIntentBuilder > {
1091
- private Boolean mAllowNewEmailAccounts ;
1092
-
1093
891
private SignInIntentBuilder () {
1094
892
super ();
1095
893
}
1096
894
1097
- /**
1098
- * Enables or disables creating new accounts in the email sign in flow.
1099
- * <p>
1100
- * <p>Account creation is enabled by default.
1101
- *
1102
- * @deprecated set this option directly on the email builder: {@link
1103
- * IdpConfig.EmailBuilder#setAllowNewAccounts(boolean)}.
1104
- */
1105
- @ NonNull
1106
- @ Deprecated
1107
- public SignInIntentBuilder setAllowNewEmailAccounts (boolean enabled ) {
1108
- mAllowNewEmailAccounts = enabled ;
1109
- return this ;
1110
- }
1111
-
1112
- @ NonNull
1113
- @ Override
1114
- public Intent build () {
1115
- if (mAllowNewEmailAccounts != null ) {
1116
- // To ensure setAllowNewEmailAccounts backcompat
1117
- for (int i = 0 ; i < mProviders .size (); i ++) {
1118
- if (mProviders .get (i ).getProviderId ().equals (EmailAuthProvider .PROVIDER_ID )) {
1119
- mProviders .set (i , new IdpConfig .EmailBuilder ()
1120
- .setAllowNewAccounts (mAllowNewEmailAccounts )
1121
- .build ());
1122
- break ;
1123
- }
1124
- }
1125
- }
1126
-
1127
- return super .build ();
1128
- }
1129
-
1130
895
@ Override
1131
896
protected FlowParameters getFlowParams () {
1132
897
return new FlowParameters (
0 commit comments