@sentiance-react-native/core 6.18.0-rc.2 → 6.18.0-rc.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.
@@ -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.18.0-rc.2"
8
+ s.version = "6.18.0-rc.3" # No need to maintain this version, as CI updates it during release builds.
9
9
  s.summary = "RNSentianceCore"
10
10
  s.description = <<-DESC
11
11
  RNSentianceCore
@@ -0,0 +1,18 @@
1
+ //
2
+ // CoreConverter.swift
3
+ // RNSentianceCore
4
+ //
5
+ // Created by Mohammed Aouf Zouag on 22/09/2025.
6
+ //
7
+
8
+ import Foundation
9
+ import SENTSDK
10
+
11
+ @objc(SENTSwiftCoreConverter)
12
+ @objcMembers
13
+ public class CoreConverter: NSObject {
14
+
15
+ public func waypointToDict(waypoint: SENTWaypoint) -> [String: Any] {
16
+ return waypoint.sentiance.asDictionary()
17
+ }
18
+ }
@@ -0,0 +1,69 @@
1
+ //
2
+ // CoreExtensions.swift
3
+ // RNSentianceCore
4
+ //
5
+ // Created by Mohammed Aouf Zouag on 22/09/2025.
6
+ //
7
+
8
+ import SENTSDK
9
+
10
+ extension SENTSDK.SENTWaypoint: SentianceNamespaceWrappable {}
11
+ extension SENTSDK.SENTDate: SentianceNamespaceWrappable {}
12
+ extension TimeInterval: SentianceNamespaceWrappable {}
13
+
14
+ public protocol SentianceNamespaceWrappable {
15
+ associatedtype T
16
+ var sentiance: T { get }
17
+ }
18
+
19
+ extension SentianceNamespaceWrappable {
20
+ public var sentiance: SentianceTypeWrapper<Self> {
21
+ return SentianceTypeWrapper(value: self)
22
+ }
23
+ }
24
+
25
+ public struct SentianceTypeWrapper<T> {
26
+ public var value: T
27
+ init(value: T) {
28
+ self.value = value
29
+ }
30
+ }
31
+
32
+ extension SentianceTypeWrapper where T == TimeInterval {
33
+ /// Milliseconds since Unix epoch, truncating sub-millisecond fraction.
34
+ public var millisecondsSince1970: Int64 {
35
+ return Int64(value * 1_000)
36
+ }
37
+ }
38
+
39
+ extension SentianceTypeWrapper where T == SENTDate {
40
+ public var millisecondsSince1970: Int64 {
41
+ return value.timeIntervalSince1970.sentiance.millisecondsSince1970
42
+ }
43
+ }
44
+
45
+ extension SentianceTypeWrapper where T == SENTSDK.SENTWaypoint {
46
+ public func asDictionary() -> [String: Any] {
47
+ var dict: [String: Any] = [
48
+ "latitude": value.latitude,
49
+ "longitude": value.longitude,
50
+ "accuracy": value.accuracyInMeters,
51
+ "timestamp": value.timestamp.sentiance.millisecondsSince1970,
52
+ "isSpeedLimitInfoSet": value.isSpeedLimitInfoSet,
53
+ "hasUnlimitedSpeedLimit": value.isSpeedLimitUnlimited,
54
+ "isSynthetic": value.isSynthetic,
55
+ ]
56
+
57
+ if value.isSpeedSet {
58
+ dict["speedInMps"] = value.speedInMps
59
+ }
60
+
61
+ if value.isSpeedLimitInfoSet && !value.isSpeedLimitUnlimited {
62
+ dict["speedLimitInMps"] = value.speedLimitInMps
63
+ } else if value.isSpeedLimitUnlimited {
64
+ dict["speedLimitInMps"] = Double.infinity
65
+ }
66
+
67
+ return dict
68
+ }
69
+ }
@@ -11,6 +11,7 @@ typedef NS_ENUM(NSInteger, UIBackgroundRefreshStatus);
11
11
 
12
12
  @interface RNSentianceCore (Converter)
13
13
 
14
+
14
15
  - (NSDictionary*) convertUserContextToDict:(SENTUserContext*) userContext;
15
16
  - (NSMutableArray*) convertUserContextCriteriaToArray:(SENTUserContextUpdateCriteria)criteriaMask;
