diff --git a/package-lock.json b/package-lock.json index 19faac8b0..bff0924b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "jsonc-parser": "^3.0.0", "open": "^7.0.3 || ^8.0.0", "ora": "^5.3.0", - "rxfire": "^6.0.5", + "rxfire": "^6.1.0", "rxjs": "~7.8.0", "semver": "^7.1.3", "triple-beam": "^1.3.0", @@ -19381,11 +19381,12 @@ } }, "node_modules/rxfire": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/rxfire/-/rxfire-6.0.5.tgz", - "integrity": "sha512-ycBsANGbya3GNtOBKzZVATLEV+0S9gUrlTfwnN15TCXtgG8OgIMAuv2k9+kMeVaevp/DRp1KT+vYf6Wkop6gvw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/rxfire/-/rxfire-6.1.0.tgz", + "integrity": "sha512-NezdjeY32VZcCuGO0bbb8H8seBsJSCaWdUwGsHNzUcAOHR0VGpzgPtzjuuLXr8R/iemkqSzbx/ioS7VwV43ynA==", + "license": "Apache-2.0", "peerDependencies": { - "firebase": "^9.0.0 || ^10.0.0", + "firebase": "^9.0.0 || ^10.0.0 || ^11.0.0", "rxjs": "^6.0.0 || ^7.0.0" } }, diff --git a/package.json b/package.json index c21f796b3..fb6cd7504 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "jsonc-parser": "^3.0.0", "open": "^7.0.3 || ^8.0.0", "ora": "^5.3.0", - "rxfire": "^6.0.5", + "rxfire": "^6.1.0", "rxjs": "~7.8.0", "semver": "^7.1.3", "triple-beam": "^1.3.0", diff --git a/src/analytics/analytics.module.ts b/src/analytics/analytics.module.ts index 52249a40c..f2552ffc5 100644 --- a/src/analytics/analytics.module.ts +++ b/src/analytics/analytics.module.ts @@ -1,11 +1,12 @@ +import { isPlatformBrowser } from '@angular/common'; import { - APP_INITIALIZER, EnvironmentProviders, InjectionToken, Injector, NgModule, NgZone, Optional, + PLATFORM_ID, makeEnvironmentProviders, } from '@angular/core'; import { VERSION, ɵAngularFireSchedulers, ɵgetDefaultInstanceOf } from '@angular/fire'; @@ -13,21 +14,20 @@ import { FirebaseApp, FirebaseApps } from '@angular/fire/app'; import { Analytics as FirebaseAnalytics } from 'firebase/analytics'; import { registerVersion } from 'firebase/app'; import { ANALYTICS_PROVIDER_NAME, Analytics, AnalyticsInstances } from './analytics'; -import { isAnalyticsSupportedFactory } from './is-analytics-supported-factory'; import { ScreenTrackingService } from './screen-tracking.service'; import { UserTrackingService } from './user-tracking.service'; export const PROVIDED_ANALYTICS_INSTANCES = new InjectionToken('angularfire2.analytics-instances'); -export function defaultAnalyticsInstanceFactory(provided: FirebaseAnalytics[]|undefined, defaultApp: FirebaseApp) { - if (!isAnalyticsSupportedFactory.sync()) { return null; } +export function defaultAnalyticsInstanceFactory(provided: FirebaseAnalytics[]|undefined, defaultApp: FirebaseApp, platformId: object) { + if (!isPlatformBrowser(platformId)) { return null; } const defaultAnalytics = ɵgetDefaultInstanceOf(ANALYTICS_PROVIDER_NAME, provided, defaultApp); return defaultAnalytics && new Analytics(defaultAnalytics); } export function analyticsInstanceFactory(fn: (injector: Injector) => FirebaseAnalytics) { - return (zone: NgZone, injector: Injector) => { - if (!isAnalyticsSupportedFactory.sync()) { return null; } + return (zone: NgZone, injector: Injector, platformId: object) => { + if (!isPlatformBrowser(platformId)) { return null; } const analytics = zone.runOutsideAngular(() => fn(injector)); return new Analytics(analytics); }; @@ -46,18 +46,14 @@ const DEFAULT_ANALYTICS_INSTANCE_PROVIDER = { deps: [ [new Optional(), PROVIDED_ANALYTICS_INSTANCES ], FirebaseApp, + PLATFORM_ID, ] }; @NgModule({ providers: [ DEFAULT_ANALYTICS_INSTANCE_PROVIDER, - ANALYTICS_INSTANCES_PROVIDER, - { - provide: APP_INITIALIZER, - useValue: isAnalyticsSupportedFactory.async, - multi: true, - } + ANALYTICS_INSTANCES_PROVIDER ] }) export class AnalyticsModule { @@ -75,11 +71,6 @@ export function provideAnalytics(fn: (injector: Injector) => FirebaseAnalytics, return makeEnvironmentProviders([ DEFAULT_ANALYTICS_INSTANCE_PROVIDER, ANALYTICS_INSTANCES_PROVIDER, - { - provide: APP_INITIALIZER, - useValue: isAnalyticsSupportedFactory.async, - multi: true, - }, { provide: PROVIDED_ANALYTICS_INSTANCES, useFactory: analyticsInstanceFactory(fn), @@ -87,6 +78,7 @@ export function provideAnalytics(fn: (injector: Injector) => FirebaseAnalytics, deps: [ NgZone, Injector, + PLATFORM_ID, ɵAngularFireSchedulers, FirebaseApps, ...deps, diff --git a/src/analytics/analytics.spec.ts b/src/analytics/analytics.spec.ts index 9101059ca..f2f6c8c72 100644 --- a/src/analytics/analytics.spec.ts +++ b/src/analytics/analytics.spec.ts @@ -1,5 +1,5 @@ import { TestBed } from '@angular/core/testing'; -import { Analytics, getAnalytics, isSupported, provideAnalytics } from '@angular/fire/analytics'; +import { Analytics, getAnalytics, provideAnalytics } from '@angular/fire/analytics'; import { FirebaseApp, getApp, initializeApp, provideFirebaseApp } from '@angular/fire/app'; import { COMMON_CONFIG_TOO } from '../test-config'; import { rando } from '../utils'; @@ -10,14 +10,6 @@ describe('Analytics', () => { let providedAnalytics: Analytics; let appName: string; - beforeAll(done => { - // The APP_INITIALIZER that is making isSupported() sync for DI may not - // be done evaulating by the time we inject from the TestBed. We can - // ensure correct behavior by waiting for the (global) isSuppported() promise - // to resolve. - isSupported().then(() => done()); - }); - describe('single injection', () => { beforeEach(() => { diff --git a/src/analytics/firebase.ts b/src/analytics/firebase.ts index 07b5c2ae2..cddd7d83a 100644 --- a/src/analytics/firebase.ts +++ b/src/analytics/firebase.ts @@ -5,6 +5,7 @@ import { getAnalytics as _getAnalytics, getGoogleAnalyticsClientId as _getGoogleAnalyticsClientId, initializeAnalytics as _initializeAnalytics, + isSupported as _isSupported, logEvent as _logEvent, setAnalyticsCollectionEnabled as _setAnalyticsCollectionEnabled, setConsent as _setConsent, @@ -15,13 +16,10 @@ import { settings as _settings } from 'firebase/analytics'; -export { - isSupported -} from './overrides'; - export const getAnalytics = ɵzoneWrap(_getAnalytics, true); export const getGoogleAnalyticsClientId = ɵzoneWrap(_getGoogleAnalyticsClientId, true); export const initializeAnalytics = ɵzoneWrap(_initializeAnalytics, true); +export const isSupported = ɵzoneWrap(_isSupported, true); export const logEvent = ɵzoneWrap(_logEvent, true); export const setAnalyticsCollectionEnabled = ɵzoneWrap(_setAnalyticsCollectionEnabled, true); export const setConsent = ɵzoneWrap(_setConsent, true); diff --git a/src/analytics/is-analytics-supported-factory.ts b/src/analytics/is-analytics-supported-factory.ts deleted file mode 100644 index a6b63e4a9..000000000 --- a/src/analytics/is-analytics-supported-factory.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ɵisSupportedError } from '@angular/fire'; -import { isSupported } from 'firebase/analytics'; - -const isAnalyticsSupportedValueSymbol = '__angularfire_symbol__analyticsIsSupportedValue'; -const isAnalyticsSupportedPromiseSymbol = '__angularfire_symbol__analyticsIsSupported'; - -globalThis[isAnalyticsSupportedPromiseSymbol] ||= isSupported().then(it => - globalThis[isAnalyticsSupportedValueSymbol] = it -).catch(() => - globalThis[isAnalyticsSupportedValueSymbol] = false -); -export const isAnalyticsSupportedFactory = { - async: () => globalThis[isAnalyticsSupportedPromiseSymbol], - sync: () => { - const ret = globalThis[isAnalyticsSupportedValueSymbol]; - if (ret === undefined) { throw new Error(ɵisSupportedError('Analytics')); } - return ret; - } -}; diff --git a/src/analytics/overrides.ts b/src/analytics/overrides.ts deleted file mode 100644 index 08a93a137..000000000 --- a/src/analytics/overrides.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { isAnalyticsSupportedFactory } from './is-analytics-supported-factory'; - -export const isSupported = isAnalyticsSupportedFactory.async; - diff --git a/src/auth/auth.spec.ts b/src/auth/auth.spec.ts index 0af03b37e..015cd06c9 100644 --- a/src/auth/auth.spec.ts +++ b/src/auth/auth.spec.ts @@ -19,7 +19,7 @@ describe('Auth', () => { provideFirebaseApp(() => initializeApp(COMMON_CONFIG, appName)), provideAuth(() => { providedAuth = getAuth(getApp(appName)); - connectAuthEmulator(providedAuth, `http://localhost:${authEmulatorPort}`); + connectAuthEmulator(providedAuth, `http://localhost:${authEmulatorPort}`, { disableWarnings: true }); return providedAuth; }), ], diff --git a/src/compat/analytics/user-tracking.service.ts b/src/compat/analytics/user-tracking.service.ts index ce962d5f4..ea66b2bd1 100644 --- a/src/compat/analytics/user-tracking.service.ts +++ b/src/compat/analytics/user-tracking.service.ts @@ -1,4 +1,4 @@ -import { isPlatformServer } from '@angular/common'; +import { isPlatformBrowser } from '@angular/common'; import { Inject, Injectable, NgZone, OnDestroy, PLATFORM_ID } from '@angular/core'; import { VERSION } from '@angular/fire'; import { AngularFireAuth } from '@angular/fire/compat/auth'; @@ -21,7 +21,7 @@ export class UserTrackingService implements OnDestroy { zone: NgZone, ) { firebase.registerVersion('angularfire', VERSION.full, 'compat-user-tracking'); - if (!isPlatformServer(platformId)) { + if (isPlatformBrowser(platformId)) { let resolveInitialized; this.initialized = zone.runOutsideAngular(() => new Promise(resolve => resolveInitialized = resolve)); this.disposables = [ diff --git a/src/messaging/firebase.ts b/src/messaging/firebase.ts index a26f1fc00..f133679ae 100644 --- a/src/messaging/firebase.ts +++ b/src/messaging/firebase.ts @@ -5,14 +5,12 @@ import { deleteToken as _deleteToken, getMessaging as _getMessaging, getToken as _getToken, + isSupported as _isSupported, onMessage as _onMessage } from 'firebase/messaging'; -export { - isSupported -} from './overrides'; - export const deleteToken = ɵzoneWrap(_deleteToken, true); export const getMessaging = ɵzoneWrap(_getMessaging, true); export const getToken = ɵzoneWrap(_getToken, true); +export const isSupported = ɵzoneWrap(_isSupported, false); export const onMessage = ɵzoneWrap(_onMessage, false); diff --git a/src/messaging/is-messaging-supported-factory.ts b/src/messaging/is-messaging-supported-factory.ts deleted file mode 100644 index 57e5b0f0f..000000000 --- a/src/messaging/is-messaging-supported-factory.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ɵisSupportedError } from '@angular/fire'; -import { isSupported } from 'firebase/messaging'; - -const isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported'; -const isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue'; - -globalThis[isMessagingSupportedPromiseSymbol] ||= isSupported().then(it => - globalThis[isMessagingSupportedValueSymbol] = it -).catch(() => - globalThis[isMessagingSupportedValueSymbol] = false -); - -export const isMessagingSupportedFactory = { - async: () => globalThis[isMessagingSupportedPromiseSymbol], - sync: () => { - const ret = globalThis[isMessagingSupportedValueSymbol]; - if (ret === undefined) { throw new Error(ɵisSupportedError('Messaging')); } - return ret; - } -}; diff --git a/src/messaging/messaging.module.ts b/src/messaging/messaging.module.ts index 619542160..0942e053a 100644 --- a/src/messaging/messaging.module.ts +++ b/src/messaging/messaging.module.ts @@ -1,30 +1,31 @@ +import { isPlatformServer } from '@angular/common'; import { - APP_INITIALIZER, EnvironmentProviders, + EnvironmentProviders, InjectionToken, Injector, NgModule, NgZone, Optional, + PLATFORM_ID, makeEnvironmentProviders, } from '@angular/core'; import { VERSION, ɵAngularFireSchedulers, ɵgetDefaultInstanceOf } from '@angular/fire'; import { FirebaseApp, FirebaseApps } from '@angular/fire/app'; import { registerVersion } from 'firebase/app'; import { Messaging as FirebaseMessaging } from 'firebase/messaging'; -import { isMessagingSupportedFactory } from './is-messaging-supported-factory'; import { MESSAGING_PROVIDER_NAME, Messaging, MessagingInstances } from './messaging'; const PROVIDED_MESSAGING_INSTANCES = new InjectionToken('angularfire2.messaging-instances'); -export function defaultMessagingInstanceFactory(provided: FirebaseMessaging[]|undefined, defaultApp: FirebaseApp) { - if (!isMessagingSupportedFactory.sync()) { return null; } +export function defaultMessagingInstanceFactory(provided: FirebaseMessaging[]|undefined, defaultApp: FirebaseApp, platformId: object) { + if (isPlatformServer(platformId)) { return null; } const defaultMessaging = ɵgetDefaultInstanceOf(MESSAGING_PROVIDER_NAME, provided, defaultApp); return defaultMessaging && new Messaging(defaultMessaging); } export function messagingInstanceFactory(fn: (injector: Injector) => FirebaseMessaging) { - return (zone: NgZone, injector: Injector) => { - if (!isMessagingSupportedFactory.sync()) { return null; } + return (zone: NgZone, injector: Injector, platformId: object) => { + if (isPlatformServer(platformId)) { return null; } const messaging = zone.runOutsideAngular(() => fn(injector)); return new Messaging(messaging); }; @@ -43,6 +44,7 @@ const DEFAULT_MESSAGING_INSTANCE_PROVIDER = { deps: [ [new Optional(), PROVIDED_MESSAGING_INSTANCES ], FirebaseApp, + PLATFORM_ID, ] }; @@ -50,11 +52,6 @@ const DEFAULT_MESSAGING_INSTANCE_PROVIDER = { providers: [ DEFAULT_MESSAGING_INSTANCE_PROVIDER, MESSAGING_INSTANCES_PROVIDER, - { - provide: APP_INITIALIZER, - useValue: isMessagingSupportedFactory.async, - multi: true, - }, ] }) export class MessagingModule { @@ -69,11 +66,6 @@ export function provideMessaging(fn: (injector: Injector) => FirebaseMessaging, return makeEnvironmentProviders([ DEFAULT_MESSAGING_INSTANCE_PROVIDER, MESSAGING_INSTANCES_PROVIDER, - { - provide: APP_INITIALIZER, - useValue: isMessagingSupportedFactory.async, - multi: true, - }, { provide: PROVIDED_MESSAGING_INSTANCES, useFactory: messagingInstanceFactory(fn), @@ -81,6 +73,7 @@ export function provideMessaging(fn: (injector: Injector) => FirebaseMessaging, deps: [ NgZone, Injector, + PLATFORM_ID, ɵAngularFireSchedulers, FirebaseApps, ...deps, diff --git a/src/messaging/messaging.spec.ts b/src/messaging/messaging.spec.ts index e10972630..5a48de626 100644 --- a/src/messaging/messaging.spec.ts +++ b/src/messaging/messaging.spec.ts @@ -9,14 +9,6 @@ describe('Messaging', () => { let providedMessaging: Messaging; let appName: string; - beforeAll(done => { - // The APP_INITIALIZER that is making isSupported() sync for DI may not - // be done evaulating by the time we inject from the TestBed. We can - // ensure correct behavior by waiting for the (global) isSuppported() promise - // to resolve. - isSupported().then(() => done()); - }); - describe('single injection', () => { beforeEach(() => { @@ -33,18 +25,15 @@ describe('Messaging', () => { messaging = TestBed.inject(Messaging); }); - it('should be injectable', done => { - (async () => { - const supported = await isSupported(); - if (supported) { - expect(providedMessaging).toBeTruthy(); - expect(messaging).toEqual(providedMessaging); - } else { - expect(providedMessaging).toBeUndefined(); - expect(messaging).toBeNull(); - } - done(); - })(); + it('should be injectable', async () => { + const supported = await TestBed.runInInjectionContext(isSupported); + if (supported) { + expect(providedMessaging).toBeTruthy(); + expect(messaging).toEqual(providedMessaging); + } else { + expect(providedMessaging).toBeUndefined(); + expect(messaging).toBeNull(); + } }); }); diff --git a/src/messaging/overrides.ts b/src/messaging/overrides.ts deleted file mode 100644 index 79a81fc23..000000000 --- a/src/messaging/overrides.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { isMessagingSupportedFactory } from './is-messaging-supported-factory'; - -export const isSupported = isMessagingSupportedFactory.async; diff --git a/src/package.json b/src/package.json index f52cde98b..6a0840d67 100644 --- a/src/package.json +++ b/src/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "firebase": "^11.0.2", - "rxfire": "^6.0.5", + "rxfire": "^6.1.0", "@angular-devkit/schematics": "^19.0.0", "@schematics/angular": "^19.0.0", "tslib": "^2.3.0" diff --git a/src/remote-config/firebase.ts b/src/remote-config/firebase.ts index c44cb9f41..dd0ba60d6 100644 --- a/src/remote-config/firebase.ts +++ b/src/remote-config/firebase.ts @@ -12,13 +12,10 @@ import { getRemoteConfig as _getRemoteConfig, getString as _getString, getValue as _getValue, + isSupported as _isSupported, setLogLevel as _setLogLevel } from 'firebase/remote-config'; -export { - isSupported -} from './overrides'; - export const activate = ɵzoneWrap(_activate, true); export const ensureInitialized = ɵzoneWrap(_ensureInitialized, true); export const fetchAndActivate = ɵzoneWrap(_fetchAndActivate, true); @@ -29,4 +26,5 @@ export const getNumber = ɵzoneWrap(_getNumber, true); export const getRemoteConfig = ɵzoneWrap(_getRemoteConfig, true); export const getString = ɵzoneWrap(_getString, true); export const getValue = ɵzoneWrap(_getValue, true); +export const isSupported = ɵzoneWrap(_isSupported, true); export const setLogLevel = ɵzoneWrap(_setLogLevel, true); diff --git a/src/remote-config/is-remote-config-supported-factory.ts b/src/remote-config/is-remote-config-supported-factory.ts deleted file mode 100644 index faafd909c..000000000 --- a/src/remote-config/is-remote-config-supported-factory.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ɵisSupportedError } from '@angular/fire'; -import { isSupported } from 'firebase/remote-config'; - -const isRemoteConfigSupportedValueSymbol = '__angularfire_symbol__remoteConfigIsSupportedValue'; -const isRemoteConfigSupportedPromiseSymbol = '__angularfire_symbol__remoteConfigIsSupported'; - -globalThis[isRemoteConfigSupportedPromiseSymbol] ||= isSupported().then(it => - globalThis[isRemoteConfigSupportedValueSymbol] = it -).catch(() => - globalThis[isRemoteConfigSupportedValueSymbol] = false -); - -export const isRemoteConfigSupportedFactory = { - async: () => globalThis[isRemoteConfigSupportedPromiseSymbol], - sync: () => { - const ret = globalThis[isRemoteConfigSupportedValueSymbol]; - if (ret === undefined) { throw new Error(ɵisSupportedError('RemoteConfig')); } - return ret; - } -}; diff --git a/src/remote-config/overrides.ts b/src/remote-config/overrides.ts deleted file mode 100644 index d5e0b6e16..000000000 --- a/src/remote-config/overrides.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { isRemoteConfigSupportedFactory } from './is-remote-config-supported-factory'; - -export const isSupported = isRemoteConfigSupportedFactory.async; diff --git a/src/remote-config/remote-config.module.ts b/src/remote-config/remote-config.module.ts index d4b5514cb..866b505e0 100644 --- a/src/remote-config/remote-config.module.ts +++ b/src/remote-config/remote-config.module.ts @@ -1,18 +1,18 @@ +import { isPlatformServer } from '@angular/common'; import { - APP_INITIALIZER, EnvironmentProviders, InjectionToken, Injector, NgModule, NgZone, Optional, + PLATFORM_ID, makeEnvironmentProviders, } from '@angular/core'; import { VERSION, ɵAngularFireSchedulers, ɵgetDefaultInstanceOf } from '@angular/fire'; import { FirebaseApp, FirebaseApps } from '@angular/fire/app'; import { registerVersion } from 'firebase/app'; import { RemoteConfig as FirebaseRemoteConfig } from 'firebase/remote-config'; -import { isRemoteConfigSupportedFactory } from './is-remote-config-supported-factory'; import { REMOTE_CONFIG_PROVIDER_NAME, RemoteConfig, RemoteConfigInstances } from './remote-config'; export const PROVIDED_REMOTE_CONFIG_INSTANCES = new InjectionToken('angularfire2.remote-config-instances'); @@ -20,15 +20,16 @@ export const PROVIDED_REMOTE_CONFIG_INSTANCES = new InjectionToken(REMOTE_CONFIG_PROVIDER_NAME, provided, defaultApp); return defaultRemoteConfig && new RemoteConfig(defaultRemoteConfig); } export function remoteConfigInstanceFactory(fn: (injector: Injector) => FirebaseRemoteConfig) { - return (zone: NgZone, injector: Injector) => { - if (!isRemoteConfigSupportedFactory.sync()) { return null; } + return (zone: NgZone, injector: Injector, platformId: object) => { + if (isPlatformServer(platformId)) { return null; } const remoteConfig = zone.runOutsideAngular(() => fn(injector)); return new RemoteConfig(remoteConfig); }; @@ -47,6 +48,7 @@ const DEFAULT_REMOTE_CONFIG_INSTANCE_PROVIDER = { deps: [ [new Optional(), PROVIDED_REMOTE_CONFIG_INSTANCES ], FirebaseApp, + PLATFORM_ID, ] }; @@ -54,11 +56,6 @@ const DEFAULT_REMOTE_CONFIG_INSTANCE_PROVIDER = { providers: [ DEFAULT_REMOTE_CONFIG_INSTANCE_PROVIDER, REMOTE_CONFIG_INSTANCES_PROVIDER, - { - provide: APP_INITIALIZER, - useValue: isRemoteConfigSupportedFactory.async, - multi: true, - }, ] }) export class RemoteConfigModule { @@ -75,11 +72,6 @@ export function provideRemoteConfig( return makeEnvironmentProviders([ DEFAULT_REMOTE_CONFIG_INSTANCE_PROVIDER, REMOTE_CONFIG_INSTANCES_PROVIDER, - { - provide: APP_INITIALIZER, - useValue: isRemoteConfigSupportedFactory.async, - multi: true, - }, { provide: PROVIDED_REMOTE_CONFIG_INSTANCES, useFactory: remoteConfigInstanceFactory(fn), @@ -87,6 +79,7 @@ export function provideRemoteConfig( deps: [ NgZone, Injector, + PLATFORM_ID, ɵAngularFireSchedulers, FirebaseApps, ...deps, diff --git a/src/remote-config/remote-config.spec.ts b/src/remote-config/remote-config.spec.ts index fd119e189..fc2842062 100644 --- a/src/remote-config/remote-config.spec.ts +++ b/src/remote-config/remote-config.spec.ts @@ -1,6 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { FirebaseApp, getApp, initializeApp, provideFirebaseApp } from '@angular/fire/app'; -import { RemoteConfig, getRemoteConfig, isSupported, provideRemoteConfig } from '@angular/fire/remote-config'; +import { RemoteConfig, getRemoteConfig, provideRemoteConfig } from '@angular/fire/remote-config'; import { COMMON_CONFIG } from '../test-config'; import { rando } from '../utils'; @@ -10,14 +10,6 @@ describe('RemoteConfig', () => { let providedRemoteConfig: RemoteConfig; let appName: string; - beforeAll(done => { - // The APP_INITIALIZER that is making isSupported() sync for DI may not - // be done evaulating by the time we inject from the TestBed. We can - // ensure correct behavior by waiting for the (global) isSuppported() promise - // to resolve. - isSupported().then(() => done()); - }); - describe('single injection', () => { beforeEach(() => { diff --git a/tools/build.ts b/tools/build.ts index da22a50ab..7da9a45b4 100644 --- a/tools/build.ts +++ b/tools/build.ts @@ -64,9 +64,7 @@ ${exportedZoneWrappedFns} await writeFile(filePath, fileOutput); }; return Promise.all([ - reexport('analytics', 'firebase', 'firebase/analytics', tsKeys(), { - isSupported: { override: true }, - }), + reexport('analytics', 'firebase', 'firebase/analytics', tsKeys()), reexport('app', 'firebase', 'firebase/app', tsKeys()), reexport('app-check', 'firebase', 'firebase/app-check', tsKeys()), reexport('auth', 'rxfire', 'rxfire/auth', tsKeys()), @@ -91,8 +89,8 @@ ${exportedZoneWrappedFns} }), reexport('functions', 'firebase', 'firebase/functions', tsKeys()), reexport('messaging', 'firebase', 'firebase/messaging', tsKeys(), { - onMessage: { blockUntilFirst: false }, - isSupported: { override: true }, + isSupported: { blockUntilFirst: false }, + onMessage: { blockUntilFirst: false } }), reexport('remote-config', 'rxfire', 'rxfire/remote-config', tsKeys(), { getValue: { exportName: 'getValueChanges' }, @@ -101,9 +99,7 @@ ${exportedZoneWrappedFns} getBoolean: { exportName: 'getBooleanChanges' }, getAll: { exportName: 'getAllChanges' }, }), - reexport('remote-config', 'firebase', 'firebase/remote-config', tsKeys(), { - isSupported: { override: true }, - }), + reexport('remote-config', 'firebase', 'firebase/remote-config', tsKeys()), reexport('storage', 'rxfire', 'rxfire/storage', tsKeys(), { getDownloadURL: null, getMetadata: null, diff --git a/tsconfig.build.json b/tsconfig.build.json index 81d430423..f9f1e42f4 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -5,7 +5,7 @@ "compilerOptions": { "outDir": "tools", "skipLibCheck": true, - "lib": ["es2019"], + "lib": ["es2019", "dom"], "module": "commonjs", "target": "ES2020", "plugins": [