Skip to content

Commit 5bb61d1

Browse files
SUPERCILEXsamtstern
authored andcommitted
Complete rewrite/refactor of email sign in flow (#418)
1 parent d783f19 commit 5bb61d1

19 files changed

+232
-571
lines changed

app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
public class AuthUiActivity extends AppCompatActivity {
5151
private static final String UNCHANGED_CONFIG_VALUE = "CHANGE-ME";
5252
private static final String GOOGLE_TOS_URL = "https://www.google.com/policies/terms/";
53-
private static final String FIREBASE_TOS_URL = "https://www.firebase.com/terms/terms-of-service.html";
53+
private static final String FIREBASE_TOS_URL = "https://firebase.google.com/terms/";
5454
private static final int RC_SIGN_IN = 100;
5555

5656
@BindView(R.id.default_theme)

auth/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ android {
3838

3939
dependencies {
4040
compile "com.android.support:design:$support_library_version"
41+
compile "com.android.support:customtabs:$support_library_version"
42+
4143
compile "com.google.firebase:firebase-auth:$firebase_version"
4244
compile "com.google.android.gms:play-services-auth:$firebase_version"
4345

@@ -46,7 +48,6 @@ dependencies {
4648

4749
// The following libraries are needed to prevent incompatibilities with the facebook
4850
// library when updating com.android.support libraries:
49-
compile "com.android.support:customtabs:$support_library_version"
5051
compile "com.android.support:cardview-v7:$support_library_version"
5152

5253

auth/src/main/AndroidManifest.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525
android:exported="false"
2626
android:theme="@style/Theme.AppCompat.NoActionBar"/>
2727

28-
<activity
29-
android:name=".ui.email.EmailHintContainerActivity"
30-
android:label="@string/default_toolbar_title"
31-
android:exported="false"
32-
android:theme="@style/Theme.AppCompat.NoActionBar"/>
33-
3428
<activity
3529
android:name=".ui.email.RecoverPasswordActivity"
3630
android:label="@string/title_recover_password_activity"
@@ -43,12 +37,6 @@
4337
android:exported="false"
4438
android:theme="@style/FirebaseUI"/>
4539

46-
<activity
47-
android:name=".ui.email.SignInNoPasswordActivity"
48-
android:label="@string/title_sign_in_no_password_activity"
49-
android:exported="false"
50-
android:theme="@style/FirebaseUI"/>
51-
5240
<activity
5341
android:name=".ui.email.SignInActivity"
5442
android:label="@string/title_sign_in_activity"

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public ActivityHelper(AppCompatBase activity, Intent intent) {
2929
mActivity = activity;
3030
}
3131

32+
public void configureTheme() {
33+
mActivity.setTheme(getFlowParams().themeId);
34+
}
35+
3236
public void startActivityForResult(Intent intent, int requestCode) {
3337
mActivity.startActivityForResult(intent, requestCode);
3438
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@
2222

2323
public class BaseHelper {
2424
protected Context mContext;
25+
protected ProgressDialog mProgressDialog;
2526
private final FlowParameters mFlowParams;
26-
private ProgressDialog mProgressDialog;
2727

2828
public BaseHelper(Context context, FlowParameters parameters) {
2929
mContext = context;
3030
mFlowParams = parameters;
3131
}
3232

33-
public void configureTheme() {
34-
mContext.setTheme(mFlowParams.themeId);
35-
}
36-
3733
public FlowParameters getFlowParams() {
3834
return mFlowParams;
3935
}
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.firebase.ui.auth.ui;
22

3+
import android.app.ProgressDialog;
34
import android.content.Intent;
45
import android.content.IntentSender;
56
import android.os.Bundle;
@@ -9,7 +10,7 @@ public class FragmentHelper extends BaseHelper {
910
private Fragment mFragment;
1011

1112
public FragmentHelper(Fragment fragment) {
12-
super(fragment.getContext(), (FlowParameters) fragment.getArguments()
13+
super(fragment.getContext().getApplicationContext(), (FlowParameters) fragment.getArguments()
1314
.getParcelable(ExtraConstants.EXTRA_FLOW_PARAMS));
1415
mFragment = fragment;
1516
}
@@ -18,14 +19,20 @@ public void finish(int resultCode, Intent intent) {
1819
finishActivity(mFragment.getActivity(), resultCode, intent);
1920
}
2021

21-
public static Bundle getFlowParamsBundle(FlowParameters params) {
22-
Bundle bundle = new Bundle();
23-
bundle.putParcelable(ExtraConstants.EXTRA_FLOW_PARAMS, params);
24-
return bundle;
22+
@Override
23+
public void showLoadingDialog(String message) {
24+
dismissDialog();
25+
mProgressDialog = ProgressDialog.show(mFragment.getContext(), "", message, true);
2526
}
2627

2728
public void startIntentSenderForResult(IntentSender sender, int requestCode)
2829
throws IntentSender.SendIntentException {
2930
mFragment.startIntentSenderForResult(sender, requestCode, null, 0, 0, 0, null);
3031
}
32+
33+
public static Bundle getFlowParamsBundle(FlowParameters params) {
34+
Bundle bundle = new Bundle();
35+
bundle.putParcelable(ExtraConstants.EXTRA_FLOW_PARAMS, params);
36+
return bundle;
37+
}
3138
}

auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackPasswordPrompt.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public void onSuccess(AuthResult authResult) {
146146
});
147147
}
148148
})
149-
.addOnFailureListener(new OnFailureListener() {
149+
.addOnFailureListener(this, new OnFailureListener() {
150150
@Override
151151
public void onFailure(@NonNull Exception e) {
152152
mActivityHelper.dismissDialog();

auth/src/main/java/com/firebase/ui/auth/ui/email/AcquireEmailHelper.java

Lines changed: 0 additions & 108 deletions
This file was deleted.

auth/src/main/java/com/firebase/ui/auth/ui/email/EmailHintContainerActivity.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)