Passed
Push — master ( 0543ef...cf6673 )
by Miloš
02:59
created

src/modules/anonymous/anonymous-auth.ts   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 30
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 23
mnd 0
bc 0
fnc 3
dl 0
loc 30
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A AnonymousAuth.handleBrowserLogin 0 3 1
A AnonymousAuth.getBrowserLoginProvider 0 3 1
A AnonymousAuth.handleNativeLogin 0 3 1
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 { AbstractAuth } from "../../providers/abstract-auth";
6
import { IAuthProvider } from "../../providers/i-auth-provider";
7
8
@Injectable({
9
    providedIn: "root",
10
})
11
export class AnonymousAuth extends AbstractAuth implements IAuthProvider {
12
    public readonly providerOptions = {};
13
14
    public constructor(angularFireAuth: AngularFireAuth, platform: Platform) {
15
        super(angularFireAuth, platform);
16
    }
17
18
    public async handleNativeLogin(options: any): Promise<auth.UserCredential> {
19
        return this.handleBrowserLogin();
20
    }
21
22
    public async handleBrowserLogin(): Promise<auth.UserCredential> {
23
        return await auth().signInAnonymously();
24
    }
25
26
    protected getBrowserLoginProvider(): null {
27
        return null;
28
    }
29
}
30