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

Class AppCheck

packages/firebase-app-check-debug/index.android.ts:50–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50export class AppCheck implements IAppCheck {
51 _native: com.google.firebase.appcheck.FirebaseAppCheck;
52 _nativeApp;
53 constructor(app?: FirebaseApp) {
54 if (app?.native) {
55 this._nativeApp = app.native;
56 this._native = com.google.firebase.appcheck.FirebaseAppCheck.getInstance(app.native);
57 } else {
58 if (defaultAppCheck) {
59 return defaultAppCheck;
60 }
61 defaultAppCheck = this;
62 this._nativeApp = (<any>com).google.firebase.FirebaseApp.getInstance();
63 this._native = com.google.firebase.appcheck.FirebaseAppCheck.getInstance();
64 }
65 }
66 static setProviderFactory() {}
67
68 activate(isTokenAutoRefreshEnabled: boolean) {
69 this.native.installAppCheckProviderFactory(com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory.getInstance(), isTokenAutoRefreshEnabled);
70 }
71
72 getToken(forceRefresh: boolean): Promise<AppCheckToken> {
73 return new Promise((resolve, reject) => {
74 NSAppCheck().getToken(
75 this.native,
76 forceRefresh,
77 new org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback({
78 onSuccess(param0) {
79 resolve(AppCheckToken.fromNative(param0));
80 },
81 onError(param0) {
82 const err = FirebaseError.fromNative(param0);
83 reject(err);
84 },
85 })
86 );
87 });
88 }
89 setTokenAutoRefreshEnabled(enabled: boolean) {
90 this.native.setTokenAutoRefreshEnabled(enabled);
91 }
92 get native() {
93 return this._native;
94 }
95 get ios() {
96 return this.native;
97 }
98 _app: FirebaseApp;
99 get app(): FirebaseApp {
100 if (!this._app) {
101 // @ts-ignore
102 this._app = FirebaseApp.fromNative(this._nativeApp);
103 }
104 return this._app;
105 }
106}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…