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