constructor()

in src/auth/action-code-settings-builder.ts [134:220]


  constructor(actionCodeSettings: ActionCodeSettings) {
    if (!validator.isNonNullObject(actionCodeSettings)) {
      throw new FirebaseAuthError(
        AuthClientErrorCode.INVALID_ARGUMENT,
        '"ActionCodeSettings" must be a non-null object.',
      );
    }
    if (typeof actionCodeSettings.url === 'undefined') {
      throw new FirebaseAuthError(
        AuthClientErrorCode.MISSING_CONTINUE_URI,
      );
    } else if (!validator.isURL(actionCodeSettings.url)) {
      throw new FirebaseAuthError(
        AuthClientErrorCode.INVALID_CONTINUE_URI,
      );
    }
    this.continueUrl = actionCodeSettings.url;

    if (typeof actionCodeSettings.handleCodeInApp !== 'undefined' &&
      !validator.isBoolean(actionCodeSettings.handleCodeInApp)) {
      throw new FirebaseAuthError(
        AuthClientErrorCode.INVALID_ARGUMENT,
        '"ActionCodeSettings.handleCodeInApp" must be a boolean.',
      );
    }
    this.canHandleCodeInApp = actionCodeSettings.handleCodeInApp || false;

    if (typeof actionCodeSettings.dynamicLinkDomain !== 'undefined' &&
      !validator.isNonEmptyString(actionCodeSettings.dynamicLinkDomain)) {
      throw new FirebaseAuthError(
        AuthClientErrorCode.INVALID_DYNAMIC_LINK_DOMAIN,
      );
    }
    this.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;

    if (typeof actionCodeSettings.iOS !== 'undefined') {
      if (!validator.isNonNullObject(actionCodeSettings.iOS)) {
        throw new FirebaseAuthError(
          AuthClientErrorCode.INVALID_ARGUMENT,
          '"ActionCodeSettings.iOS" must be a valid non-null object.',
        );
      } else if (typeof actionCodeSettings.iOS.bundleId === 'undefined') {
        throw new FirebaseAuthError(
          AuthClientErrorCode.MISSING_IOS_BUNDLE_ID,
        );
      } else if (!validator.isNonEmptyString(actionCodeSettings.iOS.bundleId)) {
        throw new FirebaseAuthError(
          AuthClientErrorCode.INVALID_ARGUMENT,
          '"ActionCodeSettings.iOS.bundleId" must be a valid non-empty string.',
        );
      }
      this.ibi = actionCodeSettings.iOS.bundleId;
    }

    if (typeof actionCodeSettings.android !== 'undefined') {
      if (!validator.isNonNullObject(actionCodeSettings.android)) {
        throw new FirebaseAuthError(
          AuthClientErrorCode.INVALID_ARGUMENT,
          '"ActionCodeSettings.android" must be a valid non-null object.',
        );
      } else if (typeof actionCodeSettings.android.packageName === 'undefined') {
        throw new FirebaseAuthError(
          AuthClientErrorCode.MISSING_ANDROID_PACKAGE_NAME,
        );
      } else if (!validator.isNonEmptyString(actionCodeSettings.android.packageName)) {
        throw new FirebaseAuthError(
          AuthClientErrorCode.INVALID_ARGUMENT,
          '"ActionCodeSettings.android.packageName" must be a valid non-empty string.',
        );
      } else if (typeof actionCodeSettings.android.minimumVersion !== 'undefined' &&
        !validator.isNonEmptyString(actionCodeSettings.android.minimumVersion)) {
        throw new FirebaseAuthError(
          AuthClientErrorCode.INVALID_ARGUMENT,
          '"ActionCodeSettings.android.minimumVersion" must be a valid non-empty string.',
        );
      } else if (typeof actionCodeSettings.android.installApp !== 'undefined' &&
        !validator.isBoolean(actionCodeSettings.android.installApp)) {
        throw new FirebaseAuthError(
          AuthClientErrorCode.INVALID_ARGUMENT,
          '"ActionCodeSettings.android.installApp" must be a valid boolean.',
        );
      }
      this.apn = actionCodeSettings.android.packageName;
      this.amv = actionCodeSettings.android.minimumVersion;
      this.installApp = actionCodeSettings.android.installApp || false;
    }
  }