Skip to content

[Feature Request] add 'disableWarnings' option to emulators #2724

Closed
@geromegrignon

Description

@geromegrignon

Version info

Angular:
11.0.5

Firebase:
8.0

AngularFire:
6.1.4

Other (e.g. Ionic/Cordova, Node, browser, operating system):

Description

When using the emulators tokens (https://github.com/angular/angularfire/blob/master/docs/emulators/emulators.md), it uses the useEmulator(url) firebase-js-jdk function under the hood.
But it miss the disableWarnings option is stated here : https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/auth.js

/**
 * Sets the emulator configuration (go/firebase-emulator-connection-api).
 * @param {string} url The url for the Auth emulator.
 * @param {?Object=} options Optional options to specify emulator settings.
 */
fireauth.Auth.prototype.useEmulator = function(url, options) {
  // Emulator config can only be set once.
  if (!this.emulatorConfig_) {
    if (!/^https?:\/\//.test(url)) {
      throw new fireauth.AuthError(
          fireauth.authenum.Error.ARGUMENT_ERROR,
          'Emulator URL must start with a valid scheme (http:// or https://).');
    }
    // Emit a warning so dev knows we are now in test mode.
    const disableBanner = options ? !!options['disableWarnings'] : false;
    this.emitEmulatorWarning_(disableBanner);
    // Persist the config.
    this.emulatorConfig_ = { url };
    // Disable app verification.
    this.settings_().setAppVerificationDisabledForTesting(true);
    // Update RPC handler endpoints.
    this.rpcHandler_.updateEmulatorConfig(this.emulatorConfig_);
    // Notify external event listeners.
    this.notifyEmulatorConfigListeners_();
  }
}

This option allows to hide the bottom banner :
image

How to reproduce these conditions

Steps to set up and reproduce

  • create an angular project with ng new myProject
  • install firebase tools with npm install -g firebase-tools
  • run firebase init to initialize a firebase project with at least one feature
  • run firebase init and choose 'emulators' to setup the emulators for the previous chosen features
  • add the angular-fire tokens to the providers array of the AppModule
  • run ng serve

The banner should be visible.

Expected behavior

The token should be improved by adding the disableWarnings option

Actual behavior

The banner is always visible and can hide content.

Proposal

I can create a PR if you approve this change (it'll be applied to each token).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions