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

Class RemoteConfig

packages/firebase-remote-config/index.android.ts:128–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126 }
127}
128export class RemoteConfig implements IRemoteConfig {
129 _native: com.google.firebase.remoteconfig.FirebaseRemoteConfig;
130 _app: FirebaseApp;
131 constructor(app?: FirebaseApp) {
132 if (app?.native) {
133 this._native = com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(app.native);
134 } else {
135 if (defaultRemoteConfig) {
136 return defaultRemoteConfig;
137 }
138 defaultRemoteConfig = this;
139 this._native = com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance();
140 }
141 }
142
143 get native() {
144 return this._native;
145 }
146 get android() {
147 return this.native;
148 }
149
150 get app(): FirebaseApp {
151 if (!this._app) {
152 // @ts-ignore
153 this._app = FirebaseApp.fromNative(this.native.app);
154 }
155 return this._app;
156 }
157
158 get fetchTimeMillis(): number {
159 return this.native.getInfo().getFetchTimeMillis?.() * 1000;
160 }
161 get lastFetchStatus(): 'success' | 'failure' | 'no_fetch_yet' | 'throttled' {
162 switch (this.native.getInfo().getLastFetchStatus()) {
163 case FetchStatusFailure():
164 return 'failure';
165 case FetchStatusSuccess():
166 return 'success';
167 case FetchStatusNoFetchYet():
168 return 'no_fetch_yet';
169 case FetchStatusThrottled():
170 return 'throttled';
171 }
172 }
173
174 get settings() {
175 return ConfigSettings.fromNative(this.native.getInfo().getConfigSettings());
176 }
177
178 set settings(value: ConfigSettings) {
179 this.native.setConfigSettingsAsync(value.native);
180 }
181
182 activate(): Promise<boolean> {
183 return new Promise((resolve, reject) => {
184 NSRemoteConfig().activate(
185 this.native,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected