hypertrack-sdk-react-native 11.0.5 → 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,18 @@
|
|
|
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
|
+
|
|
12
|
+
## [11.0.6] - 2023-10-12
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Updated HyperTrack iOS SDK to [5.0.4](https://github.com/hypertrack/sdk-ios/releases/tag/5.0.3)
|
|
17
|
+
|
|
6
18
|
## [11.0.5] - 2023-10-10
|
|
7
19
|
|
|
8
20
|
### Changed
|
|
@@ -684,3 +696,5 @@ Initial release.
|
|
|
684
696
|
[11.0.3]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.3
|
|
685
697
|
[11.0.4]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.4
|
|
686
698
|
[11.0.5]: https://github.com/hypertrack/sdk-react-native/releases/tag/11.0.5
|
|
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
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](./LICENSE)
|
|
4
4
|
[](https://www.npmjs.com/package/hypertrack-sdk-react-native)
|
|
5
|
-
[](https://github.com/hypertrack/sdk-ios)
|
|
6
6
|
[](https://github.com/hypertrack/sdk-android)
|
|
7
7
|
|
|
8
8
|
[HyperTrack](https://www.hypertrack.com) lets you add live location tracking to your mobile app. Live location is made available along with ongoing activity, tracking controls and tracking outage with reasons.
|
|
@@ -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.
|
|
136
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
HyperTrack.subscribeToIsAvailable {
|
|
146
|
+
emitEvent(EVENT_IS_AVAILABLE, serializeIsAvailable(it).toWritableMap())
|
|
147
|
+
}.also {
|
|
148
|
+
result.add(it)
|
|
149
|
+
}
|
|
142
150
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
HyperTrack.subscribeToIsTracking {
|
|
152
|
+
emitEvent(EVENT_IS_TRACKING, serializeIsTracking(it).toWritableMap())
|
|
153
|
+
}.also {
|
|
154
|
+
result.add(it)
|
|
155
|
+
}
|
|
146
156
|
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
HyperTrack.subscribeToLocation {
|
|
158
|
+
emitEvent(EVENT_LOCATION, serializeLocationResult(it).toWritableMap())
|
|
159
|
+
}.also {
|
|
160
|
+
result.add(it)
|
|
161
|
+
}
|
|
149
162
|
}
|
|
150
163
|
}
|
|
151
164
|
|
|
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
19
19
|
|
|
20
20
|
s.dependency "React-Core"
|
|
21
|
-
s.dependency 'HyperTrack', '5.0.
|
|
21
|
+
s.dependency 'HyperTrack', '5.0.4'
|
|
22
22
|
|
|
23
23
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
24
24
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypertrack-sdk-react-native",
|
|
3
|
-
"version": "11.0.
|
|
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",
|