react-native-move-sdk 2.14.5 → 2.16.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/android/build.gradle.kts +1 -1
- package/android/src/legacy/MoveSdkModule.kt +5 -0
- package/android/src/main/java/com/movesdk/NativeMoveSdkWrapper.kt +56 -3
- package/android/src/turbo/MoveSdkModule.kt +4 -0
- package/app.plugin.js +1 -0
- package/ios/MoveSdk.mm +26 -0
- package/ios/MoveSdk.swift +127 -48
- package/lib/commonjs/NativeMoveSdk.js.map +1 -1
- package/lib/commonjs/expo.js +138 -0
- package/lib/commonjs/expo.js.map +1 -0
- package/lib/commonjs/index.js +23 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeMoveSdk.js.map +1 -1
- package/lib/module/expo.js +133 -0
- package/lib/module/expo.js.map +1 -0
- package/lib/module/index.js +23 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeMoveSdk.d.ts +2 -1
- package/lib/typescript/commonjs/src/NativeMoveSdk.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo.d.ts +7 -0
- package/lib/typescript/commonjs/src/expo.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeMoveSdk.d.ts +2 -1
- package/lib/typescript/module/src/NativeMoveSdk.d.ts.map +1 -1
- package/lib/typescript/module/src/expo.d.ts +7 -0
- package/lib/typescript/module/src/expo.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/react-native-move-sdk.podspec +5 -1
- package/src/NativeMoveSdk.ts +5 -1
- package/src/expo.tsx +203 -0
- package/src/index.tsx +31 -18
package/android/build.gradle.kts
CHANGED
|
@@ -443,4 +443,9 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
|
|
|
443
443
|
nativeSdkWrapper.requestHealthPermissions(promise)
|
|
444
444
|
}
|
|
445
445
|
// endregion PERMISSIONS MODULE
|
|
446
|
+
|
|
447
|
+
@ReactMethod
|
|
448
|
+
fun getMoveConfig(promise: Promise?) {
|
|
449
|
+
nativeSdkWrapper.getMoveConfig(promise)
|
|
450
|
+
}
|
|
446
451
|
}
|
|
@@ -669,9 +669,25 @@ class NativeMoveSdkWrapper(private val context: Context) : MoveSdk.StateListener
|
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
override fun onConfigChanged(config: MoveConfig) {
|
|
672
|
-
val
|
|
673
|
-
|
|
674
|
-
|
|
672
|
+
val services = mutableListOf<String>()
|
|
673
|
+
for(s in config.moveDetectionServices) {
|
|
674
|
+
|
|
675
|
+
when(s) {
|
|
676
|
+
is MoveDetectionService.Driving -> {
|
|
677
|
+
services.add("DRIVING")
|
|
678
|
+
s.drivingServices?.map { it.name.toSnakeCase() }?.let(services::addAll)
|
|
679
|
+
}
|
|
680
|
+
is MoveDetectionService.Walking -> {
|
|
681
|
+
services.add("WALKING")
|
|
682
|
+
if(s.walkingServices?.contains(WalkingService.Location) ?: false) {
|
|
683
|
+
services.add("WALKING_LOCATION")
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
else -> services.add(s.name().toSnakeCase())
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
emitDeviceEvent(EVENT_MOVE_CONFIG_UPDATE, mutableMapOf(ARGUMENT_MOVE_SERVICES to services))
|
|
675
691
|
}
|
|
676
692
|
|
|
677
693
|
// TODO uncomment when will be fixed VIG1-1620
|
|
@@ -908,6 +924,43 @@ class NativeMoveSdkWrapper(private val context: Context) : MoveSdk.StateListener
|
|
|
908
924
|
"message" to message,
|
|
909
925
|
).toWritableMap()
|
|
910
926
|
}
|
|
927
|
+
|
|
928
|
+
fun getMoveConfig(promise: Promise?) {
|
|
929
|
+
if(promise == null) return
|
|
930
|
+
|
|
931
|
+
val sdk = MoveSdk.get()
|
|
932
|
+
if(sdk == null) {
|
|
933
|
+
promise.reject(IllegalStateException("move sdk not available"))
|
|
934
|
+
return
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
val config = sdk.getMoveConfig()
|
|
938
|
+
val map = mutableMapOf<String, Any>()
|
|
939
|
+
val detectionServices = config.moveDetectionServices
|
|
940
|
+
|
|
941
|
+
val timelineDetectionServices = mutableListOf<String>()
|
|
942
|
+
val drivingServices = mutableListOf<String>()
|
|
943
|
+
val walkingServices = mutableListOf<String>()
|
|
944
|
+
|
|
945
|
+
for(svc in detectionServices) {
|
|
946
|
+
when (svc) {
|
|
947
|
+
is MoveDetectionService.Driving -> {
|
|
948
|
+
drivingServices.addAll(svc.drivingServices?.map { it.name.toSnakeCase() } ?: emptyList())
|
|
949
|
+
}
|
|
950
|
+
is MoveDetectionService.Walking -> {
|
|
951
|
+
walkingServices.addAll(svc.walkingServices?.map { it.name.toSnakeCase() } ?: emptyList())
|
|
952
|
+
}
|
|
953
|
+
else -> {}
|
|
954
|
+
}
|
|
955
|
+
timelineDetectionServices.add(svc.javaClass.simpleName.toSnakeCase())
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
map["timelineDetectionServices"] = timelineDetectionServices
|
|
959
|
+
map["drivingServices"] = drivingServices
|
|
960
|
+
map["walkingServices"] = walkingServices
|
|
961
|
+
|
|
962
|
+
promise.resolve(map.toWritableMap())
|
|
963
|
+
}
|
|
911
964
|
}
|
|
912
965
|
|
|
913
966
|
fun List<MoveServiceFailure>.failuresToArray(): Array<Any> {
|
|
@@ -419,4 +419,8 @@ class MoveSdkModule internal constructor(context: ReactApplicationContext) :
|
|
|
419
419
|
override fun requestHealthPermissions(promise: Promise?) {
|
|
420
420
|
nativeSdkWrapper.requestHealthPermissions(promise)
|
|
421
421
|
}
|
|
422
|
+
|
|
423
|
+
override fun getMoveConfig(promise: Promise?) {
|
|
424
|
+
nativeSdkWrapper.getMoveConfig(promise)
|
|
425
|
+
}
|
|
422
426
|
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./lib/commonjs/expo');
|
package/ios/MoveSdk.mm
CHANGED
|
@@ -38,6 +38,7 @@ NSArray* convertOptions(const JS::NativeMoveSdk::MoveSdkOptions& options) {
|
|
|
38
38
|
|
|
39
39
|
return opt;
|
|
40
40
|
}
|
|
41
|
+
|
|
41
42
|
#else
|
|
42
43
|
|
|
43
44
|
void convertBool(NSNumber *option, MoveSdkOptionKey key, NSMutableArray* output) {
|
|
@@ -145,6 +146,16 @@ RCT_EXPORT_MODULE()
|
|
|
145
146
|
[MoveSDKInstance.shared updateConfig: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
146
147
|
}
|
|
147
148
|
|
|
149
|
+
- (void)getMoveConfig:(RCTPromiseResolveBlock)resolve
|
|
150
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
151
|
+
id config = [MoveSDKInstance.shared getMoveConfig];
|
|
152
|
+
if(config) {
|
|
153
|
+
resolve(config);
|
|
154
|
+
} else {
|
|
155
|
+
reject(@"UNINITIALIZED", @"UNINITIALIZED", nil);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
148
159
|
- (void)setup:(JS::NativeMoveSdk::MoveSdkAuth &)auth
|
|
149
160
|
config:(JS::NativeMoveSdk::MoveSdkConfig &)config
|
|
150
161
|
options:(JS::NativeMoveSdk::MoveSdkOptions &)options
|
|
@@ -164,6 +175,8 @@ platformParams:(NSArray *)platformParams
|
|
|
164
175
|
id refreshToken = auth.refreshToken();
|
|
165
176
|
|
|
166
177
|
[MoveSDKInstance.shared setup: userId accessToken: accessToken refreshToken: refreshToken productId: projectId timelineDetectionServices: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
178
|
+
|
|
179
|
+
resolve(@YES);
|
|
167
180
|
}
|
|
168
181
|
|
|
169
182
|
- (void)setupWithCode:(NSString *)code
|
|
@@ -496,6 +509,8 @@ RCT_EXPORT_METHOD(setup: (NSDictionary *)auth
|
|
|
496
509
|
id refreshToken = auth[@"refreshToken"];
|
|
497
510
|
|
|
498
511
|
[MoveSDKInstance.shared setup: userId accessToken: accessToken refreshToken: refreshToken productId: projectId timelineDetectionServices: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
512
|
+
|
|
513
|
+
resolve(@YES);
|
|
499
514
|
}
|
|
500
515
|
|
|
501
516
|
RCT_EXPORT_METHOD(setupWithCode: (NSString *)code
|
|
@@ -532,6 +547,17 @@ RCT_EXPORT_METHOD(updateConfig: (NSDictionary *)config
|
|
|
532
547
|
[MoveSDKInstance.shared updateConfig: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
533
548
|
}
|
|
534
549
|
|
|
550
|
+
RCT_EXPORT_METHOD(getMoveConfig: (RCTPromiseResolveBlock)resolve
|
|
551
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
552
|
+
|
|
553
|
+
id config = [MoveSDKInstance.shared getMoveConfig];
|
|
554
|
+
if(config) {
|
|
555
|
+
resolve(config);
|
|
556
|
+
} else {
|
|
557
|
+
reject(@"UNINITIALIZED", @"UNINITIALIZED", nil);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
535
561
|
RCT_EXPORT_METHOD(getState: (RCTPromiseResolveBlock)resolve
|
|
536
562
|
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
537
563
|
|
package/ios/MoveSdk.swift
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import CoreMotion
|
|
2
2
|
import DolphinMoveSDK
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
#if canImport(DolphinMoveSDKHealth)
|
|
5
|
+
import DolphinMoveSDKHealth
|
|
6
|
+
#endif
|
|
4
7
|
|
|
5
8
|
/// Move SDK instance singleton delegate.
|
|
6
9
|
@objc public protocol MoveSDKDelegate {
|
|
@@ -176,9 +179,6 @@ import HealthKit
|
|
|
176
179
|
/// Pending events triggered before event observer registered.
|
|
177
180
|
private var pendingEvents: [Event: Any]
|
|
178
181
|
|
|
179
|
-
/// Healthstore to get permissions from.
|
|
180
|
-
lazy var healthStore = HKHealthStore()
|
|
181
|
-
|
|
182
182
|
/// Persisted trip metadata.
|
|
183
183
|
private var tripMetaData: [String: String] {
|
|
184
184
|
didSet {
|
|
@@ -390,52 +390,106 @@ import HealthKit
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
/// Serialize detection service.
|
|
393
|
-
/// -
|
|
394
|
-
///
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
case let .driving(sub):
|
|
400
|
-
var services: [String] = base || sub.isEmpty ? [ServiceName.driving.rawValue] : []
|
|
401
|
-
for subservice in sub {
|
|
402
|
-
switch subservice {
|
|
403
|
-
case .drivingBehavior:
|
|
404
|
-
services.append(ServiceName.drivingBehavior.rawValue)
|
|
405
|
-
case .distractionFreeDriving:
|
|
406
|
-
services.append(ServiceName.distractionFreeDriving.rawValue)
|
|
407
|
-
case .deviceDiscovery:
|
|
408
|
-
services.append(ServiceName.deviceDiscovery.rawValue)
|
|
409
|
-
default: break
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
return services
|
|
393
|
+
/// - Parameter detectionService: Detection service.
|
|
394
|
+
/// - Returns: Service name for wrapper.
|
|
395
|
+
fileprivate func convert(detectionService: DolphinMoveSDK.MoveConfig.DetectionService) -> String {
|
|
396
|
+
switch detectionService {
|
|
397
|
+
case .driving:
|
|
398
|
+
return ServiceName.driving.rawValue
|
|
413
399
|
case .cycling:
|
|
414
|
-
return
|
|
415
|
-
case
|
|
416
|
-
|
|
417
|
-
for subservice in sub {
|
|
418
|
-
switch subservice {
|
|
419
|
-
case .location:
|
|
420
|
-
services.append(ServiceName.walkingLocation.rawValue)
|
|
421
|
-
default: break
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
return services
|
|
400
|
+
return ServiceName.cycling.rawValue
|
|
401
|
+
case .walking:
|
|
402
|
+
return ServiceName.walking.rawValue
|
|
425
403
|
case .places:
|
|
426
|
-
return
|
|
404
|
+
return ServiceName.places.rawValue
|
|
427
405
|
case .publicTransport:
|
|
428
|
-
return
|
|
406
|
+
return ServiceName.publicTransport.rawValue
|
|
429
407
|
case .pointsOfInterest:
|
|
430
|
-
return
|
|
408
|
+
return ServiceName.pointsOfInterest.rawValue
|
|
431
409
|
case .automaticImpactDetection:
|
|
432
|
-
return
|
|
410
|
+
return ServiceName.automaticImpactDetection.rawValue
|
|
433
411
|
case .assistanceCall:
|
|
434
|
-
return
|
|
412
|
+
return ServiceName.assistanceCall.rawValue
|
|
435
413
|
case .health:
|
|
436
|
-
return
|
|
414
|
+
return ServiceName.health.rawValue
|
|
415
|
+
@unknown default:
|
|
416
|
+
return detectionService.debugDescription
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/// Serialize walking service.
|
|
421
|
+
/// - Parameter walkingService: Walking subservice.
|
|
422
|
+
/// - Returns: Walking service name for wrapper.
|
|
423
|
+
fileprivate func convert(walkingService: DolphinMoveSDK.MoveConfig.WalkingService) -> String {
|
|
424
|
+
switch walkingService {
|
|
425
|
+
case .location:
|
|
426
|
+
return ServiceName.walkingLocation.rawValue
|
|
437
427
|
@unknown default:
|
|
438
|
-
return
|
|
428
|
+
return walkingService.debugDescription
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/// Serialize driving service.
|
|
433
|
+
/// - Parameter drivingService: Driving subservice.
|
|
434
|
+
/// - Returns: Driving service name for wrapper.
|
|
435
|
+
fileprivate func convert(drivingService: DolphinMoveSDK.MoveConfig.DrivingService) -> String {
|
|
436
|
+
switch drivingService {
|
|
437
|
+
case .drivingBehavior:
|
|
438
|
+
return ServiceName.drivingBehavior.rawValue
|
|
439
|
+
case .distractionFreeDriving:
|
|
440
|
+
return ServiceName.distractionFreeDriving.rawValue
|
|
441
|
+
case .deviceDiscovery:
|
|
442
|
+
return ServiceName.deviceDiscovery.rawValue
|
|
443
|
+
@unknown default:
|
|
444
|
+
return drivingService.debugDescription
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/// Serialize config object.
|
|
449
|
+
/// - Parameter config: MoveConfig to convert.
|
|
450
|
+
/// - Returns: Wrapper compatible json object.
|
|
451
|
+
fileprivate func convert(config: DolphinMoveSDK.MoveConfig) -> [String: [String]] {
|
|
452
|
+
var timelineDetectionServices: [String] = []
|
|
453
|
+
var drivingServices: [String] = []
|
|
454
|
+
var walkingServices: [String] = []
|
|
455
|
+
|
|
456
|
+
for service in config.services {
|
|
457
|
+
switch service {
|
|
458
|
+
case let .driving(subs):
|
|
459
|
+
drivingServices = subs.map { convert(drivingService: $0) }
|
|
460
|
+
case let .walking(subs):
|
|
461
|
+
walkingServices = subs.map { convert(walkingService: $0) }
|
|
462
|
+
default:
|
|
463
|
+
break
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
timelineDetectionServices = config.services.map { convert(detectionService: $0) }
|
|
468
|
+
|
|
469
|
+
return [
|
|
470
|
+
"timelineDetectionServices": timelineDetectionServices,
|
|
471
|
+
"drivingServices": drivingServices,
|
|
472
|
+
"walkingServices": walkingServices
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/// Serialize detection service.
|
|
477
|
+
/// - Parameters:
|
|
478
|
+
/// - service: Move service to be serialized.
|
|
479
|
+
///
|
|
480
|
+
/// - Returns: List of one or more service strings for service and subservices.
|
|
481
|
+
fileprivate func convert(service: DolphinMoveSDK.MoveConfig.DetectionService, base: Bool = false) -> [String] {
|
|
482
|
+
switch service {
|
|
483
|
+
case let .driving(subs):
|
|
484
|
+
var services: [String] = base || subs.isEmpty ? [ServiceName.driving.rawValue] : []
|
|
485
|
+
services += subs.map { convert(drivingService: $0) }
|
|
486
|
+
return services
|
|
487
|
+
case let .walking(subs):
|
|
488
|
+
var services: [String] = base || subs.isEmpty ? [ServiceName.walking.rawValue] : []
|
|
489
|
+
services += subs.map { convert(walkingService: $0) }
|
|
490
|
+
return services
|
|
491
|
+
default:
|
|
492
|
+
return [convert(detectionService: service)]
|
|
439
493
|
}
|
|
440
494
|
}
|
|
441
495
|
|
|
@@ -501,7 +555,6 @@ import HealthKit
|
|
|
501
555
|
return devices.compactMap { values in
|
|
502
556
|
guard let values = values as? [String: String] else { return nil }
|
|
503
557
|
let encoded: String = values["data"] ?? ""
|
|
504
|
-
|
|
505
558
|
let decoder = JSONDecoder()
|
|
506
559
|
guard let data = encoded.data(using: .utf8) else { return nil }
|
|
507
560
|
do {
|
|
@@ -509,6 +562,10 @@ import HealthKit
|
|
|
509
562
|
/* keep device name from info */
|
|
510
563
|
return device
|
|
511
564
|
} catch {
|
|
565
|
+
if let info = try? decoder.decode([String:String].self, from: data),
|
|
566
|
+
let uuid = UUID(uuidString: info["uuid"] ?? "") {
|
|
567
|
+
return MoveDevice(proximityUUID: uuid)
|
|
568
|
+
}
|
|
512
569
|
return nil
|
|
513
570
|
}
|
|
514
571
|
}
|
|
@@ -591,7 +648,13 @@ import HealthKit
|
|
|
591
648
|
case .bluetoothScan:
|
|
592
649
|
return "BLUETOOTH_PERMISSION_MISSING"
|
|
593
650
|
case .steps:
|
|
594
|
-
return "
|
|
651
|
+
return "HEALTHKIT_NO_STEPS_DETECTED"
|
|
652
|
+
case .health:
|
|
653
|
+
return "HEALTH_DEPENDENCY_MISSING"
|
|
654
|
+
case .magnetometer:
|
|
655
|
+
return "MAGNETOMETER_MISSING"
|
|
656
|
+
case .notifications:
|
|
657
|
+
return "NOTIFICATIONS_MISSING"
|
|
595
658
|
@unknown default:
|
|
596
659
|
return "UNKNOWN"
|
|
597
660
|
}
|
|
@@ -627,6 +690,10 @@ extension MoveSDKInstance: MoveSdkDeviceScannerDelegate {
|
|
|
627
690
|
|
|
628
691
|
/// Global initialization function.
|
|
629
692
|
func initialize() {
|
|
693
|
+
#if canImport(DolphinMoveSDKHealth)
|
|
694
|
+
print("import DolphinMoveSDKHealth")
|
|
695
|
+
sdk.enable(healthKit: MoveSDKHealth.shared)
|
|
696
|
+
#endif
|
|
630
697
|
sdk.initialize(launchOptions: nil)
|
|
631
698
|
}
|
|
632
699
|
|
|
@@ -726,6 +793,15 @@ extension MoveSDKInstance: MoveSdkDeviceScannerDelegate {
|
|
|
726
793
|
let moveOptions = convert(options: options)
|
|
727
794
|
sdk.update(config: sdkConfig, options: moveOptions)
|
|
728
795
|
}
|
|
796
|
+
|
|
797
|
+
/// Wrapper for `MoveSDK.getMoveConfig()`.
|
|
798
|
+
/// - Returns: MoveSdkConfig wrapper object.
|
|
799
|
+
func getMoveConfig() -> Dictionary<String, Array<String>>? {
|
|
800
|
+
guard let config = sdk.getMoveConfig() else {
|
|
801
|
+
return nil
|
|
802
|
+
}
|
|
803
|
+
return self.convert(config: config)
|
|
804
|
+
}
|
|
729
805
|
|
|
730
806
|
/// Wrapper for `MoveSDK.shutDown()`.
|
|
731
807
|
/// - Parameters:
|
|
@@ -855,6 +931,7 @@ extension MoveSDKInstance: MoveSdkDeviceScannerDelegate {
|
|
|
855
931
|
/// - Parameters:
|
|
856
932
|
/// - callback: Error callback.
|
|
857
933
|
func synchronizeUserData(_ callback: @escaping(Bool) -> Void) {
|
|
934
|
+
sdk.fetchUserConfig()
|
|
858
935
|
sdk.synchronizeUserData() { success in
|
|
859
936
|
callback(success)
|
|
860
937
|
}
|
|
@@ -879,15 +956,17 @@ extension MoveSDKInstance: MoveSdkDeviceScannerDelegate {
|
|
|
879
956
|
}
|
|
880
957
|
|
|
881
958
|
func requestHealthPermissions(_ callback: @escaping([String: String])->Void) {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
healthStore.requestAuthorization(toShare: [], read: [stepCountSampleType]) { (success, error) in
|
|
959
|
+
#if canImport(DolphinMoveSDKHealth)
|
|
960
|
+
MoveSDKHealth.shared.requestStepsPermission { error in
|
|
885
961
|
if let error {
|
|
886
962
|
callback(["technicalMessage":"error", "message":"\(error.localizedDescription)"])
|
|
887
|
-
} else
|
|
963
|
+
} else {
|
|
888
964
|
callback(["technicalMessage":"permission_result", "message":"true"])
|
|
889
965
|
}
|
|
890
966
|
}
|
|
967
|
+
#else
|
|
968
|
+
callback(["technicalMessage":"error", "message":"missing framework 'DolphinMoveSDKHealth'"])
|
|
969
|
+
#endif
|
|
891
970
|
}
|
|
892
971
|
|
|
893
972
|
/// Request bluetooth permission.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeMoveSdk.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeMoveSdk.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAoEC;AAKA;AAMA;AAOA;AAMA;AAIA;AAMA;AAKA;AAMA;AAKA;AAIA;AAIA;AAIA;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA4GaC,gCAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
+
var _generateCode = require("@expo/config-plugins/build/utils/generateCode");
|
|
9
|
+
var fs = _interopRequireWildcard(require("fs/promises"));
|
|
10
|
+
var path = _interopRequireWildcard(require("path"));
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
function withMoveAndroidMainApplication(config) {
|
|
13
|
+
return (0, _configPlugins.withMainApplication)(config, cfg => {
|
|
14
|
+
const {
|
|
15
|
+
modResults
|
|
16
|
+
} = cfg;
|
|
17
|
+
const {
|
|
18
|
+
contents
|
|
19
|
+
} = modResults;
|
|
20
|
+
const lines = contents.split('\n');
|
|
21
|
+
const importIndex = lines.findIndex(line => /^package/.test(line));
|
|
22
|
+
if (importIndex !== -1) {
|
|
23
|
+
// Replace 'in' with '`in`' in the package name
|
|
24
|
+
lines[importIndex] = lines[importIndex].replace('package in', 'package `in`');
|
|
25
|
+
}
|
|
26
|
+
const mainApplicationIndex = lines.findIndex(line => /^class MainApplication : Application\(\), ReactApplication {$/.test(line));
|
|
27
|
+
const onCreateIndex = lines.findIndex(line => /super.onCreate\(\)/.test(line));
|
|
28
|
+
modResults.contents = [...lines.slice(0, importIndex + 1), `import com.movesdk.NativeMoveSdkWrapper`, ...lines.slice(importIndex + 1, mainApplicationIndex + 1), ` private lateinit var sdkWrapper: NativeMoveSdkWrapper`, ...lines.slice(mainApplicationIndex + 1, onCreateIndex + 1), ` sdkWrapper = NativeMoveSdkWrapper.getInstance(this)`, ` sdkWrapper.init(this)`, ...lines.slice(onCreateIndex + 1)].join('\n');
|
|
29
|
+
return cfg;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function withMoveAndroidProjectBuildGradle(config) {
|
|
33
|
+
return (0, _configPlugins.withProjectBuildGradle)(config, cfg => {
|
|
34
|
+
const {
|
|
35
|
+
modResults
|
|
36
|
+
} = cfg;
|
|
37
|
+
const {
|
|
38
|
+
contents
|
|
39
|
+
} = modResults;
|
|
40
|
+
const lines = contents.split('\n');
|
|
41
|
+
const mavenIndex = lines.lastIndexOf('allprojects {') + 1;
|
|
42
|
+
modResults.contents = [...lines.slice(0, mavenIndex + 1), ` maven {`, ` url "https://dolphin.jfrog.io/artifactory/move-sdk-libs-release"`, ` content {`, ` includeGroup "io.dolphin.move"`, ` }`, ` }`, ...lines.slice(mavenIndex + 1)].join('\n');
|
|
43
|
+
return cfg;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function withMoveAndroidHealth(config) {
|
|
47
|
+
config = (0, _configPlugins.withMainActivity)(config, async cfg => {
|
|
48
|
+
const mainActivity = cfg.modResults;
|
|
49
|
+
const importStatement = 'import com.movesdk.NativeMoveSdkWrapper';
|
|
50
|
+
if (!mainActivity.contents.includes(importStatement)) {
|
|
51
|
+
mainActivity.contents = mainActivity.contents.replace(/import android.os.Bundle/, `import android.os.Bundle\n${importStatement}`);
|
|
52
|
+
}
|
|
53
|
+
const codeToAdd = 'NativeMoveSdkWrapper.getInstance(this.applicationContext).registerRequestPermissionLauncher(this)';
|
|
54
|
+
if (!mainActivity.contents.includes(codeToAdd)) {
|
|
55
|
+
mainActivity.contents = mainActivity.contents.replace(/super\.onCreate\(null\)/, `${codeToAdd}\n super.onCreate(null)`);
|
|
56
|
+
}
|
|
57
|
+
return cfg;
|
|
58
|
+
});
|
|
59
|
+
config = (0, _configPlugins.withAndroidManifest)(config, async cfg => {
|
|
60
|
+
const mainApplication = _configPlugins.AndroidConfig.Manifest.getMainApplicationOrThrow(cfg.modResults);
|
|
61
|
+
const mainActivity = mainApplication.activity?.find(activity => activity.$['android:name'] === '.MainActivity');
|
|
62
|
+
if (mainActivity) {
|
|
63
|
+
if (!mainActivity['intent-filter']) {
|
|
64
|
+
mainActivity['intent-filter'] = [];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Add Health Connect permission rationale intent filter
|
|
68
|
+
mainActivity['intent-filter'].push({
|
|
69
|
+
action: [{
|
|
70
|
+
$: {
|
|
71
|
+
'android:name': 'androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE'
|
|
72
|
+
}
|
|
73
|
+
}],
|
|
74
|
+
category: [{
|
|
75
|
+
$: {
|
|
76
|
+
'android:name': 'android.intent.category.HEALTH_PERMISSIONS'
|
|
77
|
+
}
|
|
78
|
+
}]
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Add View Permission Usage intent filter
|
|
82
|
+
mainActivity['intent-filter'].push({
|
|
83
|
+
action: [{
|
|
84
|
+
$: {
|
|
85
|
+
'android:name': 'android.intent.action.VIEW_PERMISSION_USAGE'
|
|
86
|
+
}
|
|
87
|
+
}],
|
|
88
|
+
category: [{
|
|
89
|
+
$: {
|
|
90
|
+
'android:name': 'android.intent.category.HEALTH_PERMISSIONS'
|
|
91
|
+
}
|
|
92
|
+
}]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return cfg;
|
|
96
|
+
});
|
|
97
|
+
config = (0, _configPlugins.withAndroidManifest)(config, async cfg => {
|
|
98
|
+
const permissions = ['android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND', 'android.permission.health.READ_STEPS'];
|
|
99
|
+
cfg.modResults.manifest['uses-permission'] = [...(cfg.modResults.manifest['uses-permission'] || []), ...permissions.map(perm => ({
|
|
100
|
+
$: {
|
|
101
|
+
'android:name': perm
|
|
102
|
+
}
|
|
103
|
+
}))];
|
|
104
|
+
return cfg;
|
|
105
|
+
});
|
|
106
|
+
return config;
|
|
107
|
+
}
|
|
108
|
+
const withExtensions = (config, {
|
|
109
|
+
extensions = []
|
|
110
|
+
}) => (0, _configPlugins.withDangerousMod)(config, ['ios', async config => {
|
|
111
|
+
const file = path.join(config.modRequest.platformProjectRoot, 'Podfile');
|
|
112
|
+
const contents = await fs.readFile(file, 'utf8');
|
|
113
|
+
const withSetup = (0, _generateCode.mergeContents)({
|
|
114
|
+
tag: 'setup-move-sdk',
|
|
115
|
+
src: contents,
|
|
116
|
+
anchor: /^prepare_react_native_project!$/m,
|
|
117
|
+
newSrc: `ENV['DOLPHIN_MOVE_SDK_HEALTH'] = '${extensions.includes('Health') ? '1' : '0'}'`,
|
|
118
|
+
offset: 1,
|
|
119
|
+
comment: '#'
|
|
120
|
+
});
|
|
121
|
+
await fs.writeFile(file, withSetup.contents, 'utf-8');
|
|
122
|
+
return config;
|
|
123
|
+
}]);
|
|
124
|
+
const withMove = (config, {
|
|
125
|
+
extensions = []
|
|
126
|
+
}) => {
|
|
127
|
+
config = withExtensions(config, {
|
|
128
|
+
extensions
|
|
129
|
+
});
|
|
130
|
+
if (extensions.includes('Health')) {
|
|
131
|
+
config = withMoveAndroidHealth(config);
|
|
132
|
+
}
|
|
133
|
+
config = withMoveAndroidMainApplication(config);
|
|
134
|
+
config = withMoveAndroidProjectBuildGradle(config);
|
|
135
|
+
return config;
|
|
136
|
+
};
|
|
137
|
+
var _default = exports.default = (0, _configPlugins.createRunOncePlugin)(withMove, 'react-native-move-sdk');
|
|
138
|
+
//# sourceMappingURL=expo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_generateCode","fs","_interopRequireWildcard","path","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","withMoveAndroidMainApplication","config","withMainApplication","cfg","modResults","contents","lines","split","importIndex","findIndex","line","test","replace","mainApplicationIndex","onCreateIndex","slice","join","withMoveAndroidProjectBuildGradle","withProjectBuildGradle","mavenIndex","lastIndexOf","withMoveAndroidHealth","withMainActivity","mainActivity","importStatement","includes","codeToAdd","withAndroidManifest","mainApplication","AndroidConfig","Manifest","getMainApplicationOrThrow","activity","find","$","push","action","category","permissions","manifest","map","perm","withExtensions","extensions","withDangerousMod","file","modRequest","platformProjectRoot","readFile","withSetup","mergeContents","tag","src","anchor","newSrc","offset","comment","writeFile","withMove","_default","exports","createRunOncePlugin"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AqB,CAACpB,MAAM,CAAC;EACxC;EACAA,MAAM,GAAGD,8BAA8B,CAACC,MAAM,CAAC;EAC/CA,MAAM,GAAGgB,iCAAiC,CAAChB,MAAM,CAAC;EAClD,OAAOA,MAAM;AACf,CAAC;AAAC,IAAA0D,QAAA,GAAAC,OAAA,CAAArE,OAAA,GAEa,IAAAsE,kCAAmB,EAACH,QAAQ,EAAE,uBAAuB,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -75,7 +75,7 @@ class MoveSdk {
|
|
|
75
75
|
}
|
|
76
76
|
return await NativeMoveSdk.setup(auth,
|
|
77
77
|
// Config
|
|
78
|
-
config, options,
|
|
78
|
+
config, options ?? {},
|
|
79
79
|
// Platform config
|
|
80
80
|
platformParams);
|
|
81
81
|
}
|
|
@@ -96,12 +96,16 @@ class MoveSdk {
|
|
|
96
96
|
}
|
|
97
97
|
return await NativeMoveSdk.setupWithCode(code,
|
|
98
98
|
// Config
|
|
99
|
-
config, options,
|
|
99
|
+
config, options ?? {},
|
|
100
100
|
// Platform config
|
|
101
101
|
platformParams);
|
|
102
102
|
}
|
|
103
103
|
static allowMockLocations(allowMockLocations) {
|
|
104
|
-
|
|
104
|
+
if (isTurboModuleEnabled) {
|
|
105
|
+
NativeMoveSdk.allowMockLocations(allowMockLocations);
|
|
106
|
+
} else {
|
|
107
|
+
NativeMoveSdk.mockLocations(allowMockLocations);
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
static resolveError() {
|
|
107
111
|
NativeMoveSdk.resolveError();
|
|
@@ -237,6 +241,9 @@ class MoveSdk {
|
|
|
237
241
|
static async getDeviceQualifier() {
|
|
238
242
|
return NativeMoveSdk.getDeviceQualifier();
|
|
239
243
|
}
|
|
244
|
+
static async getMoveConfig() {
|
|
245
|
+
return await NativeMoveSdk.getMoveConfig();
|
|
246
|
+
}
|
|
240
247
|
static async geocode(latitude, longitude) {
|
|
241
248
|
return await NativeMoveSdk.geocode(latitude, longitude);
|
|
242
249
|
}
|
|
@@ -330,7 +337,7 @@ class MoveSdk {
|
|
|
330
337
|
return await NativeMoveSdk.startTrip(metadata);
|
|
331
338
|
}
|
|
332
339
|
static updateConfig(config, options) {
|
|
333
|
-
NativeMoveSdk.updateConfig(config, options);
|
|
340
|
+
NativeMoveSdk.updateConfig(config, options ?? {});
|
|
334
341
|
}
|
|
335
342
|
static setTripMetadata(metadata) {
|
|
336
343
|
NativeMoveSdk.setTripMetadata(metadata);
|
|
@@ -344,6 +351,18 @@ class MoveSdk {
|
|
|
344
351
|
static async requestHealthPermissions() {
|
|
345
352
|
return await NativeMoveSdk.requestHealthPermissions();
|
|
346
353
|
}
|
|
354
|
+
static beaconDevices(serviceUUID) {
|
|
355
|
+
const name = `Beacons ${serviceUUID}`;
|
|
356
|
+
return {
|
|
357
|
+
id: serviceUUID,
|
|
358
|
+
name: name,
|
|
359
|
+
data: JSON.stringify({
|
|
360
|
+
id: serviceUUID,
|
|
361
|
+
name: name,
|
|
362
|
+
uuid: serviceUUID
|
|
363
|
+
})
|
|
364
|
+
};
|
|
365
|
+
}
|
|
347
366
|
}
|
|
348
367
|
exports.default = MoveSdk;
|
|
349
368
|
//# sourceMappingURL=index.js.map
|