Skip to content

Commit 957f7af

Browse files
authored
Remove all deprecated APIs (#1286)
2 parents c49486e + b3a71d9 commit 957f7af

File tree

9 files changed

+11
-347
lines changed

9 files changed

+11
-347
lines changed

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 4 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
* See the <a href="https://github.com/firebase/FirebaseUI-Android/blob/master/auth/README.md#table-of-contents">README</a>
8989
* for examples on how to get started with FirebaseUI Auth.
9090
*/
91-
public class AuthUI {
91+
public final class AuthUI {
9292

9393
private static final String TAG = "AuthUI";
9494

@@ -102,79 +102,6 @@ public class AuthUI {
102102
@Retention(RetentionPolicy.SOURCE)
103103
public @interface SupportedProvider {}
104104

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-
178105
/**
179106
* Default value for logo resource, omits the logo from the {@link AuthMethodPickerActivity}.
180107
*/
@@ -502,7 +429,7 @@ public SignInIntentBuilder createSignInIntentBuilder() {
502429
/**
503430
* Configuration for an identity provider.
504431
*/
505-
public static class IdpConfig implements Parcelable {
432+
public static final class IdpConfig implements Parcelable {
506433
public static final Creator<IdpConfig> CREATOR = new Creator<IdpConfig>() {
507434
@Override
508435
public IdpConfig createFromParcel(Parcel in) {
@@ -536,32 +463,6 @@ public String getProviderId() {
536463
return mProviderId;
537464
}
538465

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-
565466
/**
566467
* @return provider-specific options
567468
*/
@@ -613,16 +514,7 @@ public static class Builder {
613514
@SupportedProvider private final String mProviderId;
614515
private final Bundle mParams = new Bundle();
615516

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) {
626518
if (!SUPPORTED_PROVIDERS.contains(providerId)) {
627519
throw new IllegalArgumentException("Unknown provider: " + providerId);
628520
}
@@ -631,69 +523,13 @@ public Builder(@SupportedProvider @NonNull String providerId) {
631523

632524
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
633525
@NonNull
634-
protected Bundle getParams() {
526+
protected final Bundle getParams() {
635527
return mParams;
636528
}
637529

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-
687530
@CallSuper
688531
@NonNull
689532
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-
697533
return new IdpConfig(mProviderId, mParams);
698534
}
699535
}
@@ -703,7 +539,6 @@ && getClass() == Builder.class
703539
*/
704540
public static final class EmailBuilder extends Builder {
705541
public EmailBuilder() {
706-
//noinspection deprecation taking a hit for the backcompat team
707542
super(EmailAuthProvider.PROVIDER_ID);
708543
}
709544

@@ -736,7 +571,6 @@ public EmailBuilder setRequireName(boolean requireName) {
736571
*/
737572
public static final class PhoneBuilder extends Builder {
738573
public PhoneBuilder() {
739-
//noinspection deprecation taking a hit for the backcompat team
740574
super(PhoneAuthProvider.PROVIDER_ID);
741575
}
742576

@@ -809,7 +643,6 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
809643
*/
810644
public static final class GoogleBuilder extends Builder {
811645
public GoogleBuilder() {
812-
//noinspection deprecation taking a hit for the backcompat team
813646
super(GoogleAuthProvider.PROVIDER_ID);
814647
Preconditions.checkConfigured(getApplicationContext(),
815648
"Check your google-services plugin configuration, the" +
@@ -873,7 +706,6 @@ public static final class FacebookBuilder extends Builder {
873706
private static final String TAG = "FacebookBuilder";
874707

875708
public FacebookBuilder() {
876-
//noinspection deprecation taking a hit for the backcompat team
877709
super(FacebookAuthProvider.PROVIDER_ID);
878710
if (!ProviderAvailability.IS_FACEBOOK_AVAILABLE) {
879711
throw new RuntimeException(
@@ -897,7 +729,6 @@ public FacebookBuilder() {
897729
* Facebook Login SDK. Available permissions can be found <a
898730
* href="https://developers.facebook.com/docs/facebook-login/permissions">here</a>.
899731
*/
900-
@SuppressWarnings({"deprecation", "NullableProblems"}) // For backcompat
901732
@NonNull
902733
public FacebookBuilder setPermissions(@NonNull List<String> permissions) {
903734
getParams().putStringArrayList(
@@ -911,7 +742,6 @@ public FacebookBuilder setPermissions(@NonNull List<String> permissions) {
911742
*/
912743
public static final class TwitterBuilder extends Builder {
913744
public TwitterBuilder() {
914-
//noinspection deprecation taking a hit for the backcompat team
915745
super(TwitterAuthProvider.PROVIDER_ID);
916746
if (!ProviderAvailability.IS_TWITTER_AVAILABLE) {
917747
throw new RuntimeException(
@@ -942,8 +772,6 @@ private abstract class AuthIntentBuilder<T extends AuthIntentBuilder> {
942772
boolean mEnableCredentials = true;
943773
boolean mEnableHints = true;
944774

945-
private AuthIntentBuilder() {}
946-
947775
/**
948776
* Specifies the theme to use for the application flow. If no theme is specified, a default
949777
* theme will be used.
@@ -1013,34 +841,6 @@ public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) {
1013841
return (T) this;
1014842
}
1015843

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-
1044844
/**
1045845
* Enables or disables the use of Smart Lock for Passwords in the sign in flow. To
1046846
* (en)disable hint selector and credential selector independently use {@link
@@ -1088,45 +888,10 @@ public Intent build() {
1088888
* Builder for the intent to start the user authentication flow.
1089889
*/
1090890
public final class SignInIntentBuilder extends AuthIntentBuilder<SignInIntentBuilder> {
1091-
private Boolean mAllowNewEmailAccounts;
1092-
1093891
private SignInIntentBuilder() {
1094892
super();
1095893
}
1096894

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-
1130895
@Override
1131896
protected FlowParameters getFlowParams() {
1132897
return new FlowParameters(

auth/src/main/java/com/firebase/ui/auth/IdpResponse.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
package com.firebase.ui.auth;
1616

17-
import android.app.Activity;
1817
import android.content.Intent;
1918
import android.os.Parcel;
2019
import android.os.Parcelable;
@@ -172,20 +171,6 @@ public String getIdpSecret() {
172171
return mSecret;
173172
}
174173

175-
/**
176-
* Get the error code for a failed sign in
177-
*
178-
* @deprecated use {@link #getError()} instead
179-
*/
180-
@Deprecated
181-
public int getErrorCode() {
182-
if (isSuccessful()) {
183-
return Activity.RESULT_OK;
184-
} else {
185-
return mException.getErrorCode();
186-
}
187-
}
188-
189174
/**
190175
* Get the error for a failed sign in.
191176
*/

0 commit comments

Comments
 (0)