9
9
ɵapplyMixins ,
10
10
FirebaseApp
11
11
} from '@angular/fire' ;
12
- import firebase from 'firebase/app ' ;
12
+ import { Analytics , setAnalyticsCollectionEnabled } from 'firebase/analytics ' ;
13
13
import { proxyPolyfillCompat } from './base' ;
14
14
import { ɵfetchInstance } from '@angular/fire' ;
15
15
@@ -31,7 +31,7 @@ const GTAG_FUNCTION_NAME = 'gtag'; // TODO rename these
31
31
const DATA_LAYER_NAME = 'dataLayer' ;
32
32
const SEND_TO_KEY = 'send_to' ;
33
33
34
- export interface AngularFireAnalytics extends ɵPromiseProxy < firebase . analytics . Analytics > {
34
+ export interface AngularFireAnalytics extends ɵPromiseProxy < Analytics > {
35
35
}
36
36
37
37
@Injectable ( {
@@ -146,21 +146,22 @@ export class AngularFireAnalytics {
146
146
observeOn ( new ɵAngularFireSchedulers ( zone ) . outsideAngular ) ,
147
147
switchMap ( ( ) => isPlatformBrowser ( platformId ) ? zone . runOutsideAngular ( ( ) => import ( 'firebase/analytics' ) ) : EMPTY ) ,
148
148
// SEMVER can switch to isSupported() when we only target v8
149
- // switchMap(() => firebase.analytics. isSupported().then(it => it, () => false)),
149
+ // switchMap(() => isSupported().then(it => it, () => false)),
150
150
// TODO server-side investigate use of the Universal Analytics API
151
151
// switchMap(supported => supported ? of(undefined) : EMPTY),
152
152
map ( ( ) => {
153
153
return ɵfetchInstance ( `analytics` , 'AngularFireAnalytics' , app , ( ) => {
154
154
const analytics = app . analytics ( ) ;
155
155
if ( analyticsCollectionEnabled === false ) {
156
- analytics . setAnalyticsCollectionEnabled ( false ) ;
156
+ setAnalyticsCollectionEnabled ( analytics , false ) ;
157
157
}
158
158
return analytics ;
159
159
} , [ app , analyticsCollectionEnabled , providedConfig , debugModeEnabled ] ) ;
160
160
} ) ,
161
161
shareReplay ( { bufferSize : 1 , refCount : false } )
162
162
) ;
163
163
164
+ // TODO(davideast, jamesdaniels): Hardcore zone patch or just patch here?
164
165
return ɵlazySDKProxy ( this , analytics , zone ) ;
165
166
166
167
}
0 commit comments