22
22
import com .firebase .ui .auth .AuthUI .IdpConfig ;
23
23
import com .firebase .ui .auth .util .ExtraConstants ;
24
24
import com .firebase .ui .auth .util .Preconditions ;
25
+ import com .google .firebase .auth .ActionCodeSettings ;
25
26
26
27
import java .util .Collections ;
27
28
import java .util .List ;
@@ -44,6 +45,7 @@ public class FlowParameters implements Parcelable {
44
45
public FlowParameters createFromParcel (Parcel in ) {
45
46
String appName = in .readString ();
46
47
List <IdpConfig > providerInfo = in .createTypedArrayList (IdpConfig .CREATOR );
48
+ IdpConfig defaultProvider = in .readParcelable (IdpConfig .class .getClassLoader ());
47
49
int themeId = in .readInt ();
48
50
int logoId = in .readInt ();
49
51
String termsOfServiceUrl = in .readString ();
@@ -52,12 +54,15 @@ public FlowParameters createFromParcel(Parcel in) {
52
54
boolean enableHints = in .readInt () != 0 ;
53
55
boolean enableAnonymousUpgrade = in .readInt () != 0 ;
54
56
boolean alwaysShowProviderChoice = in .readInt () != 0 ;
57
+ boolean lockOrientation = in .readInt () != 0 ;
55
58
String emailLink = in .readString ();
59
+ ActionCodeSettings passwordResetSettings = in .readParcelable (ActionCodeSettings .class .getClassLoader ());
56
60
AuthMethodPickerLayout customLayout = in .readParcelable (AuthMethodPickerLayout .class .getClassLoader ());
57
61
58
62
return new FlowParameters (
59
63
appName ,
60
64
providerInfo ,
65
+ defaultProvider ,
61
66
themeId ,
62
67
logoId ,
63
68
termsOfServiceUrl ,
@@ -66,7 +71,9 @@ public FlowParameters createFromParcel(Parcel in) {
66
71
enableHints ,
67
72
enableAnonymousUpgrade ,
68
73
alwaysShowProviderChoice ,
74
+ lockOrientation ,
69
75
emailLink ,
76
+ passwordResetSettings ,
70
77
customLayout );
71
78
}
72
79
@@ -82,6 +89,9 @@ public FlowParameters[] newArray(int size) {
82
89
@ NonNull
83
90
public final List <IdpConfig > providers ;
84
91
92
+ @ Nullable
93
+ public final IdpConfig defaultProvider ;
94
+
85
95
@ StyleRes
86
96
public final int themeId ;
87
97
@@ -97,17 +107,22 @@ public FlowParameters[] newArray(int size) {
97
107
@ Nullable
98
108
public String emailLink ;
99
109
110
+ @ Nullable
111
+ public final ActionCodeSettings passwordResetSettings ;
112
+
100
113
public final boolean enableCredentials ;
101
114
public final boolean enableHints ;
102
115
public final boolean enableAnonymousUpgrade ;
103
116
public final boolean alwaysShowProviderChoice ;
117
+ public final boolean lockOrientation ;
104
118
105
119
@ Nullable
106
120
public final AuthMethodPickerLayout authMethodPickerLayout ;
107
121
108
122
public FlowParameters (
109
123
@ NonNull String appName ,
110
124
@ NonNull List <IdpConfig > providers ,
125
+ @ Nullable IdpConfig defaultProvider ,
111
126
@ StyleRes int themeId ,
112
127
@ DrawableRes int logoId ,
113
128
@ Nullable String termsOfServiceUrl ,
@@ -116,11 +131,14 @@ public FlowParameters(
116
131
boolean enableHints ,
117
132
boolean enableAnonymousUpgrade ,
118
133
boolean alwaysShowProviderChoice ,
134
+ boolean lockOrientation ,
119
135
@ Nullable String emailLink ,
136
+ @ Nullable ActionCodeSettings passwordResetSettings ,
120
137
@ Nullable AuthMethodPickerLayout authMethodPickerLayout ) {
121
138
this .appName = Preconditions .checkNotNull (appName , "appName cannot be null" );
122
139
this .providers = Collections .unmodifiableList (
123
140
Preconditions .checkNotNull (providers , "providers cannot be null" ));
141
+ this .defaultProvider = defaultProvider ;
124
142
this .themeId = themeId ;
125
143
this .logoId = logoId ;
126
144
this .termsOfServiceUrl = termsOfServiceUrl ;
@@ -129,7 +147,9 @@ public FlowParameters(
129
147
this .enableHints = enableHints ;
130
148
this .enableAnonymousUpgrade = enableAnonymousUpgrade ;
131
149
this .alwaysShowProviderChoice = alwaysShowProviderChoice ;
150
+ this .lockOrientation = lockOrientation ;
132
151
this .emailLink = emailLink ;
152
+ this .passwordResetSettings = passwordResetSettings ;
133
153
this .authMethodPickerLayout = authMethodPickerLayout ;
134
154
}
135
155
@@ -144,6 +164,7 @@ public static FlowParameters fromIntent(Intent intent) {
144
164
public void writeToParcel (Parcel dest , int flags ) {
145
165
dest .writeString (appName );
146
166
dest .writeTypedList (providers );
167
+ dest .writeParcelable (defaultProvider , flags );
147
168
dest .writeInt (themeId );
148
169
dest .writeInt (logoId );
149
170
dest .writeString (termsOfServiceUrl );
@@ -152,7 +173,9 @@ public void writeToParcel(Parcel dest, int flags) {
152
173
dest .writeInt (enableHints ? 1 : 0 );
153
174
dest .writeInt (enableAnonymousUpgrade ? 1 : 0 );
154
175
dest .writeInt (alwaysShowProviderChoice ? 1 : 0 );
176
+ dest .writeInt (lockOrientation ? 1 : 0 );
155
177
dest .writeString (emailLink );
178
+ dest .writeParcelable (passwordResetSettings , flags );
156
179
dest .writeParcelable (authMethodPickerLayout , flags );
157
180
}
158
181
@@ -178,6 +201,10 @@ public boolean isAnonymousUpgradeEnabled() {
178
201
}
179
202
180
203
public boolean shouldShowProviderChoice () {
181
- return !isSingleProviderFlow () || alwaysShowProviderChoice ;
204
+ return defaultProvider == null && (!isSingleProviderFlow () || alwaysShowProviderChoice );
205
+ }
206
+
207
+ public IdpConfig getDefaultOrFirstProvider () {
208
+ return defaultProvider != null ? defaultProvider : providers .get (0 );
182
209
}
183
210
}
0 commit comments