@@ -35,7 +35,7 @@ export function logEvent(options: LogEventOptions): Promise<void> {
3535 }
3636
3737 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
38- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( )
38+ appModule . android . context || appModule . android . nativeApp
3939 ) . logEvent ( options . key , bundle ) ;
4040
4141 resolve ( ) ;
@@ -65,7 +65,7 @@ export function logComplexEvent(options: LogComplexEventOptions): Promise<void>
6565 }
6666
6767 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
68- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( )
68+ appModule . android . context || appModule . android . nativeApp
6969 ) . logEvent ( options . key , bundle ) ;
7070
7171 resolve ( ) ;
@@ -90,7 +90,7 @@ export function setUserId(arg): Promise<void> {
9090 }
9191
9292 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
93- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( ) ) . setUserId ( arg . userId ) ;
93+ appModule . android . context || appModule . android . nativeApp ) . setUserId ( arg . userId ) ;
9494
9595 resolve ( ) ;
9696 } catch ( ex ) {
@@ -118,7 +118,7 @@ export function setUserProperty(options: SetUserPropertyOptions): Promise<void>
118118 }
119119
120120 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
121- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( )
121+ appModule . android . context || appModule . android . nativeApp
122122 ) . setUserProperty ( options . key , options . value ) ;
123123
124124 resolve ( ) ;
@@ -143,7 +143,7 @@ export function setScreenName(options: SetScreenNameOptions): Promise<void> {
143143 }
144144
145145 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
146- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( )
146+ appModule . android . context || appModule . android . nativeApp
147147 ) . setCurrentScreen ( appModule . android . foregroundActivity , options . screenName , null ) ;
148148
149149 resolve ( ) ;
@@ -157,15 +157,15 @@ export function setScreenName(options: SetScreenNameOptions): Promise<void> {
157157export function setAnalyticsCollectionEnabled ( enabled : boolean ) : void {
158158 if ( isAnalyticsAvailable ( ) ) {
159159 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
160- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( )
160+ appModule . android . context || appModule . android . nativeApp
161161 ) . setAnalyticsCollectionEnabled ( enabled ) ;
162162 }
163163}
164164
165165export function setSessionTimeoutDuration ( seconds : number ) : void {
166166 if ( isAnalyticsAvailable ( ) ) {
167167 com . google . firebase . analytics . FirebaseAnalytics . getInstance (
168- appModule . android . context || com . tns . NativeScriptApplication . getInstance ( )
168+ appModule . android . context || appModule . android . nativeApp
169169 ) . setSessionTimeoutDuration ( seconds * 1000 ) ; // Android expects ms
170170 }
171171}
0 commit comments