File tree 1 file changed +11
-5
lines changed
Filter options
packages/firebase-analytics 1 file changed +11
-5
lines changed
Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ Object.defineProperty(fb, 'analytics', {
15
15
writable : false ,
16
16
} ) ;
17
17
18
- function serialize ( data ) {
19
- let store ;
18
+ function numberHasDecimals ( item : number ) {
19
+ return ! ( item % 1 === 0 ) ;
20
+ }
20
21
22
+ function serialize ( data ) {
21
23
switch ( typeof data ) {
22
24
case 'string' :
23
25
case 'boolean' :
@@ -31,7 +33,7 @@ function serialize(data) {
31
33
}
32
34
33
35
if ( Array . isArray ( data ) ) {
34
- store = new java . util . ArrayList ( ) ;
36
+ const store = new java . util . ArrayList ( ) ;
35
37
data . forEach ( ( item ) => {
36
38
const value = serialize ( item ) ;
37
39
switch ( typeof value ) {
@@ -49,15 +51,19 @@ function serialize(data) {
49
51
return store ;
50
52
}
51
53
52
- store = new android . os . Bundle ( ) ;
54
+ const store = new android . os . Bundle ( ) ;
53
55
Object . keys ( data ) . forEach ( ( key ) => {
54
56
const value = serialize ( data [ key ] ) ;
55
57
switch ( typeof value ) {
56
58
case 'boolean' :
57
59
store . putBoolean ( key , value ) ;
58
60
break ;
59
61
case 'number' :
60
- store . putInt ( key , value ) ;
62
+ if ( numberHasDecimals ( value ) ) {
63
+ store . putDouble ( key , value ) ;
64
+ } else {
65
+ store . putLong ( key , value ) ;
66
+ }
61
67
break ;
62
68
case 'string' :
63
69
store . putString ( key , value ) ;
You can’t perform that action at this time.
0 commit comments