-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rewrite phone auth with new architecture and finalize progress revamp #1253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
39c738c
5521766
9db26b3
5f173bf
acbe856
e3a0e20
ea57741
5ffedde
bfb3b22
f7d0d8d
55cb384
077ba85
813079f
55cee9a
ff73ae8
e9cd127
7dced0f
f441e79
015884e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.firebase.ui.auth.data.model; | ||
|
|
||
| import android.support.annotation.NonNull; | ||
| import android.support.annotation.RestrictTo; | ||
|
|
||
| import com.firebase.ui.auth.ErrorCodes; | ||
| import com.firebase.ui.auth.FirebaseUiException; | ||
|
|
||
| /** | ||
| * Represents an error in which the phone number couldn't be automatically verified and must | ||
| * therefore be manually verified by the client by sending an SMS code. | ||
| */ | ||
| @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
| public class PhoneNumberVerificationRequiredException extends FirebaseUiException { | ||
| private final String mPhoneNumber; | ||
|
|
||
| /** | ||
| * @param number the phone number requiring verification, formatted with a country code prefix | ||
| */ | ||
| public PhoneNumberVerificationRequiredException(@NonNull String number) { | ||
| super(ErrorCodes.PROVIDER_ERROR, "Phone number requires verification."); | ||
| mPhoneNumber = number; | ||
| } | ||
|
|
||
| /** | ||
| * @return the phone number requiring verification | ||
| */ | ||
| @NonNull | ||
| public String getPhoneNumber() { | ||
| return mPhoneNumber; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ | |
| import android.app.Activity; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.os.Bundle; | ||
| import android.support.annotation.NonNull; | ||
| import android.support.annotation.Nullable; | ||
| import android.support.annotation.RestrictTo; | ||
|
|
@@ -13,7 +12,6 @@ | |
| import com.firebase.ui.auth.IdpResponse; | ||
| import com.firebase.ui.auth.data.model.FlowParameters; | ||
| import com.firebase.ui.auth.ui.credentials.CredentialSaveActivity; | ||
| import com.firebase.ui.auth.util.AuthHelper; | ||
| import com.firebase.ui.auth.util.CredentialUtils; | ||
| import com.firebase.ui.auth.util.ExtraConstants; | ||
| import com.firebase.ui.auth.util.data.ProviderUtils; | ||
|
|
@@ -23,14 +21,10 @@ | |
|
|
||
| import static com.firebase.ui.auth.util.Preconditions.checkNotNull; | ||
|
|
||
| @SuppressWarnings("Registered") | ||
| @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
| public class HelperActivityBase extends AppCompatActivity implements ProgressView { | ||
| public abstract class HelperActivityBase extends AppCompatActivity implements ProgressView { | ||
| private FlowParameters mParams; | ||
|
|
||
| private AuthHelper mAuthHelper; | ||
| private ProgressDialogHolder mProgressDialogHolder; | ||
|
|
||
| protected static Intent createBaseIntent( | ||
| @NonNull Context context, | ||
| @NonNull Class<? extends Activity> target, | ||
|
|
@@ -42,19 +36,6 @@ protected static Intent createBaseIntent( | |
| checkNotNull(flowParams, "flowParams cannot be null")); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| mAuthHelper = new AuthHelper(getFlowParams()); | ||
| mProgressDialogHolder = new ProgressDialogHolder(this); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onDestroy() { | ||
| super.onDestroy(); | ||
| mProgressDialogHolder.dismissDialog(); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
| super.onActivityResult(requestCode, resultCode, data); | ||
|
|
@@ -71,10 +52,6 @@ public FlowParameters getFlowParams() { | |
| return mParams; | ||
| } | ||
|
|
||
| public AuthHelper getAuthHelper() { | ||
| return mAuthHelper; | ||
| } | ||
|
|
||
| public void finish(int resultCode, @Nullable Intent intent) { | ||
| setResult(resultCode, intent); | ||
| finish(); | ||
|
|
@@ -97,15 +74,13 @@ public void startSaveCredentials( | |
|
|
||
| @Override | ||
| public void showProgress(@StringRes int message) { | ||
| getDialogHolder().showLoadingDialog(message); | ||
| throw new UnsupportedOperationException( | ||
| "Either a fragment or activity must handle progress updates."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we just make these two methods I think what you're trying to do is not allow events to bubble up from fragments but maybe then we should remove the default behavior from the fragment?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, I thought we still had some fragments that forwarded progress updates to the activity, but I guess the was in the |
||
| } | ||
|
|
||
| @Override | ||
| public void hideProgress() { | ||
| getDialogHolder().dismissDialog(); | ||
| } | ||
|
|
||
| protected ProgressDialogHolder getDialogHolder() { | ||
| return mProgressDialogHolder; | ||
| throw new UnsupportedOperationException( | ||
| "Either a fragment or activity must handle progress updates."); | ||
| } | ||
| } | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the helper activity doesn't even have a helper! Love seeing this class die haha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, that was the first class to die when I started the refactor—it killed me when I had to add it back for the staged PRs. 😆