@sentiance-react-native/core 6.2.1 → 6.2.3
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/android/src/main/java/com/sentiance/react/bridge/core/SentianceConverter.java +13 -2
- package/ios/RNSentianceCore+Converter.m +0 -25
- package/ios/RNSentianceCore.podspec +1 -1
- package/lib/index.d.ts +4 -4
- package/package.json +2 -2
- package/android/src/main/java/com/sentiance/react/bridge/core/common/SentianceCommonConverter.java +0 -24
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
package com.sentiance.react.bridge.core;
|
|
2
2
|
|
|
3
|
-
import static com.sentiance.react.bridge.core.common.SentianceCommonConverter.convertLocation;
|
|
4
|
-
|
|
5
3
|
import android.location.Location;
|
|
6
4
|
|
|
7
5
|
import com.facebook.react.bridge.Arguments;
|
|
@@ -209,6 +207,19 @@ public class SentianceConverter {
|
|
|
209
207
|
return map;
|
|
210
208
|
}
|
|
211
209
|
|
|
210
|
+
public static WritableMap convertLocation(Location location) {
|
|
211
|
+
WritableMap locationMap = Arguments.createMap();
|
|
212
|
+
|
|
213
|
+
locationMap.putString("latitude", String.valueOf(location.getLatitude()));
|
|
214
|
+
locationMap.putString("longitude", String.valueOf(location.getLongitude()));
|
|
215
|
+
locationMap.putString("accuracy", String.valueOf(location.getAccuracy()));
|
|
216
|
+
locationMap.putString("altitude", String.valueOf(location.getAltitude()));
|
|
217
|
+
locationMap.putString("provider", location.getProvider());
|
|
218
|
+
|
|
219
|
+
return locationMap;
|
|
220
|
+
|
|
221
|
+
}
|
|
222
|
+
|
|
212
223
|
public static String convertTripType(TripType tripType) {
|
|
213
224
|
switch (tripType) {
|
|
214
225
|
case ANY:
|
|
@@ -8,13 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
#import "RNSentianceCore+Converter.h"
|
|
10
10
|
@import UIKit.UIApplication;
|
|
11
|
-
@import CoreLocation;
|
|
12
11
|
|
|
13
12
|
@interface RNSentianceCore (Private)
|
|
14
13
|
|
|
15
14
|
- (NSString*)convertTimelineEventTypeToString:(SENTTimelineEventType)type;
|
|
16
15
|
- (NSDictionary*)convertGeolocation:(SENTGeolocation*)location;
|
|
17
|
-
- (NSDictionary*)convertCllocation:(CLLocation*)location;
|
|
18
16
|
- (NSString*)convertVenueSignificance:(SENTVenueSignificance)type;
|
|
19
17
|
- (NSDictionary*)convertVenue:(SENTVenue*)venue;
|
|
20
18
|
- (void)addStationaryEventInfoToDict:(NSMutableDictionary*)dict event:(SENTStationaryEvent*)event;
|
|
@@ -54,22 +52,6 @@
|
|
|
54
52
|
};
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
- (NSDictionary*)convertCllocation:(CLLocation*)location {
|
|
58
|
-
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
59
|
-
dict[@"timestamp"] = @((long) ([location.timestamp timeIntervalSince1970] * 1000));
|
|
60
|
-
dict[@"latitude"] = @(location.coordinate.latitude);
|
|
61
|
-
dict[@"longitude"] = @(location.coordinate.longitude);
|
|
62
|
-
|
|
63
|
-
if (location.horizontalAccuracy >= 0) {
|
|
64
|
-
dict[@"accuracy"] = @(location.horizontalAccuracy);
|
|
65
|
-
}
|
|
66
|
-
if (location.verticalAccuracy > 0) {
|
|
67
|
-
dict[@"altitude"] = @(location.altitude);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return dict;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
55
|
- (NSString*)convertSemanticTime:(SENTSemanticTime)semanticTime {
|
|
74
56
|
switch (semanticTime) {
|
|
75
57
|
case SENTSemanticTimeMorning:
|
|
@@ -774,13 +756,6 @@
|
|
|
774
756
|
dict[@"speedAtImpact"] = @(crashEvent.speedAtImpact);
|
|
775
757
|
dict[@"deltaV"] = @(crashEvent.deltaV);
|
|
776
758
|
dict[@"confidence"] = @(crashEvent.confidence);
|
|
777
|
-
|
|
778
|
-
NSMutableArray *precedingLocations = [[NSMutableArray alloc] init];
|
|
779
|
-
for (CLLocation* location in crashEvent.precedingLocations) {
|
|
780
|
-
[precedingLocations addObject:[self convertCllocation:location]];
|
|
781
|
-
}
|
|
782
|
-
dict[@"precedingLocations"] = precedingLocations;
|
|
783
|
-
|
|
784
759
|
return [dict copy];
|
|
785
760
|
}
|
|
786
761
|
|
package/lib/index.d.ts
CHANGED
|
@@ -61,10 +61,10 @@ declare module "@sentiance-react-native/core" {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export interface Location {
|
|
64
|
-
latitude:
|
|
65
|
-
longitude:
|
|
66
|
-
accuracy?:
|
|
67
|
-
altitude?:
|
|
64
|
+
latitude: string;
|
|
65
|
+
longitude: string;
|
|
66
|
+
accuracy?: string; // Android only
|
|
67
|
+
altitude?: string; // Android only
|
|
68
68
|
provider?: string; // Android only
|
|
69
69
|
}
|
|
70
70
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentiance-react-native/core",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.3",
|
|
4
4
|
"description": "React Native Sentiance core library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"targetSdk": 31,
|
|
30
30
|
"compileSdk": 31,
|
|
31
31
|
"buildTools": "30.0.3",
|
|
32
|
-
"sentiance": "6.2
|
|
32
|
+
"sentiance": "6.2.+"
|
|
33
33
|
},
|
|
34
34
|
"ios": {
|
|
35
35
|
"sentiance": "~> 6.2.0"
|
package/android/src/main/java/com/sentiance/react/bridge/core/common/SentianceCommonConverter.java
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package com.sentiance.react.bridge.core.common;
|
|
2
|
-
|
|
3
|
-
import android.location.Location;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.Arguments;
|
|
6
|
-
import com.facebook.react.bridge.WritableMap;
|
|
7
|
-
|
|
8
|
-
public class SentianceCommonConverter {
|
|
9
|
-
|
|
10
|
-
public static WritableMap convertLocation(Location location) {
|
|
11
|
-
WritableMap locationMap = Arguments.createMap();
|
|
12
|
-
locationMap.putDouble("timestamp", location.getTime());
|
|
13
|
-
locationMap.putDouble("latitude", location.getLatitude());
|
|
14
|
-
locationMap.putDouble("longitude", location.getLongitude());
|
|
15
|
-
if (location.hasAccuracy()) {
|
|
16
|
-
locationMap.putDouble("accuracy", location.getAccuracy());
|
|
17
|
-
}
|
|
18
|
-
if (location.hasAltitude()) {
|
|
19
|
-
locationMap.putDouble("altitude", location.getAltitude());
|
|
20
|
-
}
|
|
21
|
-
locationMap.putString("provider", location.getProvider());
|
|
22
|
-
return locationMap;
|
|
23
|
-
}
|
|
24
|
-
}
|