@sentiance-react-native/core 6.9.1-rc.2 → 6.10.0-rc.1

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.
@@ -5,7 +5,7 @@ sentiance_sdk_env_var_version = ENV["SENTIANCE_RN_IOS_SDK_VERSION"]
5
5
 
6
6
  Pod::Spec.new do |s|
7
7
  s.name = "RNSentianceCore"
8
- s.version = "6.9.1-rc.2"
8
+ s.version = "6.10.0-rc.1"
9
9
  s.summary = "RNSentianceCore"
10
10
  s.description = <<-DESC
11
11
  RNSentianceCore
@@ -222,6 +222,10 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
222
222
  if (event.distanceInMeters != nil) {
223
223
  dict[@"distance"] = event.distanceInMeters;
224
224
  }
225
+
226
+ if (event.tags != nil) {
227
+ dict[@"transportTags"] = event.tags;
228
+ }
225
229
  }
226
230
 
227
231
  - (NSDictionary*)convertWaypoint:(SENTWaypoint*)waypoint {
@@ -1139,14 +1143,12 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1139
1143
  return [typesSet copy];
1140
1144
  }
1141
1145
 
1142
- - (NSDictionary<NSString *, NSDictionary<NSString *, NSNumber *> *> *)convertDrivingInsights:(SENTDrivingInsights *)drivingInsights {
1146
+ - (NSDictionary<NSString *, NSDictionary<NSString *, id> *> *)convertDrivingInsights:(SENTDrivingInsights *)drivingInsights {
1143
1147
  NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
1144
1148
  NSMutableDictionary *transportEventDict = [[NSMutableDictionary alloc] init];
1145
1149
  NSMutableDictionary *safetyScoresDict = [[NSMutableDictionary alloc] init];
1146
1150
 
1147
- [self _addBaseEventFields:transportEventDict event:drivingInsights.transportEvent];
1148
- [self addTransportEventInfoToDict:transportEventDict event:drivingInsights.transportEvent];
1149
- dict[@"transportEvent"] = transportEventDict;
1151
+ dict[@"transportEvent"] = [self convertEvent:drivingInsights.transportEvent];
1150
1152
 
1151
1153
  NSNumber* smoothScore = drivingInsights.safetyScores.smoothScore;
1152
1154
  if (smoothScore != nil) {
@@ -1178,7 +1180,7 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1178
1180
  return dict;
1179
1181
  }
1180
1182
 
1181
- - (NSArray<NSDictionary<NSString *, NSNumber *> *> *)convertHarshDrivingEvents:(NSArray<SENTHarshDrivingEvent*> *)harshDrivingEvents {
1183
+ - (NSArray<NSDictionary<NSString *, id> *> *)convertHarshDrivingEvents:(NSArray<SENTHarshDrivingEvent*> *)harshDrivingEvents {
1182
1184
  NSMutableArray <NSDictionary<NSString *, NSNumber *> *> *array = [[NSMutableArray alloc] init];
1183
1185
  for (SENTHarshDrivingEvent *event in harshDrivingEvents) {
1184
1186
  [array addObject:[self convertHarshDrivingEvent:event]];
@@ -1186,13 +1188,15 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1186
1188
  return array;
1187
1189
  }
1188
1190
 
1189
- - (NSDictionary<NSString *, NSNumber *> *)convertHarshDrivingEvent:(SENTHarshDrivingEvent *)harshDrivingEvent {
1190
- NSMutableDictionary<NSString *, NSNumber *> *dict = [self convertDrivingEvent:harshDrivingEvent];
1191
+ - (NSDictionary<NSString *, id> *)convertHarshDrivingEvent:(SENTHarshDrivingEvent *)harshDrivingEvent {
1192
+ NSMutableDictionary<NSString *, id> *dict = [self convertDrivingEvent:harshDrivingEvent];
1191
1193
  dict[@"magnitude"] = @(harshDrivingEvent.magnitude);
1194
+ dict[@"confidence"] = @(harshDrivingEvent.confidence);
1195
+ dict[@"type"] = [self stringifyHarshEventType:harshDrivingEvent.type];
1192
1196
  return dict;
1193
1197
  }
1194
1198
 
1195
- - (NSArray<NSDictionary<NSString *, NSNumber *> *> *)convertPhoneUsageEvents:(NSArray<SENTPhoneUsageEvent*> *)phoneUsageEvents {
1199
+ - (NSArray<NSDictionary<NSString *, id> *> *)convertPhoneUsageEvents:(NSArray<SENTPhoneUsageEvent*> *)phoneUsageEvents {
1196
1200
  NSMutableArray <NSDictionary<NSString *, NSNumber *> *> *array = [[NSMutableArray alloc] init];
1197
1201
  for (SENTPhoneUsageEvent *event in phoneUsageEvents) {
1198
1202
  [array addObject:[self convertPhoneUsageEvent:event]];
@@ -1200,11 +1204,11 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1200
1204
  return array;
1201
1205
  }
1202
1206
 
1203
- - (NSDictionary<NSString *, NSNumber *> *)convertPhoneUsageEvent:(SENTPhoneUsageEvent *)phoneUsageEvent {
1207
+ - (NSDictionary<NSString *, id> *)convertPhoneUsageEvent:(SENTPhoneUsageEvent *)phoneUsageEvent {
1204
1208
  return [self convertDrivingEvent:phoneUsageEvent];
1205
1209
  }
1206
1210
 
1207
- - (NSArray<NSDictionary<NSString *, NSNumber *> *> *)convertCallWhileMovingEvents:(NSArray<SENTCallWhileMovingEvent*> *)callWhileMovingEvents {
1211
+ - (NSArray<NSDictionary<NSString *, id> *> *)convertCallWhileMovingEvents:(NSArray<SENTCallWhileMovingEvent*> *)callWhileMovingEvents {
1208
1212
  NSMutableArray <NSDictionary<NSString *, NSNumber *> *> *array = [[NSMutableArray alloc] init];
1209
1213
  for (SENTCallWhileMovingEvent *event in callWhileMovingEvents) {
1210
1214
  [array addObject:[self convertCallWhileMovingEvent:event]];
@@ -1212,8 +1216,8 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1212
1216
  return array;
1213
1217
  }
1214
1218
 
1215
- - (NSDictionary<NSString *, NSNumber *> *)convertCallWhileMovingEvent:(SENTCallWhileMovingEvent *)callWhileMovingEvent {
1216
- NSMutableDictionary<NSString *, NSNumber *> *dict = [self convertDrivingEvent:callWhileMovingEvent];
1219
+ - (NSDictionary<NSString *, id> *)convertCallWhileMovingEvent:(SENTCallWhileMovingEvent *)callWhileMovingEvent {
1220
+ NSMutableDictionary<NSString *, id> *dict = [self convertDrivingEvent:callWhileMovingEvent];
1217
1221
  if (callWhileMovingEvent.minTraveledSpeedInMps != nil) {
1218
1222
  dict[@"minTravelledSpeedInMps"] = callWhileMovingEvent.minTraveledSpeedInMps;
1219
1223
  }
@@ -1223,7 +1227,7 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1223
1227
  return dict;
1224
1228
  }
1225
1229
 
1226
- - (NSArray<NSDictionary<NSString *, NSNumber *> *> *)convertSpeedingEvents:(NSArray<SENTSpeedingEvent*> *)speedingEvents {
1230
+ - (NSArray<NSDictionary<NSString *, id> *> *)convertSpeedingEvents:(NSArray<SENTSpeedingEvent*> *)speedingEvents {
1227
1231
  NSMutableArray <NSDictionary<NSString *, NSNumber *> *> *array = [[NSMutableArray alloc] init];
1228
1232
  for (SENTSpeedingEvent *event in speedingEvents) {
1229
1233
  [array addObject:[self convertSpeedingEvent:event]];
@@ -1231,13 +1235,13 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1231
1235
  return array;
1232
1236
  }
1233
1237
 
1234
- - (NSDictionary<NSString *, NSNumber *> *)convertSpeedingEvent:(SENTSpeedingEvent *)speedingEvent {
1238
+ - (NSDictionary<NSString *, id> *)convertSpeedingEvent:(SENTSpeedingEvent *)speedingEvent {
1235
1239
  NSMutableDictionary *dict = [self convertDrivingEvent:speedingEvent];
1236
1240
  dict[@"waypoints"] = [self convertWaypointArray:speedingEvent.waypoints];
1237
1241
  return dict;
1238
1242
  }
1239
1243
 
1240
- - (NSMutableDictionary<NSString *, NSNumber *> *)convertDrivingEvent:(SENTDrivingEvent *)drivingEvent {
1244
+ - (NSMutableDictionary<NSString *, id> *)convertDrivingEvent:(SENTDrivingEvent *)drivingEvent {
1241
1245
  NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
1242
1246
  dict[@"startTime"] = [drivingEvent.startDate description];
1243
1247
  dict[@"startTimeEpoch"] = @((long) (drivingEvent.startDate.timeIntervalSince1970 * 1000));
@@ -1345,4 +1349,15 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1345
1349
  return dict;
1346
1350
  }
1347
1351
 
1352
+ - (NSString *)stringifyHarshEventType:(HarshDrivingEventType)type {
1353
+ switch (type) {
1354
+ case HarshDrivingEventTypeAcceleration:
1355
+ return @"ACCELERATION";
1356
+ case HarshDrivingEventTypeBraking:
1357
+ return @"BRAKING";
1358
+ case HarshDrivingEventTypeTurn:
1359
+ return @"TURN";
1360
+ }
1361
+ }
1362
+
1348
1363
  @end
@@ -8,9 +8,9 @@
8
8
  #import "RNSentianceSubscriptionsManager.h"
9
9
 
10
10
  #define REJECT_IF_SDK_NOT_INITIALIZED(reject) if ([self isSdkNotInitialized]) { \
11
- reject(ESDKNotInitialized, @"Sdk not initialized", nil); \
12
- return; \
13
- }
11
+ reject(ESDKNotInitialized, @"Sdk not initialized", nil); \
12
+ return; \
13
+ }
14
14
 
15
15
  @interface RNSentianceCore()
16
16
 
@@ -135,11 +135,11 @@ RCT_EXPORT_MODULE(SentianceCore)
135
135
  }
136
136
 
137
137
  - (BOOL) initSDKIfUserLinkingCompleted:(NSString *)appId
138
- secret:(NSString *)secret
139
- baseURL:(nullable NSString *)baseURL
140
- shouldStart:(BOOL)shouldStart
141
- resolver:(RCTPromiseResolveBlock)resolve
142
- rejecter:(RCTPromiseRejectBlock)reject
138
+ secret:(NSString *)secret
139
+ baseURL:(nullable NSString *)baseURL
140
+ shouldStart:(BOOL)shouldStart
141
+ resolver:(RCTPromiseResolveBlock)resolve
142
+ rejecter:(RCTPromiseRejectBlock)reject
143
143
  {
144
144
  BOOL isThirdPartyLinked = [self isThirdPartyLinked];
145
145
  if (isThirdPartyLinked) {
@@ -303,8 +303,8 @@ RCT_EXPORT_METHOD(startWithStopDate:(nonnull NSNumber *)stopEpochTimeMs
303
303
  }
304
304
 
305
305
  RCT_EXPORT_METHOD(enableDetectionsWithExpiryDate:(nonnull NSNumber *)expiryEpochTimeMs
306
- resolver:(RCTPromiseResolveBlock)resolve
307
- rejecter:(RCTPromiseRejectBlock)reject)
306
+ resolver:(RCTPromiseResolveBlock)resolve
307
+ rejecter:(RCTPromiseRejectBlock)reject)
308
308
  {
309
309
  REJECT_IF_SDK_NOT_INITIALIZED(reject);
310
310
 
@@ -1198,6 +1198,25 @@ RCT_EXPORT_METHOD(getDetectionMode:(RCTPromiseResolveBlock)resolve rejecter:(RCT
1198
1198
  }
1199
1199
  }
1200
1200
 
1201
+ RCT_EXPORT_METHOD(setTransportTags:(NSDictionary *)tags
1202
+ resolver:(RCTPromiseResolveBlock)resolve
1203
+ rejecter:(RCTPromiseRejectBlock)reject) {
1204
+ REJECT_IF_SDK_NOT_INITIALIZED(reject);
1205
+ NSError *error = nil;
1206
+
1207
+ [[Sentiance sharedInstance] setTransportTags:tags error:&error];
1208
+
1209
+ if (error != nil) {
1210
+ if ([error.domain isEqualToString:@"SENTTransportTaggingDomain"]) {
1211
+ reject(ESDKTransportTaggingError, error.localizedDescription, nil);
1212
+ } else {
1213
+ reject(@"E_SDK_SET_TRANSPORT_TAGS", @"Unexpected error while attempting to set transport tags", error);
1214
+ }
1215
+ } else {
1216
+ resolve(nil);
1217
+ }
1218
+ }
1219
+
1201
1220
  - (void)didUpdateUserContext:(SENTUserContext *)userContext
1202
1221
  forCriteriaMask:(SENTUserContextUpdateCriteria)criteriaMask {
1203
1222
  NSDictionary *dict = @{
@@ -19,3 +19,4 @@ extern NSString * const ESDKCreateUserError;
19
19
  extern NSString * const ESDKResetError;
20
20
  extern NSString * const ESDKRequestUserContextError;
21
21
  extern NSString * const ESDKSmartGeofencesRefreshError;
22
+ extern NSString * const ESDKTransportTaggingError;
@@ -21,3 +21,4 @@ NSString * const ESDKCreateUserError = @"E_SDK_CREATE_USER_ERROR";
21
21
  NSString * const ESDKResetError = @"E_SDK_RESET_ERROR";
22
22
  NSString * const ESDKRequestUserContextError = @"E_SDK_REQUEST_USER_CONTEXT_ERROR";
23
23
  NSString * const ESDKSmartGeofencesRefreshError = @"E_SDK_SMART_GEOFENCES_REFRESH_ERROR";
24
+ NSString * const ESDKTransportTaggingError = @"E_TRANSPORT_TAG_ERROR";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.9.1-rc.2",
3
+ "version": "6.10.0-rc.1",
4
4
  "description": "The Sentiance Core library",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -29,10 +29,10 @@
29
29
  "targetSdk": 34,
30
30
  "compileSdk": 34,
31
31
  "buildTools": "34.0.0",
32
- "sentiance": "6.9.1-rc2"
32
+ "sentiance": "6.10.0-rc1"
33
33
  },
34
34
  "ios": {
35
- "sentiance": "6.9.1-rc1"
35
+ "sentiance": "6.10.0-rc1"
36
36
  }
37
37
  }
38
38
  }