Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 35 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Injectable } from "@angular/core"; |
||
2 | import { AngularFireAuth } from "@angular/fire/auth"; |
||
3 | import { Platform } from "@ionic/angular"; |
||
4 | import { auth } from "firebase/app"; |
||
5 | import { UniFirebaseLoginConfigProvider } from "../../config/uni-firebase-login-config-provider"; |
||
6 | import { AbstractAuth } from "../../providers/abstract-auth"; |
||
7 | import { IAuthProvider } from "../../providers/i-auth-provider"; |
||
8 | import { IAnonymousAuthOptions } from "./i-anonymous-auth-options"; |
||
9 | |||
10 | @Injectable() |
||
11 | export class AnonymousAuth extends AbstractAuth implements IAuthProvider { |
||
12 | public readonly providerKey = "anonymous"; |
||
13 | public readonly defaultOptions: IAnonymousAuthOptions = {}; |
||
14 | |||
15 | public constructor( |
||
16 | angularFireAuth: AngularFireAuth, |
||
17 | platform: Platform, |
||
18 | config: UniFirebaseLoginConfigProvider, |
||
19 | ) { |
||
20 | super(angularFireAuth, platform, config); |
||
21 | } |
||
22 | |||
23 | public async signInNative(options: any): Promise<auth.UserCredential> { |
||
24 | return this.signInBrowser(); |
||
25 | } |
||
26 | |||
27 | public async signInBrowser(): Promise<auth.UserCredential> { |
||
28 | return await auth().signInAnonymously(); |
||
29 | } |
||
30 | |||
31 | protected getBrowserSignInProvider(): null { |
||
32 | return null; |
||
33 | } |
||
34 | } |
||
35 |