Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Optional() @Inject(ANALYTICS_COLLECTION_ENABLED) analyticsCollectionEnabled:boolean|null,
zone: NgZone
) {
const analytics = of(undefined).pipe(
// @ts-ignore zapping in the UMD in the build script
switchMap(() => zone.runOutsideAngular(() => import('firebase/analytics'))),
map(() => _firebaseAppFactory(options, zone, nameOrConfig)),
map(app => app.analytics()),
tap(analytics => {
if (analyticsCollectionEnabled === false) { analytics.setAnalyticsCollectionEnabled(false) }
}),
runOutsideAngular(zone),
shareReplay(1)
);
return _lazySDKProxy(this, analytics, zone);
}
const defaultToStartWith = Object.keys(defaultConfig || {}).reduce((c, k) => {
c[k] = new Value("default", defaultConfig![k].toString());
return c;
}, {} as {[key:string]: remoteConfig.Value});
const mapRemoteConfig = (rc: {[key:string]: Value | remoteConfig.Value}) => {
const keys = Object.keys(rc);
return keys.reduce((c, key, index) => {
const value = rc[key];
c[index] = new KeyedValue(key, value.getSource(), value.asString());
return c;
}, new Array(keys.length));
}
const proxy: AngularFireRemoteConfig = _lazySDKProxy(this, remoteConfig, zone);
this.default$ = of(defaultToStartWith);
const existing = of(undefined).pipe(
switchMap(() => proxy.activate()),
switchMap(() => proxy.getAll())
);
let fresh = of(undefined).pipe(
switchMap(() => proxy.fetchAndActivate()),
switchMap(() => proxy.getAll())
);
this.values = new Proxy(concat(this.default$, existing, fresh), {
get: (self, name:string) => self[name] || self.pipe(
map(rc => rc[name] ? rc[name] : undefined),