16
17
  - (NSDictionary*) convertUserCreationResult:(SENTUserCreationResult*) userCreationResult;
@@ -7,6 +7,7 @@
7
7
  //
8
8
 
9
9
  #import "RNSentianceCore+Converter.h"
10
+ #import <RNSentianceCore-Swift.h>
10
11
  @import UIKit.UIApplication;
11
12
  @import CoreLocation;
12
13
 
@@ -15,6 +16,8 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
15
16
 
16
17
  @interface RNSentianceCore (Private)
17
18
 
19
+ @property (nonatomic, strong) SENTSwiftCoreConverter* swiftCoreConverter;
20
+
18
21
  - (NSString*)convertTimelineEventTypeToString:(SENTTimelineEventType)type;
19
22
  - (NSDictionary*)convertGeolocation:(SENTGeolocation*)location;
20
23
  - (NSDictionary*)convertCllocation:(CLLocation*)location;
@@ -290,32 +293,10 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
290
293
  }
291
294
  }
292
295
 
293
- - (NSDictionary*)convertWaypoint:(SENTWaypoint*)waypoint {
294
- NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
295
- dict[@"latitude"] = @(waypoint.latitude);
296
- dict[@"longitude"] = @(waypoint.longitude);
297
- dict[@"accuracy"] = @(waypoint.accuracyInMeters);
298
- dict[@"timestamp"] = @(waypoint.timestamp * 1000);
299
-
300
- if (waypoint.isSpeedSet) {
301
- dict[@"speedInMps"] = @(waypoint.speedInMps);
302
- }
303
- if (waypoint.isSpeedLimitInfoSet && !waypoint.isSpeedLimitUnlimited) {
304
- dict[@"speedLimitInMps"] = @(waypoint.speedLimitInMps);
305
- } else if (waypoint.isSpeedLimitUnlimited) {
306
- dict[@"speedLimitInMps"] = @(DBL_MAX);
307
- }
308
- dict[@"isSpeedLimitInfoSet"] = @(waypoint.isSpeedLimitInfoSet);
309
- dict[@"hasUnlimitedSpeedLimit"] = @(waypoint.isSpeedLimitUnlimited);
310
- dict[@"isSynthetic"] = @(waypoint.isSynthetic);
311
-
312
- return dict;
313
- }
314
-
315
296
  - (NSArray<NSDictionary *> *)convertWaypointArray:(NSArray<SENTWaypoint *> *)waypoints {
316
297
  NSMutableArray *array = [[NSMutableArray alloc] init];
317
298
  for (SENTWaypoint *waypoint in waypoints) {
318
- [array addObject:[self convertWaypoint:waypoint]];
299
+ [array addObject:[self.swiftCoreConverter waypointToDictWithWaypoint:waypoint]];
319
300
  }
320
301
  return array;
321
302
  }
@@ -1281,6 +1262,11 @@ static NSString * const SmartGeofencesErrorDomain = @"com.sentiance.SmartGeofenc
1281
1262
  safetyScoresDict[@"harshAccelerationScore"] = harshAccelerationScore;
1282
1263
  }
1283
1264
 
1265
+ NSNumber* wrongWayDrivingScore = drivingInsights.safetyScores.wrongWayDrivingScore;
1266
+ if (wrongWayDrivingScore != nil) {
1267
+ safetyScoresDict[@"wrongWayDrivingScore"] = wrongWayDrivingScore;
1268
+ }
1269
+
1284
1270
  dict[@"safetyScores"] = safetyScoresDict;
1285
1271
 
1286
1272
  return dict;
@@ -0,0 +1,4 @@
1
+ //
2
+ // Use this file to import your target's public headers that you would like to expose to Swift.
3
+ //
4
+
@@ -6,6 +6,7 @@
6
6
  #import "RNSentianceCore+Converter.h"
7
7
  #import "RNSentianceErrorCodes.h"
8
8
  #import "RNSentianceSubscriptionsManager.h"
9
+ #import <RNSentianceCore-Swift.h>
9
10
 
10
11
  #define REJECT_IF_SDK_NOT_INITIALIZED(reject) if ([self isSdkNotInitialized]) { \
11
12
  reject(ESDKNotInitialized, @"Sdk not initialized", nil); \
