hypertrack-sdk-react-native 11.0.6 → 11.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [11.0.7] - 2023-10-19
7
+
8
+ ### Fixed
9
+
10
+ - Lazily initialize event listener subscriptions
11
+
6
12
  ## [11.0.6] - 2023-10-12
7
13
 
8
14
  ### Changed
@@ -691,3 +697,4 @@ Initial release.
691
697
  [11.0.4]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.4
692
698
  [11.0.5]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.5
693
699
  [11.0.6]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.6
700
+ [11.0.7]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.7
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Apr 13 16:52:30 EEST 2023
2
+ gradle.version=7.2
File without changes
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="CompilerConfiguration">
4
+ <bytecodeTargetLevel target="11" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleMigrationSettings" migrationVersion="1" />
4
+ <component name="GradleSettings">
5
+ <option name="linkedExternalProjectsSettings">
6
+ <GradleProjectSettings>
7
+ <option name="testRunner" value="GRADLE" />
8
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
9
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
10
+ <option name="gradleHome" value="/usr/local/Cellar/gradle/8.0.2/libexec" />
11
+ <option name="modules">
12
+ <set>
13
+ <option value="$PROJECT_DIR$" />
14
+ </set>
15
+ </option>
16
+ </GradleProjectSettings>
17
+ </option>
18
+ </component>
19
+ </project>
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="RemoteRepositoriesConfiguration">
4
+ <remote-repository>
5
+ <option name="id" value="central" />
6
+ <option name="name" value="Maven Central repository" />
7
+ <option name="url" value="https://repo1.maven.org/maven2" />
8
+ </remote-repository>
9
+ <remote-repository>
10
+ <option name="id" value="jboss.community" />
11
+ <option name="name" value="JBoss Community repository" />
12
+ <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
13
+ </remote-repository>
14
+ <remote-repository>
15
+ <option name="id" value="MavenRepo" />
16
+ <option name="name" value="MavenRepo" />
17
+ <option name="url" value="https://repo.maven.apache.org/maven2/" />
18
+ </remote-repository>
19
+ <remote-repository>
20
+ <option name="id" value="React Native sources" />
21
+ <option name="name" value="React Native sources" />
22
+ <option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
23
+ </remote-repository>
24
+ <remote-repository>
25
+ <option name="id" value="hypertrack" />
26
+ <option name="name" value="hypertrack" />
27
+ <option name="url" value="https://s3-us-west-2.amazonaws.com/m2.hypertrack.com/" />
28
+ </remote-repository>
29
+ <remote-repository>
30
+ <option name="id" value="Google" />
31
+ <option name="name" value="Google" />
32
+ <option name="url" value="https://dl.google.com/dl/android/maven2/" />
33
+ </remote-repository>
34
+ </component>
35
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="KotlinJpsPluginSettings">
4
+ <option name="version" value="1.6.21" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,9 @@
1
+ <project version="4">
2
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
3
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="zulu-11" project-jdk-type="JavaSDK">
4
+ <output url="file://$PROJECT_DIR$/build/classes" />
5
+ </component>
6
+ <component name="ProjectType">
7
+ <option name="id" value="Android" />
8
+ </component>
9
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Thu Jul 06 15:19:21 EEST 2023
8
+ sdk.dir=/opt/homebrew/share/android-commandlinetools
@@ -18,6 +18,7 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
18
18
  ReactContextBaseJavaModule(reactContext) {
19
19
 
20
20
  private var locateSubscription: HyperTrack.Cancellable? = null
21
+ private var subscriptions: List<HyperTrack.Cancellable>? = null
21
22
 
22
23
  override fun getName(): String {
23
24
  return NAME
@@ -30,6 +31,13 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
30
31
  @ReactMethod
31
32
  fun addListener(eventName: String?) {
32
33
  // called when RN app subscribes to an event
34
+ /**
35
+ * We init listeners lazily to avoid calling any SDK method before dynamic publishable key
36
+ * is set.
37
+ */
38
+ if (subscriptions == null) {
39
+ subscriptions = initListeners()
40
+ }
33
41
  when (eventName) {
34
42
  EVENT_ERRORS -> {
35
43
  emitEvent(EVENT_ERRORS, serializeErrors(HyperTrack.errors).toWriteableArray())
@@ -48,11 +56,6 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
48
56
  // Keep: Required for RN built in Event Emitter Calls.
49
57
  }
50
58
 
51
- override fun initialize() {
52
- super.initialize()
53
- initListeners()
54
- }
55
-
56
59
  @ReactMethod
57
60
  fun removeListeners(type: Int?) {
58
61
  // Keep: Required for RN built in Event Emitter Calls.
@@ -131,21 +134,31 @@ class HyperTrackReactNativePlugin(reactContext: ReactApplicationContext?) :
131
134
  HyperTrackSdkWrapper.setName(args.toHashMap())
132
135
  }
133
136
 
134
- private fun initListeners() {
135
- HyperTrack.subscribeToErrors {
136
- emitEvent(EVENT_ERRORS, serializeErrors(it).toWriteableArray())
137
- }
137
+ private fun initListeners(): List<HyperTrack.Cancellable> {
138
+ return mutableListOf<HyperTrack.Cancellable>().also { result ->
139
+ HyperTrack.subscribeToErrors {
140
+ emitEvent(EVENT_ERRORS, serializeErrors(it).toWriteableArray())
141
+ }.also {
142
+ result.add(it)
143
+ }
138
144
 
139
- HyperTrack.subscribeToIsAvailable {
140
- emitEvent(EVENT_IS_AVAILABLE, serializeIsAvailable(it).toWritableMap())
141
- }
145
+ HyperTrack.subscribeToIsAvailable {
146
+ emitEvent(EVENT_IS_AVAILABLE, serializeIsAvailable(it).toWritableMap())
147
+ }.also {
148
+ result.add(it)
149
+ }
142
150
 
143
- HyperTrack.subscribeToIsTracking {
144
- emitEvent(EVENT_IS_TRACKING, serializeIsTracking(it).toWritableMap())
145
- }
151
+ HyperTrack.subscribeToIsTracking {
152
+ emitEvent(EVENT_IS_TRACKING, serializeIsTracking(it).toWritableMap())
153
+ }.also {
154
+ result.add(it)
155
+ }
146
156
 
147
- HyperTrack.subscribeToLocation {
148
- emitEvent(EVENT_LOCATION, serializeLocationResult(it).toWritableMap())
157
+ HyperTrack.subscribeToLocation {
158
+ emitEvent(EVENT_LOCATION, serializeLocationResult(it).toWritableMap())
159
+ }.also {
160
+ result.add(it)
161
+ }
149
162
  }
150
163
  }
151
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypertrack-sdk-react-native",
3
- "version": "11.0.6",
3
+ "version": "11.0.7",
4
4
  "description": "React Native HyperTrack SDK is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into React Native apps.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",