javascript/utils/googleyolo.js
function() {
      // UI initialized, it is OK to cancel last operation.
      self.initialized_ = true;
      // retrieve is only called if auto sign-in is enabled. Otherwise, it will
      // get skipped.
      var retrieveCredential = Promise.resolve(null);
      if (!autoSignInDisabled) {
        retrieveCredential =
            self.googleyolo_.retrieve(
                /** @type {!SmartLockRequestOptions} */ (config))
                .catch(function(error) {
                  // For user cancellation or concurrent request pass down.
                  // Otherwise suppress and run hint.
                  if (error.type ===
                      firebaseui.auth.GoogleYolo.Error.USER_CANCELED ||
                      error.type ===
                      firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) {
                    throw error;
                  }
                  // Ignore all other errors to give hint a chance to run next.
                  return null;
                });
      }
      // Check if a credential is already available (previously signed in with).
      return retrieveCredential
          .then(function(credential) {
            if (!credential) {
              // Auto sign-in not complete.
              // Show account selector.
              return self.googleyolo_.hint(
                  /** @type {!SmartLockHintOptions} */ (config));
            }
            // Credential already available from the retrieve call. Pass it
            // through.
            return credential;
          })
          .catch(function(error) {
            // When user cancels the flow, reset the lastCancel promise and
            // resolve with false.
            if (error.type === firebaseui.auth.GoogleYolo.Error.USER_CANCELED) {
              self.lastCancel_ = Promise.resolve();
            } else if (error.type ===
                       firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) {
              // Only one UI can be rendered at a time, cancel existing UI
              // and try again.
              self.cancel();
              return self.show(config, autoSignInDisabled);
            }
            // Return null as no credential is available.
            return null;
          });
    }
function() {
      // UI initialized, it is OK to cancel last operation.
      self.initialized_ = true;
      // retrieve is only called if auto sign-in is enabled. Otherwise, it will
      // get skipped.
      var retrieveCredential = Promise.resolve(null);
      if (!autoSignInDisabled) {
        retrieveCredential =
            self.googleyolo_.retrieve(
                /** @type {!SmartLockRequestOptions} */ (config))
                .catch(function(error) {
                  // For user cancellation or concurrent request pass down.
                  // Otherwise suppress and run hint.
                  if (error.type ===
                      firebaseui.auth.GoogleYolo.Error.USER_CANCELED ||
                      error.type ===
                      firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) {
                    throw error;
                  }
                  // Ignore all other errors to give hint a chance to run next.
                  return null;
                });
      }
      // Check if a credential is already available (previously signed in with).
      return retrieveCredential
          .then(function(credential) {
            if (!credential) {
              // Auto sign-in not complete.
              // Show account selector.
              return self.googleyolo_.hint(
                  /** @type {!SmartLockHintOptions} */ (config));
            }
            // Credential already available from the retrieve call. Pass it
            // through.
            return credential;
          })
          .catch(function(error) {
            // When user cancels the flow, reset the lastCancel promise and
            // resolve with false.
            if (error.type === firebaseui.auth.GoogleYolo.Error.USER_CANCELED) {
              self.lastCancel_ = Promise.resolve();
            } else if (error.type ===
                       firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) {
              // Only one UI can be rendered at a time, cancel existing UI
              // and try again.
              self.cancel();
              return self.show(config, autoSignInDisabled);
            }
            // Return null as no credential is available.
            return null;
          });
    }
function ( ) { // UI initialized, it is OK to cancel last operation. self . initialized_ = true ; // retrieve is only called if auto sign-in is enabled. Otherwise, it will // get skipped. var retrieveCredential = Promise . resolve ( null ) ; if ( ! autoSignInDisabled ) { retrieveCredential = self . googleyolo_ . retrieve ( /** @type {!SmartLockRequestOptions} */ ( config ) ) . catch ( function ( error ) { // For user cancellation or concurrent request pass down. // Otherwise suppress and run hint. if ( error . type === firebaseui . auth . GoogleYolo . Error . USER_CANCELED || error . type === firebaseui . auth . GoogleYolo . Error . CONCURRENT_REQUEST ) { throw error ; } // Ignore all other errors to give hint a chance to run next. return null ; } ) ; } // Check if a credential is already available (previously signed in with). return retrieveCredential . then ( function ( credential ) { if ( ! credential ) { // Auto sign-in not complete. // Show account selector. return self . googleyolo_ . hint ( /** @type {!SmartLockHintOptions} */ ( config ) ) ; } // Credential already available from the retrieve call. Pass it // through. return credential ; } ) . catch ( function ( error ) { // When user cancels the flow, reset the lastCancel promise and // resolve with false. if ( error . type === firebaseui . auth . GoogleYolo . Error . USER_CANCELED ) { self . lastCancel_ = Promise . resolve ( ) ; } else if ( error . type === firebaseui . auth . GoogleYolo . Error . CONCURRENT_REQUEST ) { // Only one UI can be rendered at a time, cancel existing UI // and try again. self . cancel ( ) ; return self . show ( config , autoSignInDisabled ) ; } // Return null as no credential is available. return null ; } ) ; }
One-Tap UI renderer.
One - Tap UI renderer .