@@ -17,6 +18,7 @@ return; \
17
18
  @property (nonatomic, strong) void (^userLinkSuccess)(void);
18
19
  @property (nonatomic, strong) void (^userLinkFailed)(void);
19
20
  @property (nonatomic, strong) RNSentianceSubscriptionsManager* subscriptionsManager;
21
+ @property (nonatomic, strong) SENTSwiftCoreConverter* swiftCoreConverter;
20
22
  @property (nonatomic, strong) SENTUserLinker userLinker;
21
23
  @property (nonatomic, strong) SdkStatusHandler sdkStatusHandler;
22
24
  @property (assign) BOOL userLinkingEnabled;
@@ -85,6 +87,7 @@ RCT_EXPORT_MODULE(SentianceCore)
85
87
  {
86
88
  self = [super init];
87
89
  _subscriptionsManager = [RNSentianceSubscriptionsManager new];
90
+ _swiftCoreConverter = [SENTSwiftCoreConverter new];
88
91
  __weak typeof(self) weakSelf = self;
89
92
 
90
93
  [_subscriptionsManager addSupportedSubscriptionForEventType:TimelineUpdateEvent nativeSubscribeLogic:^{
@@ -11,6 +11,8 @@
11
11
  03AE2705282A80FE0085E48F /* RNSentianceErrorCodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 03AE26FF282A80FD0085E48F /* RNSentianceErrorCodes.m */; };
12
12
  03AE2706282A80FE0085E48F /* RNSentianceCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 03AE2701282A80FD0085E48F /* RNSentianceCore.m */; };
13
13
  03AE2707282A80FE0085E48F /* RNSentianceCore+Converter.m in Sources */ = {isa = PBXBuildFile; fileRef = 03AE2704282A80FD0085E48F /* RNSentianceCore+Converter.m */; };
14
+ 8DEFF39D2E8150B700C4A980 /* CoreConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DEFF39C2E8150B700C4A980 /* CoreConverter.swift */; };
15
+ 8DEFF39F2E8150C900C4A980 /* CoreExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DEFF39E2E8150C900C4A980 /* CoreExtensions.swift */; };
14
16
  9AE9AE342527BDFA0070A307 /* RNSentianceNativeInitialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AE9AE332527BDFA0070A307 /* RNSentianceNativeInitialization.m */; };
15
17
  DE07003329DC44B900C4FA5B /* RNSentianceSubscriptionDefinition.m in Sources */ = {isa = PBXBuildFile; fileRef = DE07002D29DC44B900C4FA5B /* RNSentianceSubscriptionDefinition.m */; };
16
18
  DE07003429DC44B900C4FA5B /* RNSentianceSubscription.m in Sources */ = {isa = PBXBuildFile; fileRef = DE07002F29DC44B900C4FA5B /* RNSentianceSubscription.m */; };
@@ -40,6 +42,9 @@
40
42
  03AE2704282A80FD0085E48F /* RNSentianceCore+Converter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNSentianceCore+Converter.m"; sourceTree = "<group>"; };
41
43
  134814201AA4EA6300B7C361 /* libRNSentianceCore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNSentianceCore.a; sourceTree = BUILT_PRODUCTS_DIR; };
42
44
  4C0B444329DD81A60094360E /* RNSentianceFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentianceFoundation.h; sourceTree = "<group>"; };
45
+ 8DEFF39B2E8150B700C4A980 /* RNSentianceCore-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentianceCore-Bridging-Header.h"; sourceTree = "<group>"; };
46
+ 8DEFF39C2E8150B700C4A980 /* CoreConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreConverter.swift; sourceTree = "<group>"; };
47
+ 8DEFF39E2E8150C900C4A980 /* CoreExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreExtensions.swift; sourceTree = "<group>"; };
43
48
  9AE9AE322527BDD90070A307 /* RNSentianceNativeInitialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentianceNativeInitialization.h; sourceTree = "<group>"; };
44
49
  9AE9AE332527BDFA0070A307 /* RNSentianceNativeInitialization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentianceNativeInitialization.m; sourceTree = "<group>"; };
45
50
  DE07002D29DC44B900C4FA5B /* RNSentianceSubscriptionDefinition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSentianceSubscriptionDefinition.m; sourceTree = "<group>"; };
@@ -72,6 +77,8 @@
72
77
  58B511D21A9E6C8500147676 = {
73
78
  isa = PBXGroup;
74
79
  children = (
80
+ 8DEFF39E2E8150C900C4A980 /* CoreExtensions.swift */,
81
+ 8DEFF39C2E8150B700C4A980 /* CoreConverter.swift */,
75
82
  4C0B444329DD81A60094360E /* RNSentianceFoundation.h */,
