@sentiance-react-native/core 6.3.0 → 6.4.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.
|
@@ -51,5 +51,6 @@ typedef NS_ENUM(NSInteger, UIBackgroundRefreshStatus);
|
|
|
51
51
|
- (NSSet<NSNumber*> *)convertStringTransmittableDataTypes:(NSArray<NSString*>*)stringDataTypes;
|
|
52
52
|
- (NSDictionary *)convertDrivingInsights:(SENTDrivingInsights *)drivingInsights;
|
|
53
53
|
- (NSArray *)convertHarshDrivingEvents:(NSArray<SENTHarshDrivingEvent*> *)harshDrivingEvents;
|
|
54
|
+
- (NSArray *)convertPhoneUsageEvents:(NSArray<SENTPhoneUsageEvent*> *)phoneUsageEvents;
|
|
54
55
|
|
|
55
56
|
@end
|
|
@@ -1130,7 +1130,16 @@
|
|
|
1130
1130
|
[self addTransportEventInfoToDict:transportEventDict event:drivingInsights.transportEvent];
|
|
1131
1131
|
dict[@"transportEvent"] = transportEventDict;
|
|
1132
1132
|
|
|
1133
|
-
|
|
1133
|
+
NSNumber* smoothScore = drivingInsights.safetyScores.smoothScore;
|
|
1134
|
+
if (smoothScore != nil) {
|
|
1135
|
+
safetyScoresDict[@"smoothScore"] = smoothScore;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
NSNumber* focusScore = drivingInsights.safetyScores.focusScore;
|
|
1139
|
+
if (focusScore != nil) {
|
|
1140
|
+
safetyScoresDict[@"focusScore"] = focusScore;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1134
1143
|
dict[@"safetyScores"] = safetyScoresDict;
|
|
1135
1144
|
|
|
1136
1145
|
return dict;
|
|
@@ -1145,11 +1154,30 @@
|
|
|
1145
1154
|
}
|
|
1146
1155
|
|
|
1147
1156
|
- (NSDictionary<NSString *, NSNumber *> *)convertHarshDrivingEvent:(SENTHarshDrivingEvent *)harshDrivingEvent {
|
|
1148
|
-
NSMutableDictionary<NSString *, NSNumber *> *dict = [
|
|
1149
|
-
dict[@"time"] = [harshDrivingEvent.date description];
|
|
1150
|
-
dict[@"timeEpoch"] = @((long) (harshDrivingEvent.date.timeIntervalSince1970 * 1000));
|
|
1157
|
+
NSMutableDictionary<NSString *, NSNumber *> *dict = [self convertDrivingEvent:harshDrivingEvent];
|
|
1151
1158
|
dict[@"magnitude"] = @(harshDrivingEvent.magnitude);
|
|
1152
1159
|
return dict;
|
|
1153
1160
|
}
|
|
1154
1161
|
|
|
1162
|
+
- (NSArray<NSDictionary<NSString *, NSNumber *> *> *)convertPhoneUsageEvents:(NSArray<SENTPhoneUsageEvent*> *)phoneUsageEvents {
|
|
1163
|
+
NSMutableArray <NSDictionary<NSString *, NSNumber *> *> *array = [[NSMutableArray alloc] init];
|
|
1164
|
+
for (SENTPhoneUsageEvent *event in phoneUsageEvents) {
|
|
1165
|
+
[array addObject:[self convertPhoneUsage:event]];
|
|
1166
|
+
}
|
|
1167
|
+
return array;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
- (NSDictionary<NSString *, NSNumber *> *)convertPhoneUsageEvent:(SENTPhoneUsageEvent *)phoneUsageEvent {
|
|
1171
|
+
return [self convertDrivingEvent:phoneUsageEvent];
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
- (NSMutableDictionary<NSString *, NSNumber *> *)convertDrivingEvent:(SENTDrivingEvent *)drivingEvent {
|
|
1175
|
+
NSMutableDictionary<NSString *, NSNumber *> *dict = [[NSMutableDictionary alloc] init];
|
|
1176
|
+
dict[@"startTime"] = [drivingEvent.startDate description];
|
|
1177
|
+
dict[@"startTimeEpoch"] = @((long) (drivingEvent.startDate.timeIntervalSince1970 * 1000));
|
|
1178
|
+
dict[@"endTime"] = [drivingEvent.endDate description];
|
|
1179
|
+
dict[@"endTimeEpoch"] = @((long) (drivingEvent.endDate.timeIntervalSince1970 * 1000));
|
|
1180
|
+
return dict;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1155
1183
|
@end
|
package/ios/RNSentianceCore.m
CHANGED
|
@@ -1054,6 +1054,14 @@ RCT_EXPORT_METHOD(getHarshDrivingEvents:(NSString*)transportId resolver:(RCTProm
|
|
|
1054
1054
|
resolve([self convertHarshDrivingEvents:harshDrivingEvents]);
|
|
1055
1055
|
}
|
|
1056
1056
|
|
|
1057
|
+
RCT_EXPORT_METHOD(getPhoneUsageEvents:(NSString*)transportId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
1058
|
+
{
|
|
1059
|
+
REJECT_IF_SDK_NOT_INITIALIZED(reject);
|
|
1060
|
+
|
|
1061
|
+
NSArray<SENTPhoneUsageEvent *> *phoneUsageEvents = [[Sentiance sharedInstance] getPhoneUsageEventsForTransportId:transportId];
|
|
1062
|
+
resolve([self convertPhoneUsageEvents:phoneUsageEvents]);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1057
1065
|
RCT_EXPORT_METHOD(addNativeListener:(NSString *)eventName subscriptionId:(NSInteger)subscriptionId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
1058
1066
|
REJECT_IF_SDK_NOT_INITIALIZED(reject);
|
|
1059
1067
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentiance-react-native/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0-rc.1",
|
|
4
4
|
"description": "React Native Sentiance core library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"targetSdk": 31,
|
|
30
30
|
"compileSdk": 31,
|
|
31
31
|
"buildTools": "30.0.3",
|
|
32
|
-
"sentiance": "6.
|
|
32
|
+
"sentiance": "6.4.+"
|
|
33
33
|
},
|
|
34
34
|
"ios": {
|
|
35
|
-
"sentiance": "~> 6.
|
|
35
|
+
"sentiance": "~> 6.4.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|