Skip to content

Commit 2a71671

Browse files
committed
Remove all deprecated APIs
Signed-off-by: Alex Saveau <[email protected]>
1 parent f7282bd commit 2a71671

File tree

5 files changed

+4
-340
lines changed

5 files changed

+4
-340
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
@@ -87,7 +87,7 @@
8787
* See the <a href="https://github.com/firebase/FirebaseUI-Android/blob/master/auth/README.md#table-of-contents">README</a>
8888
* for examples on how to get started with FirebaseUI Auth.
8989
*/
90-
public class AuthUI {
90+
public final class AuthUI {
9191

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

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

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-
177104
/**
178105
* Default value for logo resource, omits the logo from the {@link AuthMethodPickerActivity}.
179106
*/
@@ -500,7 +427,7 @@ public SignInIntentBuilder createSignInIntentBuilder() {
500427
/**
501428
* Configuration for an identity provider.
502429
*/
503-
public static class IdpConfig implements Parcelable {
430+
public static final class IdpConfig implements Parcelable {
504431
public static final Creator<IdpConfig> CREATOR = new Creator<IdpConfig>() {
505432
@Override
506433
public IdpConfig createFromParcel(Parcel in) {
@@ -534,32 +461,6 @@ public String getProviderId() {
534461
return mProviderId;
535462
}
536463

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-
563464
/**
564465
* @return provider-specific options
565466
*/
@@ -611,16 +512,7 @@ public static class Builder {
611512
@SupportedProvider private final String mProviderId;
612513
private final Bundle mParams = new Bundle();
613514

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) {
624516
if (!SUPPORTED_PROVIDERS.contains(providerId)) {
625517
throw new IllegalArgumentException("Unknown provider: " + providerId);
626518
}
@@ -629,69 +521,13 @@ public Builder(@SupportedProvider @NonNull String providerId) {
629521

630522
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
631523
@NonNull
632-
protected Bundle getParams() {
524+
protected final Bundle getParams() {
633525
return mParams;
634526
}
635527

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-
685528
@CallSuper
686529
@NonNull
687530
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-
695531
return new IdpConfig(mProviderId, mParams);
696532
}
697533
}
@@ -701,7 +537,6 @@ && getClass() == Builder.class
701537
*/
702538
public static final class EmailBuilder extends Builder {
703539
public EmailBuilder() {
704-
//noinspection deprecation taking a hit for the backcompat team
705540
super(EmailAuthProvider.PROVIDER_ID);
706541
}
707542

@@ -734,7 +569,6 @@ public EmailBuilder setRequireName(boolean requireName) {
734569
*/
735570
public static final class PhoneBuilder extends Builder {
736571
public PhoneBuilder() {
737-
//noinspection deprecation taking a hit for the backcompat team
738572
super(PhoneAuthProvider.PROVIDER_ID);
739573
}
740574

@@ -807,7 +641,6 @@ public PhoneBuilder setDefaultCountryIso(@NonNull String iso) {
807641
*/
808642
public static final class GoogleBuilder extends Builder {
809643
public GoogleBuilder() {
810-
//noinspection deprecation taking a hit for the backcompat team
811644
super(GoogleAuthProvider.PROVIDER_ID);
812645
Preconditions.checkConfigured(getApplicationContext(),
813646
"Check your google-services plugin configuration, the" +
@@ -871,7 +704,6 @@ public static final class FacebookBuilder extends Builder {
871704
private static final String TAG = "FacebookBuilder";
872705

873706
public FacebookBuilder() {
874-
//noinspection deprecation taking a hit for the backcompat team
875707
super(FacebookAuthProvider.PROVIDER_ID);
876708
if (!ProviderAvailability.IS_FACEBOOK_AVAILABLE) {
877709
throw new RuntimeException(
@@ -895,7 +727,6 @@ public FacebookBuilder() {
895727
* Facebook Login SDK. Available permissions can be found <a
896728
* href="https://developers.facebook.com/docs/facebook-login/permissions">here</a>.
897729
*/
898-
@SuppressWarnings({"deprecation", "NullableProblems"}) // For backcompat
899730
@NonNull
900731
public FacebookBuilder setPermissions(@NonNull List<String> permissions) {
901732
getParams().putStringArrayList(
@@ -909,7 +740,6 @@ public FacebookBuilder setPermissions(@NonNull List<String> permissions) {
909740
*/
910741
public static final class TwitterBuilder extends Builder {
911742
public TwitterBuilder() {
912-
//noinspection deprecation taking a hit for the backcompat team
913743
super(TwitterAuthProvider.PROVIDER_ID);
914744
if (!ProviderAvailability.IS_TWITTER_AVAILABLE) {
915745
throw new RuntimeException(
@@ -940,8 +770,6 @@ private abstract class AuthIntentBuilder<T extends AuthIntentBuilder> {
940770
boolean mEnableCredentials = true;
941771
boolean mEnableHints = true;
942772

943-
private AuthIntentBuilder() {}
944-
945773
/**
946774
* Specifies the theme to use for the application flow. If no theme is specified, a default
947775
* theme will be used.
@@ -1011,34 +839,6 @@ public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) {
1011839
return (T) this;
1012840
}
1013841

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-
1042842
/**
1043843
* Enables or disables the use of Smart Lock for Passwords in the sign in flow. To
1044844
* (en)disable hint selector and credential selector independently use {@link
@@ -1086,45 +886,10 @@ public Intent build() {
1086886
* Builder for the intent to start the user authentication flow.
1087887
*/
1088888
public final class SignInIntentBuilder extends AuthIntentBuilder<SignInIntentBuilder> {
1089-
private Boolean mAllowNewEmailAccounts;
1090-
1091889
private SignInIntentBuilder() {
1092890
super();
1093891
}
1094892

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-
1128893
@Override
1129894
protected FlowParameters getFlowParams() {
1130895
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)