76
83
  03AE2702282A80FD0085E48F /* RNSentianceErrorCodes.h */,
77
84
  03AE26FF282A80FD0085E48F /* RNSentianceErrorCodes.m */,
@@ -90,6 +97,7 @@
90
97
  9AE9AE322527BDD90070A307 /* RNSentianceNativeInitialization.h */,
91
98
  9AE9AE332527BDFA0070A307 /* RNSentianceNativeInitialization.m */,
92
99
  134814211AA4EA7D00B7C361 /* Products */,
100
+ 8DEFF39B2E8150B700C4A980 /* RNSentianceCore-Bridging-Header.h */,
93
101
  );
94
102
  sourceTree = "<group>";
95
103
  };
@@ -124,6 +132,7 @@
124
132
  TargetAttributes = {
125
133
  58B511DA1A9E6C8500147676 = {
126
134
  CreatedOnToolsVersion = 6.1.1;
135
+ LastSwiftMigration = 1640;
127
136
  };
128
137
  };
129
138
  };
@@ -157,6 +166,8 @@
157
166
  03AE2706282A80FE0085E48F /* RNSentianceCore.m in Sources */,
158
167
  DE07003429DC44B900C4FA5B /* RNSentianceSubscription.m in Sources */,
159
168
  9AE9AE342527BDFA0070A307 /* RNSentianceNativeInitialization.m in Sources */,
169
+ 8DEFF39D2E8150B700C4A980 /* CoreConverter.swift in Sources */,
170
+ 8DEFF39F2E8150C900C4A980 /* CoreExtensions.swift in Sources */,
160
171
  03AE2705282A80FE0085E48F /* RNSentianceErrorCodes.m in Sources */,
161
172
  );
162
173
  runOnlyForDeploymentPostprocessing = 0;
@@ -248,6 +259,8 @@
248
259
  58B511F01A9E6C8500147676 /* Debug */ = {
249
260
  isa = XCBuildConfiguration;
250
261
  buildSettings = {
262
+ CLANG_ENABLE_MODULES = YES;
263
+ DEFINES_MODULE = NO;
251
264
  HEADER_SEARCH_PATHS = (
252
265
  "$(inherited)",
253
266
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -261,12 +274,17 @@
261
274
  );
262
275
  PRODUCT_NAME = RNSentianceCore;
263
276
  SKIP_INSTALL = YES;
277
+ SWIFT_OBJC_BRIDGING_HEADER = "RNSentianceCore-Bridging-Header.h";
278
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
279
+ SWIFT_VERSION = 6.0;
264
280
  };
265
281
  name = Debug;
266
282
  };
267
283
  58B511F11A9E6C8500147676 /* Release */ = {
268
284
  isa = XCBuildConfiguration;
269
285
  buildSettings = {
286
+ CLANG_ENABLE_MODULES = YES;
287
+ DEFINES_MODULE = NO;
270
288
  HEADER_SEARCH_PATHS = (
271
289
  "$(inherited)",
272
290
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -280,6 +298,8 @@
280
298
  );
281
299
  PRODUCT_NAME = RNSentianceCore;
282
300
  SKIP_INSTALL = YES;
301
+ SWIFT_OBJC_BRIDGING_HEADER = "RNSentianceCore-Bridging-Header.h";
302
+ SWIFT_VERSION = 6.0;
283
303
  };
284
304
  name = Release;
285
305
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.18.0-rc.2",
3
+ "version": "6.18.0-rc.3",
4
4
  "description": "The Sentiance Core library",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "sentiance": "6.18.0-rc2"
33
33
  },
34
34
  "ios": {
35
- "sentiance": "6.18.0-rc1"
35
+ "sentiance": "6.18.0-rc2"
36
36
  }
37
37
  }
38
38
  }