1
1
package com.mytracker
2
2
3
3
import com.facebook.react.module.annotations.ReactModule
4
- import com.mytracker.MytrackerModule
5
4
import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.bridge.ReactContextBaseJavaModule
7
5
import android.app.Application
8
- import androidx.annotation.WorkerThread
9
- import com.facebook.react.bridge.Promise
10
- import com.facebook.react.bridge.ReactMethod
11
6
import com.my.tracker.MyTracker
12
7
import com.facebook.react.bridge.ReadableMap
13
8
import java.util.HashMap
14
- import com.my.tracker.MyTrackerParams
15
- import com.my.tracker.MyTrackerConfig
16
9
17
10
@ReactModule(name = MytrackerModule .NAME )
18
11
class MytrackerModule (reactContext : ReactApplicationContext ) :
@@ -43,7 +36,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
43
36
44
37
45
38
override fun trackLoginEventWithParams (userId : String , vkConnectId : String? , attributes : ReadableMap ) {
46
- val map: Map <String , Any > = attributes.toHashMap()
39
+ val map: HashMap <String , Any ? > = attributes.toHashMap()
47
40
val params: MutableMap <String , String > = HashMap ()
48
41
for ((key, value) in map) {
49
42
if (value is String ) {
@@ -55,7 +48,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
55
48
56
49
57
50
override fun trackEventWithParams (name : String , attributes : ReadableMap ) {
58
- val map: Map <String , Any > = attributes.toHashMap()
51
+ val map: HashMap <String , Any ? > = attributes.toHashMap()
59
52
val params: MutableMap <String , String > = HashMap ()
60
53
for ((key, value) in map) {
61
54
if (value is String ) {
@@ -78,7 +71,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
78
71
79
72
80
73
override fun trackInviteEventWithParams (attributes : ReadableMap ) {
81
- val map: Map <String , Any > = attributes.toHashMap()
74
+ val map: HashMap <String , Any ? > = attributes.toHashMap()
82
75
val params: MutableMap <String , String > = HashMap ()
83
76
for ((key, value) in map) {
84
77
if (value is String ) {
@@ -104,7 +97,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
104
97
vkConnectId : String? ,
105
98
attributes : ReadableMap
106
99
) {
107
- val map: Map <String , Any > = attributes.toHashMap()
100
+ val map: HashMap <String , Any ? > = attributes.toHashMap()
108
101
val params: MutableMap <String , String > = HashMap ()
109
102
for ((key, value) in map) {
110
103
if (value is String ) {
@@ -126,7 +119,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
126
119
127
120
128
121
override fun trackLevelWithLevelWithParams (level : Double , attributes : ReadableMap ) {
129
- val map: Map <String , Any > = attributes.toHashMap()
122
+ val map: HashMap <String , Any ? > = attributes.toHashMap()
130
123
val params: MutableMap <String , String > = HashMap ()
131
124
for ((key, value) in map) {
132
125
if (value is String ) {
@@ -169,12 +162,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
169
162
170
163
override fun trackLocation (number : Double ) {
171
164
val trackerConfig = MyTracker .getTrackerConfig()
172
- if (number.toInt() == 0 ) {
173
- trackerConfig.isTrackingLocationEnabled = false
174
- }
175
- if (number.toInt() == 1 || number.toInt() == 2 ) {
176
- trackerConfig.isTrackingLocationEnabled = true
177
- }
165
+ trackerConfig.setLocationTrackingMode(number.toInt())
178
166
}
179
167
180
168
0 commit comments