@@ -109,7 +109,6 @@ public final class AuthUI {
109109 public static final String YAHOO_PROVIDER = "yahoo.com" ;
110110 public static final String APPLE_PROVIDER = "apple.com" ;
111111
112-
113112 /**
114113 * Default value for logo resource, omits the logo from the {@link AuthMethodPickerActivity}.
115114 */
@@ -161,6 +160,9 @@ public final class AuthUI {
161160 private final FirebaseApp mApp ;
162161 private final FirebaseAuth mAuth ;
163162
163+ private String mEmulatorHost = null ;
164+ private int mEmulatorPort = -1 ;
165+
164166 private AuthUI (FirebaseApp app ) {
165167 mApp = app ;
166168 mAuth = FirebaseAuth .getInstance (mApp );
@@ -196,6 +198,16 @@ public static AuthUI getInstance() {
196198 return getInstance (FirebaseApp .getInstance ());
197199 }
198200
201+ /**
202+ * Retrieves the {@link AuthUI} instance associated the the specified app name.
203+ *
204+ * @throws IllegalStateException if the app is not initialized.
205+ */
206+ @ NonNull
207+ public static AuthUI getInstance (@ NonNull String appName ) {
208+ return getInstance (FirebaseApp .getInstance (appName ));
209+ }
210+
199211 /**
200212 * Retrieves the {@link AuthUI} instance associated the the specified app.
201213 */
@@ -223,6 +235,18 @@ public static AuthUI getInstance(@NonNull FirebaseApp app) {
223235 return authUi ;
224236 }
225237
238+ @ NonNull
239+ @ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
240+ public FirebaseApp getApp () {
241+ return mApp ;
242+ }
243+
244+ @ NonNull
245+ @ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
246+ public FirebaseAuth getAuth () {
247+ return mAuth ;
248+ }
249+
226250 /**
227251 * Returns true if AuthUI can handle the intent.
228252 * <p>
@@ -460,6 +484,34 @@ public Task<Void> then(@NonNull Task<Void> task) {
460484 });
461485 }
462486
487+ /**
488+ * Connect to the Firebase Authentication emulator.
489+ * @see FirebaseAuth#useEmulator(String, int)
490+ */
491+ public void useEmulator (@ NonNull String host , int port ) {
492+ Preconditions .checkArgument (port >= 0 , "Port must be >= 0" );
493+ Preconditions .checkArgument (port <= 65535 , "Port must be <= 65535" );
494+ mEmulatorHost = host ;
495+ mEmulatorPort = port ;
496+
497+ mAuth .useEmulator (host , port );
498+ }
499+
500+ @ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
501+ public boolean isUseEmulator () {
502+ return mEmulatorHost != null && mEmulatorPort >= 0 ;
503+ }
504+
505+ @ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
506+ public String getEmulatorHost () {
507+ return mEmulatorHost ;
508+ }
509+
510+ @ RestrictTo (RestrictTo .Scope .LIBRARY_GROUP )
511+ public int getEmulatorPort () {
512+ return mEmulatorPort ;
513+ }
514+
463515 private Task <Void > signOutIdps (@ NonNull Context context ) {
464516 if (ProviderAvailability .IS_FACEBOOK_AVAILABLE ) {
465517 LoginManager .getInstance ().logOut ();
@@ -1160,9 +1212,9 @@ public YahooBuilder() {
11601212 */
11611213 public static class GenericOAuthProviderBuilder extends Builder {
11621214
1163- GenericOAuthProviderBuilder (@ NonNull String providerId ,
1164- @ NonNull String providerName ,
1165- int buttonId ) {
1215+ public GenericOAuthProviderBuilder (@ NonNull String providerId ,
1216+ @ NonNull String providerName ,
1217+ int buttonId ) {
11661218 super (providerId );
11671219
11681220 Preconditions .checkNotNull (providerId , "The provider ID cannot be null." );
0 commit comments