react-native-steerpath-smart-map 1.26.0 → 1.27.0
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 +10 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.java +2 -3
- package/dist/SmartLocationManager.d.ts +8 -6
- package/ios/RNSmartLocationManager.m +2 -2
- package/package.json +1 -1
- package/react-native-steerpath-smart-map.podspec +1 -1
- package/src/SmartLocationManager.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,16 @@ This package is built on top of Steerpath's Smart SDK, and most of releases are
|
|
|
15
15
|
- [iOS](https://s3-eu-west-1.amazonaws.com/steerpath/ios/releases/smart-sdk-changelog/index.html)
|
|
16
16
|
- [Web](https://s3-eu-west-1.amazonaws.com/steerpath-web-sdk/documentation/smart/latest/index.html)
|
|
17
17
|
|
|
18
|
+
## [1.27.0] - 2024-03-26
|
|
19
|
+
|
|
20
|
+
- **BREAKING** Added accuracyM value to onLocationChanged callback
|
|
21
|
+
- Added typing for the onLocationChanged callback - LocationResponse
|
|
22
|
+
|
|
23
|
+
## [1.26.1] - 2023-03-11
|
|
24
|
+
|
|
25
|
+
- Bump Android Smart SDK version to android-smart-1.21.5
|
|
26
|
+
- Fixes native crash caused by March 2024 security update
|
|
27
|
+
|
|
18
28
|
## [1.26.0] - 2023-12-05
|
|
19
29
|
|
|
20
30
|
- Add loginToLive and logoutFromLive methods for iOS and Android
|
package/android/build.gradle
CHANGED
|
@@ -53,7 +53,7 @@ repositories {
|
|
|
53
53
|
|
|
54
54
|
dependencies {
|
|
55
55
|
implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
|
|
56
|
-
implementation "com.steerpath:smart:android-smart-1.
|
|
56
|
+
implementation "com.steerpath:smart:android-smart-1.22.0"
|
|
57
57
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
58
58
|
implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0"
|
|
59
59
|
}
|
|
@@ -37,7 +37,6 @@ public class RNSmartLocationManager extends ReactContextBaseJavaModule implement
|
|
|
37
37
|
|
|
38
38
|
@ReactMethod
|
|
39
39
|
public void addListener(String eventName) {
|
|
40
|
-
Log.d("LocationManager", "add listener");
|
|
41
40
|
if (listenerCount == 0) {
|
|
42
41
|
SmartLocationManager.addLocationListener(this);
|
|
43
42
|
}
|
|
@@ -46,7 +45,6 @@ public class RNSmartLocationManager extends ReactContextBaseJavaModule implement
|
|
|
46
45
|
|
|
47
46
|
@ReactMethod
|
|
48
47
|
public void removeListeners(Integer count) {
|
|
49
|
-
Log.d("LocationManager", "remove listener");
|
|
50
48
|
listenerCount -= count;
|
|
51
49
|
if (listenerCount == 0) {
|
|
52
50
|
SmartLocationManager.removeLocationListener(this);
|
|
@@ -54,7 +52,7 @@ public class RNSmartLocationManager extends ReactContextBaseJavaModule implement
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
@Override
|
|
57
|
-
public void onLocationChanged(double latitude, double longitude, @Nullable String buildingRef, int floorIndex) {
|
|
55
|
+
public void onLocationChanged(double latitude, double longitude, @Nullable String buildingRef, int floorIndex, float accuracyM) {
|
|
58
56
|
WritableNativeMap map = new WritableNativeMap();
|
|
59
57
|
map.putDouble("latitude", latitude);
|
|
60
58
|
map.putDouble("longitude", longitude);
|
|
@@ -64,6 +62,7 @@ public class RNSmartLocationManager extends ReactContextBaseJavaModule implement
|
|
|
64
62
|
map.putString("buildingRef", buildingRef);
|
|
65
63
|
}
|
|
66
64
|
map.putInt("floorIndex", floorIndex);
|
|
65
|
+
map.putDouble("accuracyM", accuracyM);
|
|
67
66
|
sendEvent(appContext, ON_LOCATION_CHANGED, map);
|
|
68
67
|
}
|
|
69
68
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export declare type LocationResponse = {
|
|
2
|
+
latitude: number;
|
|
3
|
+
longitude: number;
|
|
4
|
+
buildingRef: string | null;
|
|
5
|
+
floorIndex: number;
|
|
6
|
+
accuracyM: number;
|
|
7
|
+
};
|
|
1
8
|
export declare const SmartLocationManager: {
|
|
2
|
-
addLocationChangedListener(listener: (data:
|
|
3
|
-
latitude: number;
|
|
4
|
-
longitude: number;
|
|
5
|
-
buildingRef: string | null;
|
|
6
|
-
floorIndex: number;
|
|
7
|
-
}) => void): void;
|
|
9
|
+
addLocationChangedListener(listener: (data: LocationResponse) => void): void;
|
|
8
10
|
removeLocationChangedListener(): void;
|
|
9
11
|
};
|
|
@@ -30,9 +30,9 @@ RCT_EXPORT_MODULE(RNSmartLocationManager);
|
|
|
30
30
|
[[SPSmartLocationManager sharedInstance] removeDelegate:self];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
-(void)spSmartLocationManager:(SPSmartLocationManager *)manager onLocationChanged:(double)latitude longitude:(double)longitude buildingRef:(nullable NSString *)buildingRef floorIndex:(NSInteger)floorIndex {
|
|
33
|
+
-(void)spSmartLocationManager:(SPSmartLocationManager *)manager onLocationChanged:(double)latitude longitude:(double)longitude buildingRef:(nullable NSString *)buildingRef floorIndex:(NSInteger)floorIndex accuracyM:(double)accuracyM{
|
|
34
34
|
if (hasListeners) {
|
|
35
|
-
[self sendEventWithName:@"locationChanged" body:@{@"latitude": [NSNumber numberWithDouble:latitude], @"longitude": [NSNumber numberWithDouble:longitude], @"buildingRef": buildingRef ?: [NSNull null], @"floorIndex": [NSNumber numberWithInteger:floorIndex]}];
|
|
35
|
+
[self sendEventWithName:@"locationChanged" body:@{@"latitude": [NSNumber numberWithDouble:latitude], @"longitude": [NSNumber numberWithDouble:longitude], @"buildingRef": buildingRef ?: [NSNull null], @"floorIndex": [NSNumber numberWithInteger:floorIndex], @"accuracyM": [NSNumber numberWithDouble:accuracyM]}];
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
package/package.json
CHANGED
|
@@ -6,6 +6,10 @@ const smartLocationManagerEmitter = new NativeEventEmitter(
|
|
|
6
6
|
RNSmartLocationManager
|
|
7
7
|
);
|
|
8
8
|
|
|
9
|
+
export type LocationResponse = {
|
|
10
|
+
latitude: number, longitude: number, buildingRef: string | null, floorIndex: number, accuracyM: number
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
function createSmartLocationManager() {
|
|
10
14
|
let eventListenerRegistered = false;
|
|
11
15
|
let eventListener: EmitterSubscription;
|
|
@@ -13,12 +17,12 @@ function createSmartLocationManager() {
|
|
|
13
17
|
return {
|
|
14
18
|
addLocationChangedListener(
|
|
15
19
|
listener: (
|
|
16
|
-
data:
|
|
20
|
+
data: LocationResponse
|
|
17
21
|
) => void
|
|
18
22
|
) {
|
|
19
23
|
if (!eventListenerRegistered) {
|
|
20
24
|
eventListenerRegistered = true;
|
|
21
|
-
eventListener = smartLocationManagerEmitter.addListener('locationChanged', (payload) => {
|
|
25
|
+
eventListener = smartLocationManagerEmitter.addListener('locationChanged', (payload: LocationResponse) => {
|
|
22
26
|
listener(payload);
|
|
23
27
|
})
|
|
24
28
|
}
|