Skip to content

Commit 089bfbc

Browse files
committed
2.0.0
1 parent b0b397b commit 089bfbc

File tree

15 files changed

+2406
-1055
lines changed

15 files changed

+2406
-1055
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Since version 1.0.0 the library can only be used on the new architecture
1010
| ------- | -------------------- |
1111
| < 1.0.0 | < 0.76.0 |
1212
| 1.0.0+ | 0.76.0+ |
13+
| 2.0.0+ | 0.77.0+ |
1314

1415
## Installation
1516

@@ -52,13 +53,9 @@ MyTracker.bufferingPeriod(30);
5253

5354
MyTracker.forcingPeriod(30);
5455

55-
//for IOS:
56-
// 0 = MRLocationTrackingModeNone — location is not tracked
57-
// 1 = MRLocationTrackingModeCached — uses the system's cached value
58-
// 2 = MRLocationTrackingModeActive — uses a request for the current location (default)
59-
// for Android:
60-
// 0 = false - do not track the user's location (default)
61-
// 1 or 2 = true - track the user's location
56+
// 0 — location is not tracked
57+
// 1 — uses the system's cached value
58+
// 2 — uses a request for the current location (default)
6259
MyTracker.trackLocation(0);
6360

6461
MyTracker.setDebugMode(false);

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ dependencies {
110110
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
111111
//noinspection GradleDynamicVersion
112112
implementation "com.facebook.react:react-native:+"
113-
implementation 'com.my.tracker:mytracker-sdk:3.3.2'
113+
implementation 'com.my.tracker:mytracker-sdk:3.4.1'
114114
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
115115
}
116116

android/src/main/java/com/mytracker/MytrackerModule.kt

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
package com.mytracker
22

33
import com.facebook.react.module.annotations.ReactModule
4-
import com.mytracker.MytrackerModule
54
import com.facebook.react.bridge.ReactApplicationContext
6-
import com.facebook.react.bridge.ReactContextBaseJavaModule
75
import android.app.Application
8-
import androidx.annotation.WorkerThread
9-
import com.facebook.react.bridge.Promise
10-
import com.facebook.react.bridge.ReactMethod
116
import com.my.tracker.MyTracker
127
import com.facebook.react.bridge.ReadableMap
138
import java.util.HashMap
14-
import com.my.tracker.MyTrackerParams
15-
import com.my.tracker.MyTrackerConfig
169

1710
@ReactModule(name = MytrackerModule.NAME)
1811
class MytrackerModule(reactContext: ReactApplicationContext) :
@@ -43,7 +36,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
4336

4437

4538
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()
4740
val params: MutableMap<String, String> = HashMap()
4841
for ((key, value) in map) {
4942
if (value is String) {
@@ -55,7 +48,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
5548

5649

5750
override fun trackEventWithParams(name: String, attributes: ReadableMap) {
58-
val map: Map<String, Any> = attributes.toHashMap()
51+
val map: HashMap<String, Any?> = attributes.toHashMap()
5952
val params: MutableMap<String, String> = HashMap()
6053
for ((key, value) in map) {
6154
if (value is String) {
@@ -78,7 +71,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
7871

7972

8073
override fun trackInviteEventWithParams(attributes: ReadableMap) {
81-
val map: Map<String, Any> = attributes.toHashMap()
74+
val map: HashMap<String, Any?> = attributes.toHashMap()
8275
val params: MutableMap<String, String> = HashMap()
8376
for ((key, value) in map) {
8477
if (value is String) {
@@ -104,7 +97,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
10497
vkConnectId: String?,
10598
attributes: ReadableMap
10699
) {
107-
val map: Map<String, Any> = attributes.toHashMap()
100+
val map: HashMap<String, Any?> = attributes.toHashMap()
108101
val params: MutableMap<String, String> = HashMap()
109102
for ((key, value) in map) {
110103
if (value is String) {
@@ -126,7 +119,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
126119

127120

128121
override fun trackLevelWithLevelWithParams(level: Double, attributes: ReadableMap) {
129-
val map: Map<String, Any> = attributes.toHashMap()
122+
val map: HashMap<String, Any?> = attributes.toHashMap()
130123
val params: MutableMap<String, String> = HashMap()
131124
for ((key, value) in map) {
132125
if (value is String) {
@@ -169,12 +162,7 @@ class MytrackerModule(reactContext: ReactApplicationContext) :
169162

170163
override fun trackLocation(number: Double) {
171164
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())
178166
}
179167

180168

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ buildscript {
44
minSdkVersion = 24
55
compileSdkVersion = 35
66
targetSdkVersion = 34
7-
ndkVersion = "26.1.10909125"
8-
kotlinVersion = "1.9.24"
7+
ndkVersion = "27.1.12297006"
8+
kotlinVersion = "2.0.21"
99
}
1010
repositories {
1111
google()

example/ios/MytrackerExample/AppDelegate.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#import "AppDelegate.h"
22

33
#import <React/RCTBundleURLProvider.h>
4+
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
45

56
@implementation AppDelegate
67

@@ -9,6 +10,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
910
self.moduleName = @"MytrackerExample";
1011
// You can add your custom initial props in the dictionary below.
1112
// They will be passed down to the ViewController used by React Native.
13+
self.dependencyProvider = [RCTAppDependencyProvider new];
1214
self.initialProps = @{};
1315

1416
return [super application:application didFinishLaunchingWithOptions:launchOptions];

0 commit comments

Comments
 (0)