2222import com .firebase .ui .auth .AuthUI .IdpConfig ;
2323import com .firebase .ui .auth .util .ExtraConstants ;
2424import com .firebase .ui .auth .util .Preconditions ;
25+ import com .google .firebase .auth .ActionCodeSettings ;
2526
2627import java .util .Collections ;
2728import java .util .List ;
@@ -44,6 +45,7 @@ public class FlowParameters implements Parcelable {
4445 public FlowParameters createFromParcel (Parcel in ) {
4546 String appName = in .readString ();
4647 List <IdpConfig > providerInfo = in .createTypedArrayList (IdpConfig .CREATOR );
48+ IdpConfig defaultProvider = in .readParcelable (IdpConfig .class .getClassLoader ());
4749 int themeId = in .readInt ();
4850 int logoId = in .readInt ();
4951 String termsOfServiceUrl = in .readString ();
@@ -52,12 +54,15 @@ public FlowParameters createFromParcel(Parcel in) {
5254 boolean enableHints = in .readInt () != 0 ;
5355 boolean enableAnonymousUpgrade = in .readInt () != 0 ;
5456 boolean alwaysShowProviderChoice = in .readInt () != 0 ;
57+ boolean lockOrientation = in .readInt () != 0 ;
5558 String emailLink = in .readString ();
59+ ActionCodeSettings passwordResetSettings = in .readParcelable (ActionCodeSettings .class .getClassLoader ());
5660 AuthMethodPickerLayout customLayout = in .readParcelable (AuthMethodPickerLayout .class .getClassLoader ());
5761
5862 return new FlowParameters (
5963 appName ,
6064 providerInfo ,
65+ defaultProvider ,
6166 themeId ,
6267 logoId ,
6368 termsOfServiceUrl ,
@@ -66,7 +71,9 @@ public FlowParameters createFromParcel(Parcel in) {
6671 enableHints ,
6772 enableAnonymousUpgrade ,
6873 alwaysShowProviderChoice ,
74+ lockOrientation ,
6975 emailLink ,
76+ passwordResetSettings ,
7077 customLayout );
7178 }
7279
@@ -82,6 +89,9 @@ public FlowParameters[] newArray(int size) {
8289 @ NonNull
8390 public final List <IdpConfig > providers ;
8491
92+ @ Nullable
93+ public final IdpConfig defaultProvider ;
94+
8595 @ StyleRes
8696 public final int themeId ;
8797
@@ -97,17 +107,22 @@ public FlowParameters[] newArray(int size) {
97107 @ Nullable
98108 public String emailLink ;
99109
110+ @ Nullable
111+ public final ActionCodeSettings passwordResetSettings ;
112+
100113 public final boolean enableCredentials ;
101114 public final boolean enableHints ;
102115 public final boolean enableAnonymousUpgrade ;
103116 public final boolean alwaysShowProviderChoice ;
117+ public final boolean lockOrientation ;
104118
105119 @ Nullable
106120 public final AuthMethodPickerLayout authMethodPickerLayout ;
107121
108122 public FlowParameters (
109123 @ NonNull String appName ,
110124 @ NonNull List <IdpConfig > providers ,
125+ @ Nullable IdpConfig defaultProvider ,
111126 @ StyleRes int themeId ,
112127 @ DrawableRes int logoId ,
113128 @ Nullable String termsOfServiceUrl ,
@@ -116,11 +131,14 @@ public FlowParameters(
116131 boolean enableHints ,
117132 boolean enableAnonymousUpgrade ,
118133 boolean alwaysShowProviderChoice ,
134+ boolean lockOrientation ,
119135 @ Nullable String emailLink ,
136+ @ Nullable ActionCodeSettings passwordResetSettings ,
120137 @ Nullable AuthMethodPickerLayout authMethodPickerLayout ) {
121138 this .appName = Preconditions .checkNotNull (appName , "appName cannot be null" );
122139 this .providers = Collections .unmodifiableList (
123140 Preconditions .checkNotNull (providers , "providers cannot be null" ));
141+ this .defaultProvider = defaultProvider ;
124142 this .themeId = themeId ;
125143 this .logoId = logoId ;
126144 this .termsOfServiceUrl = termsOfServiceUrl ;
@@ -129,7 +147,9 @@ public FlowParameters(
129147 this .enableHints = enableHints ;
130148 this .enableAnonymousUpgrade = enableAnonymousUpgrade ;
131149 this .alwaysShowProviderChoice = alwaysShowProviderChoice ;
150+ this .lockOrientation = lockOrientation ;
132151 this .emailLink = emailLink ;
152+ this .passwordResetSettings = passwordResetSettings ;
133153 this .authMethodPickerLayout = authMethodPickerLayout ;
134154 }
135155
@@ -144,6 +164,7 @@ public static FlowParameters fromIntent(Intent intent) {
144164 public void writeToParcel (Parcel dest , int flags ) {
145165 dest .writeString (appName );
146166 dest .writeTypedList (providers );
167+ dest .writeParcelable (defaultProvider , flags );
147168 dest .writeInt (themeId );
148169 dest .writeInt (logoId );
149170 dest .writeString (termsOfServiceUrl );
@@ -152,7 +173,9 @@ public void writeToParcel(Parcel dest, int flags) {
152173 dest .writeInt (enableHints ? 1 : 0 );
153174 dest .writeInt (enableAnonymousUpgrade ? 1 : 0 );
154175 dest .writeInt (alwaysShowProviderChoice ? 1 : 0 );
176+ dest .writeInt (lockOrientation ? 1 : 0 );
155177 dest .writeString (emailLink );
178+ dest .writeParcelable (passwordResetSettings , flags );
156179 dest .writeParcelable (authMethodPickerLayout , flags );
157180 }
158181
@@ -178,6 +201,10 @@ public boolean isAnonymousUpgradeEnabled() {
178201 }
179202
180203 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 );
182209 }
183210}
0 commit comments