| 475 | } |
| 476 | |
| 477 | export class UI implements IUI { |
| 478 | _native: FUIAuth; |
| 479 | _auth: Auth; |
| 480 | _app: FirebaseApp; |
| 481 | _delegate: FUIAuthDelegateImpl; |
| 482 | _controller; |
| 483 | _resolve; |
| 484 | _reject; |
| 485 | |
| 486 | constructor(auth?: Auth) { |
| 487 | const native = (auth as any)?.native; |
| 488 | if (native) { |
| 489 | this._native = FUIAuth.authUIWithAuth(native); |
| 490 | this._auth = auth; |
| 491 | } else { |
| 492 | if (defaultUI) { |
| 493 | return defaultUI; |
| 494 | } |
| 495 | defaultUI = this; |
| 496 | this._native = FUIAuth.defaultAuthUI(); |
| 497 | } |
| 498 | |
| 499 | this._delegate = FUIAuthDelegateImpl.initWithOwner(new WeakRef(this)); |
| 500 | this._native.delegate = this._delegate; |
| 501 | } |
| 502 | |
| 503 | static fromNative(ui: FUIAuth) { |
| 504 | if (ui instanceof FUIAuth) { |
| 505 | const ret = new UI(); |
| 506 | ret._native = ui; |
| 507 | return ret; |
| 508 | } |
| 509 | return null; |
| 510 | } |
| 511 | |
| 512 | get native() { |
| 513 | return this._native; |
| 514 | } |
| 515 | |
| 516 | get android() { |
| 517 | return this.native; |
| 518 | } |
| 519 | |
| 520 | get app(): FirebaseApp { |
| 521 | if (this._auth) { |
| 522 | return this._auth.app; |
| 523 | } |
| 524 | if (!this._app) { |
| 525 | // @ts-ignore |
| 526 | this._app = FirebaseApp.fromNative(this.native.getApp()); |
| 527 | } |
| 528 | return this._app; |
| 529 | } |
| 530 | |
| 531 | useEmulator(host: string, port: number) { |
| 532 | this.native.useEmulatorWithHostPort(host, port); |
| 533 | } |
| 534 |
nothing calls this directly
no outgoing calls
no test coverage detected