MCPcopy Index your code
hub / github.com/NativeScript/firebase / AppCheck

Class AppCheck

packages/firebase-app-check/index.android.ts:104–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103let customProvider: AppCheckProviderFactory;
104export class AppCheck implements IAppCheck {
105 _native: com.google.firebase.appcheck.FirebaseAppCheck;
106 _nativeApp;
107 constructor(app?: FirebaseApp) {
108 if (app?.native) {
109 this._nativeApp = app.native;
110 this._native = com.google.firebase.appcheck.FirebaseAppCheck.getInstance(app.native);
111 } else {
112 if (defaultAppCheck) {
113 return defaultAppCheck;
114 }
115 defaultAppCheck = this;
116 this._nativeApp = (<any>com).google.firebase.FirebaseApp.getInstance();
117 this._native = com.google.firebase.appcheck.FirebaseAppCheck.getInstance();
118 }
119 }
120 static setProviderFactory(custom?: AppCheckProviderFactory) {
121 if (custom && custom instanceof AppCheckProviderFactory) {
122 customProvider = custom;
123 } else {
124 customProvider = undefined;
125 }
126 }
127
128 activate(isTokenAutoRefreshEnabled: boolean) {
129 this.native.setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled);
130 if (customProvider) {
131 this.native.installAppCheckProviderFactory(customProvider.native);
132 } else {
133 this.native.installAppCheckProviderFactory(com.google.firebase.appcheck.playintegrity.PlayIntegrityAppCheckProviderFactory.getInstance());
134 }
135 }
136
137 getToken(forceRefresh: boolean): Promise<AppCheckToken> {
138 return new Promise((resolve, reject) => {
139 NSAppCheck().getToken(
140 this.native,
141 forceRefresh,
142 new org.nativescript.firebase.app_check.FirebaseAppCheck.Callback({
143 onSuccess(param0) {
144 resolve(AppCheckToken.fromNative(param0));
145 },
146 onError(param0) {
147 const err = FirebaseError.fromNative(param0);
148 reject(err);
149 },
150 })
151 );
152 });
153 }
154 setTokenAutoRefreshEnabled(enabled: boolean) {
155 this.native.setTokenAutoRefreshEnabled(enabled);
156 }
157 get native() {
158 return this._native;
159 }
160 get ios() {
161 return this.native;

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…