1919
2020import android .content .Context ;
2121import android .net .Uri ;
22+ import android .os .Bundle ;
2223import android .util .Patterns ;
2324
2425import com .amazonaws .mobileconnectors .cognitoauth .exceptions .AuthInvalidParameterException ;
@@ -59,6 +60,11 @@ public final class Auth {
5960 */
6061 private final String idpIdentifier ;
6162
63+ /**
64+ * Bundle containing customization flags for chrome custom tab
65+ */
66+ private final Bundle customTabExtras ;
67+
6268 /**
6369 * This identifies the settings for additional userPool features.
6470 */
@@ -143,7 +149,8 @@ private Auth(final Context context,
143149 final AuthHandler userHandler ,
144150 final boolean advancedSecurityDataCollectionFlag ,
145151 final String identityProvider ,
146- final String idpIdentifier ) {
152+ final String idpIdentifier ,
153+ final Bundle customTabExtras ) {
147154 this .context = context ;
148155 this .appWebDomain = appWebDomain ;
149156 this .appId = appId ;
@@ -158,6 +165,7 @@ private Auth(final Context context,
158165 this .advancedSecurityDataCollectionFlag = advancedSecurityDataCollectionFlag ;
159166 this .identityProvider = identityProvider ;
160167 this .idpIdentifier = idpIdentifier ;
168+ this .customTabExtras = customTabExtras ;
161169 getCurrentUser ();
162170 }
163171
@@ -222,6 +230,11 @@ public static final class Builder {
222230 */
223231 private String mIdpIdentifier ;
224232
233+ /**
234+ * Bundle of flags to customize chrome custom tab UI
235+ */
236+ private Bundle mCustomTabsExtras ;
237+
225238 /**
226239 * Flag indicating if data collection for advanced security mode is enabled.
227240 * By default this is enabled.
@@ -400,6 +413,20 @@ public Builder setIdpIdentifier(final String mIdpIdentifier) {
400413 return this ;
401414 }
402415
416+ /**
417+ * Sets customization bundle. This allow to customize chrome custom tab.
418+ * <p>
419+ * Optional. Set a bundle to customize UI
420+ * </p>
421+ * @param mCustomTabsExtras Optional: Pass to chrome custom tab a bundle of customization flags
422+ * @return A reference to this builder.
423+ */
424+ @ SuppressWarnings ("checkstyle:hiddenfield" )
425+ public Builder setCustomTabsExtras (final Bundle mCustomTabsExtras ) {
426+ this .mCustomTabsExtras = mCustomTabsExtras ;
427+ return this ;
428+ }
429+
403430 /**
404431 * Instantiates {@link Auth} with the set options.
405432 * @return {@link Auth}.
@@ -417,7 +444,8 @@ public Auth build() {
417444 this .mUserHandler ,
418445 this .mAdvancedSecurityDataCollectionFlag ,
419446 this .mIdentityProvider ,
420- this .mIdpIdentifier );
447+ this .mIdpIdentifier ,
448+ this .mCustomTabsExtras );
421449 }
422450
423451
@@ -559,6 +587,13 @@ public String getIdpIdentifier() {
559587 return idpIdentifier ;
560588 }
561589
590+ /**
591+ * @return Extra customization bundle for this {@link Auth} instance.
592+ */
593+ public Bundle getCustomTabExtras () {
594+ return customTabExtras ;
595+ }
596+
562597 /**
563598 * Use this method to get tokens for a user, the tokens are returned though the callback.
564599 * {@link AuthHandler#onSuccess(AuthUserSession)}.
0 commit comments