1616
1717import android .app .Activity ;
1818import android .content .Intent ;
19+ import android .os .Bundle ;
1920import android .os .Parcel ;
2021import android .os .Parcelable ;
2122import android .support .annotation .CallSuper ;
2829
2930import com .facebook .login .LoginManager ;
3031import com .firebase .ui .auth .provider .TwitterProvider ;
32+ import com .firebase .ui .auth .ui .ExtraConstants ;
3133import com .firebase .ui .auth .ui .FlowParameters ;
3234import com .firebase .ui .auth .ui .idp .AuthMethodPickerActivity ;
3335import com .firebase .ui .auth .util .GoogleSignInHelper ;
@@ -104,6 +106,21 @@ public class AuthUI {
104106 */
105107 public static final String PHONE_VERIFICATION_PROVIDER = PhoneAuthProvider .PROVIDER_ID ;
106108
109+ /**
110+ * Bundle key for the default full phone number parameter.
111+ */
112+ public static final String EXTRA_DEFAULT_PHONE_NUMBER = ExtraConstants .EXTRA_PHONE ;
113+
114+ /**
115+ * Bundle key for the default phone country code parameter.
116+ */
117+ public static final String EXTRA_DEFAULT_COUNTRY_CODE = ExtraConstants .EXTRA_COUNTRY_CODE ;
118+
119+ /**
120+ * Bundle key for the default national phone number parameter.
121+ */
122+ public static final String EXTRA_DEFAULT_NATIONAL_NUMBER = ExtraConstants .EXTRA_NATIONAL_NUMBER ;
123+
107124 /**
108125 * Default value for logo resource, omits the logo from the {@link AuthMethodPickerActivity}.
109126 */
@@ -269,15 +286,21 @@ public SignInIntentBuilder createSignInIntentBuilder() {
269286 public static class IdpConfig implements Parcelable {
270287 private final String mProviderId ;
271288 private final List <String > mScopes ;
289+ private final Bundle mParams ;
272290
273- private IdpConfig (@ SupportedProvider @ NonNull String providerId , List <String > scopes ) {
291+ private IdpConfig (
292+ @ SupportedProvider @ NonNull String providerId ,
293+ List <String > scopes ,
294+ Bundle params ) {
274295 mProviderId = providerId ;
275296 mScopes = Collections .unmodifiableList (scopes );
297+ mParams = params ;
276298 }
277299
278300 private IdpConfig (Parcel in ) {
279301 mProviderId = in .readString ();
280302 mScopes = Collections .unmodifiableList (in .createStringArrayList ());
303+ mParams = in .readBundle (getClass ().getClassLoader ());
281304 }
282305
283306 @ SupportedProvider
@@ -289,6 +312,10 @@ public List<String> getScopes() {
289312 return mScopes ;
290313 }
291314
315+ public Bundle getParams () {
316+ return mParams ;
317+ }
318+
292319 public static final Creator <IdpConfig > CREATOR = new Creator <IdpConfig >() {
293320 @ Override
294321 public IdpConfig createFromParcel (Parcel in ) {
@@ -310,6 +337,7 @@ public int describeContents() {
310337 public void writeToParcel (Parcel parcel , int i ) {
311338 parcel .writeString (mProviderId );
312339 parcel .writeStringList (mScopes );
340+ parcel .writeBundle (mParams );
313341 }
314342
315343 @ Override
@@ -332,12 +360,14 @@ public String toString() {
332360 return "IdpConfig{" +
333361 "mProviderId='" + mProviderId + '\'' +
334362 ", mScopes=" + mScopes +
363+ ", mParams=" + mParams +
335364 '}' ;
336365 }
337366
338367 public static class Builder {
339368 @ SupportedProvider private String mProviderId ;
340369 private List <String > mScopes = new ArrayList <>();
370+ private Bundle mParams = new Bundle ();
341371
342372 /**
343373 * Builds the configuration parameters for an identity provider.
@@ -372,8 +402,13 @@ public Builder setPermissions(List<String> permissions) {
372402 return this ;
373403 }
374404
405+ public Builder setParams (Bundle params ) {
406+ mParams = params ;
407+ return this ;
408+ }
409+
375410 public IdpConfig build () {
376- return new IdpConfig (mProviderId , mScopes );
411+ return new IdpConfig (mProviderId , mScopes , mParams );
377412 }
378413 }
379414 }
@@ -448,8 +483,8 @@ public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) {
448483 for (IdpConfig config : idpConfigs ) {
449484 if (mProviders .contains (config )) {
450485 throw new IllegalArgumentException ("Each provider can only be set once. "
451- + config .getProviderId ()
452- + " was set twice." );
486+ + config .getProviderId ()
487+ + " was set twice." );
453488 } else {
454489 mProviders .add (config );
455490 }
0 commit comments