MCPcopy Create free account
hub / github.com/NativeScript/firebase / Installations

Class Installations

packages/firebase-installations/index.ios.ts:18–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 writable: false,
17});
18export class Installations implements IInstallations {
19 _native: FIRInstallations;
20 _app: FirebaseApp;
21 constructor(app?: FirebaseApp) {
22 if (app?.native) {
23 this._native = FIRInstallations.installationsWithApp(app.native);
24 } else {
25 if (defaultInstallations) {
26 return defaultInstallations;
27 }
28 defaultInstallations = this;
29 this._native = FIRInstallations.installations();
30 }
31 }
32 delete(): Promise<void> {
33 return new Promise((resolve, reject) => {
34 this.native.deleteWithCompletion((error) => {
35 if (error) {
36 reject(FirebaseError.fromNative(error));
37 } else {
38 resolve();
39 }
40 });
41 });
42 }
43 getId(): Promise<string> {
44 return new Promise((resolve, reject) => {
45 this.native.installationIDWithCompletion((id, error) => {
46 if (error) {
47 reject(FirebaseError.fromNative(error));
48 } else {
49 resolve(id);
50 }
51 });
52 });
53 }
54 getToken(forceRefresh: boolean = false): Promise<string> {
55 return new Promise((resolve, reject) => {
56 this.native.authTokenForcingRefreshCompletion(forceRefresh, (result, error) => {
57 if (error) {
58 reject(FirebaseError.fromNative(error));
59 } else {
60 resolve(result.authToken);
61 }
62 });
63 });
64 }
65
66 get native() {
67 return this._native;
68 }
69 get ios() {
70 return this.native;
71 }
72
73 get app(): FirebaseApp {
74 if (!this._app) {
75 // @ts-ignore

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected