react-native-move-sdk 2.12.0 → 2.14.0-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.
- package/android/build.gradle.kts +42 -0
- package/android/gradle.properties +16 -6
- package/android/settings.gradle.kts +35 -0
- package/android/src/{main/java/in/dolph/move/sdk → legacy}/MoveSdkModule.kt +30 -195
- package/android/src/main/AndroidManifest.xml +1 -11
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/DeviceScanner.kt +19 -21
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/Mapper.kt +3 -2
- package/android/src/main/java/com/movesdk/MoveExtensions.kt +188 -0
- package/android/src/main/java/{in/dolph/move/sdk/MoveSdkRepository.kt → com/movesdk/MoveSdkConfigRepository.kt} +3 -1
- package/android/src/main/java/com/movesdk/MoveSdkPackage.kt +32 -0
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/NativeMoveSdkWrapper.kt +201 -61
- package/android/src/main/java/com/movesdk/extentions/ConnectionExt.kt +52 -0
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/extentions/PermissionUtils.kt +1 -1
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/extentions/SharedPreferencesExt.kt +1 -1
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/metadata/MetadataStorage.kt +1 -1
- package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/metadata/MetadataStorageImpl.kt +2 -2
- package/android/src/main/java/com/movesdk/shared/Constants.kt +39 -0
- package/android/src/turbo/MoveSdkModule.kt +422 -0
- package/ios/MoveSdk.h +13 -0
- package/ios/MoveSdk.mm +717 -0
- package/ios/MoveSdk.swift +1022 -0
- package/ios/{NativeModule/MoveSdkDeviceScanner.swift → MoveSdkDeviceScanner.swift} +1 -1
- package/lib/commonjs/NativeMoveSdk.js +21 -0
- package/lib/commonjs/NativeMoveSdk.js.map +1 -0
- package/lib/commonjs/components/LazyMoveSdk.js +22 -41
- package/lib/commonjs/components/LazyMoveSdk.js.map +1 -1
- package/lib/commonjs/index.js +331 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NativeMoveSdk.js +17 -0
- package/lib/module/NativeMoveSdk.js.map +1 -0
- package/lib/module/components/LazyMoveSdk.js +15 -20
- package/lib/module/components/LazyMoveSdk.js.map +1 -1
- package/lib/module/index.js +337 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/example/src/App.d.ts +2 -0
- package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeMoveSdk.d.ts +133 -0
- package/lib/typescript/commonjs/src/NativeMoveSdk.d.ts.map +1 -0
- package/lib/typescript/{components → commonjs/src/components}/LazyMoveSdk.d.ts +2 -1
- package/lib/typescript/commonjs/src/components/LazyMoveSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +84 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/example/src/App.d.ts +2 -0
- package/lib/typescript/module/example/src/App.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeMoveSdk.d.ts +133 -0
- package/lib/typescript/module/src/NativeMoveSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/components/LazyMoveSdk.d.ts +8 -0
- package/lib/typescript/module/src/components/LazyMoveSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +84 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +197 -138
- package/react-native-move-sdk.podspec +30 -9
- package/src/NativeMoveSdk.ts +227 -0
- package/src/components/LazyMoveSdk.tsx +2 -2
- package/src/{MoveSdk.ts → index.tsx} +131 -199
- package/android/.project +0 -17
- package/android/build.gradle +0 -153
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/android/gradlew +0 -183
- package/android/gradlew.bat +0 -100
- package/android/src/main/java/in/dolph/move/sdk/MoveExtensions.kt +0 -72
- package/android/src/main/java/in/dolph/move/sdk/MoveSdkPackage.kt +0 -19
- package/android/src/main/java/in/dolph/move/sdk/WrapperBtConnectionsReceiver.kt +0 -96
- package/android/src/main/res/drawable-anydpi-v24/ic_notification.xml +0 -13
- package/android/src/main/res/drawable-hdpi/ic_notification.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_notification.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_notification.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_notification.png +0 -0
- package/android/src/main/res/values/strings.xml +0 -9
- package/android/src/main/strings.xml +0 -0
- package/android/src/test/java/io/dolphin/move/MoveWrapperTest.kt +0 -190
- package/ios/MoveSdk-Bridging-Header.h +0 -3
- package/ios/MoveSdk.xcodeproj/project.pbxproj +0 -287
- package/ios/MoveSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
- package/ios/MoveSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/NativeModule/MoveSdk.h +0 -144
- package/ios/NativeModule/MoveSdk.swift +0 -1359
- package/lib/commonjs/MoveSdk.js +0 -443
- package/lib/commonjs/MoveSdk.js.map +0 -1
- package/lib/module/MoveSdk.js +0 -432
- package/lib/module/MoveSdk.js.map +0 -1
- package/lib/typescript/MoveSdk.d.ts +0 -158
- package/lib/typescript/index.d.ts +0 -3
- package/src/index.ts +0 -3
package/ios/MoveSdk.mm
ADDED
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
#import "MoveSdk.h"
|
|
2
|
+
#if __has_include("react_native_move_sdk-Swift.h")
|
|
3
|
+
#import "react_native_move_sdk-Swift.h"
|
|
4
|
+
#else
|
|
5
|
+
#import "react_native_move_sdk/react_native_move_sdk-Swift.h"
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
9
|
+
|
|
10
|
+
void convertBool(const std::optional<bool>& option, MoveSdkOptionKey key, NSMutableArray* output) {
|
|
11
|
+
if(option.has_value()) {
|
|
12
|
+
id opt = [[MoveSdkOption alloc] initWithKey: key value: [NSNumber numberWithBool: option.value()]];
|
|
13
|
+
[output addObject: opt];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void convertDouble(const std::optional<double>& option, MoveSdkOptionKey key, NSMutableArray* output) {
|
|
18
|
+
if(option.has_value()) {
|
|
19
|
+
id opt = [[MoveSdkOption alloc] initWithKey: key value: [NSNumber numberWithDouble: option.value()]];
|
|
20
|
+
[output addObject: opt];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
NSArray* convertOptions(const JS::NativeMoveSdk::MoveSdkOptions& options) {
|
|
25
|
+
|
|
26
|
+
NSMutableArray *opt = [NSMutableArray new];
|
|
27
|
+
|
|
28
|
+
convertBool(options.backgroundLocationPermissionMandatory(), MoveSdkOptionKeyBackgroundLocationPermissionMandatory, opt);
|
|
29
|
+
convertBool(options.motionPermissionMandatory(), MoveSdkOptionKeyMotionPermissionMandatory, opt);
|
|
30
|
+
convertBool(options.useBackendConfig(), MoveSdkOptionKeyUseBackendConfig, opt);
|
|
31
|
+
|
|
32
|
+
if(options.deviceDiscovery().has_value()) {
|
|
33
|
+
convertBool(options.deviceDiscovery().value().stopScanOnFirstDiscovered(), MoveSdkOptionKeyStopScanOnFirstDiscovered, opt);
|
|
34
|
+
convertDouble(options.deviceDiscovery().value().duration(), MoveSdkOptionKeyDuration, opt);
|
|
35
|
+
convertDouble(options.deviceDiscovery().value().interval(), MoveSdkOptionKeyInterval, opt);
|
|
36
|
+
convertDouble(options.deviceDiscovery().value().startDelay(), MoveSdkOptionKeyStartDelay, opt);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return opt;
|
|
40
|
+
}
|
|
41
|
+
#else
|
|
42
|
+
|
|
43
|
+
void convertBool(NSNumber *option, MoveSdkOptionKey key, NSMutableArray* output) {
|
|
44
|
+
if(option != nil) {
|
|
45
|
+
id opt = [[MoveSdkOption alloc] initWithKey: key value: [NSNumber numberWithBool: option.boolValue]];
|
|
46
|
+
[output addObject: opt];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void convertDouble(NSNumber *option, MoveSdkOptionKey key, NSMutableArray* output) {
|
|
51
|
+
if(option != nil) {
|
|
52
|
+
id opt = [[MoveSdkOption alloc] initWithKey: key value: [NSNumber numberWithDouble: option.doubleValue]];
|
|
53
|
+
[output addObject: opt];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
NSArray* convertOptions(NSDictionary* options) {
|
|
58
|
+
|
|
59
|
+
NSMutableArray *opt = [NSMutableArray new];
|
|
60
|
+
|
|
61
|
+
convertBool(options[@"backgroundLocationPermissionMandatory"], MoveSdkOptionKeyBackgroundLocationPermissionMandatory, opt);
|
|
62
|
+
convertBool(options[@"motionPermissionMandatory"], MoveSdkOptionKeyMotionPermissionMandatory, opt);
|
|
63
|
+
convertBool(options[@"useBackendConfig"], MoveSdkOptionKeyUseBackendConfig, opt);
|
|
64
|
+
|
|
65
|
+
NSDictionary *deviceDiscovery = options[@"deviceDiscovery"];
|
|
66
|
+
if(deviceDiscovery != nil) {
|
|
67
|
+
convertBool(deviceDiscovery[@"stopScanOnFirstDiscovered"], MoveSdkOptionKeyStopScanOnFirstDiscovered, opt);
|
|
68
|
+
convertDouble(deviceDiscovery[@"duration"], MoveSdkOptionKeyDuration, opt);
|
|
69
|
+
convertDouble(deviceDiscovery[@"interval"], MoveSdkOptionKeyInterval, opt);
|
|
70
|
+
convertDouble(deviceDiscovery[@"startDelay"], MoveSdkOptionKeyStartDelay, opt);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return opt;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
@interface MoveSdk() <MoveSDKDelegate> {}
|
|
79
|
+
@end
|
|
80
|
+
|
|
81
|
+
@implementation MoveSdk
|
|
82
|
+
RCT_EXPORT_MODULE()
|
|
83
|
+
|
|
84
|
+
+ (void)initialize {
|
|
85
|
+
|
|
86
|
+
[MoveSDKInstance.shared initialize];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (void)sendWithEvent:(NSString * _Nonnull)event
|
|
90
|
+
data:(id _Nonnull)data {
|
|
91
|
+
|
|
92
|
+
[self sendEventWithName:event body:data];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
96
|
+
|
|
97
|
+
return MoveSDKInstance.supportedEvents;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (void)startObserving {
|
|
101
|
+
|
|
102
|
+
MoveSDKInstance.shared.delegate = self;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
- (void)startNativeSdkStateListener {
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void)requestAppIgnoringBatteryOptimization {
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
- (void)requestHealthPermissions: (RCTPromiseResolveBlock)resolve
|
|
112
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
113
|
+
[MoveSDKInstance.shared requestHealthPermissions: ^(BOOL success, MoveSdkError * _Nullable error) {
|
|
114
|
+
if (error != nil) {
|
|
115
|
+
reject(error.title, error.text, nil);
|
|
116
|
+
} else {
|
|
117
|
+
resolve([NSNumber numberWithBool: success]);
|
|
118
|
+
}
|
|
119
|
+
}];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Don't compile this code when we build for the old architecture.
|
|
123
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
124
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
125
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
126
|
+
|
|
127
|
+
return std::make_shared<facebook::react::NativeMoveSdkSpecJSI>(params);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
- (void)updateAuth:(JS::NativeMoveSdk::MoveSdkAuth &)auth
|
|
131
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
132
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
133
|
+
|
|
134
|
+
id userId = auth.userId();
|
|
135
|
+
id accessToken = auth.accessToken();
|
|
136
|
+
double projectId = auth.projectId();
|
|
137
|
+
id refreshToken = auth.refreshToken();
|
|
138
|
+
|
|
139
|
+
[MoveSDKInstance.shared updateAuth: userId accessToken: accessToken refreshToken: refreshToken productId: projectId callback: ^(MoveSdkError * _Nullable error) {
|
|
140
|
+
if (error != nil) {
|
|
141
|
+
reject(error.title, error.text, nil);
|
|
142
|
+
} else {
|
|
143
|
+
resolve(@YES);
|
|
144
|
+
}
|
|
145
|
+
}];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
- (void)updateConfig:(JS::NativeMoveSdk::MoveSdkConfig &)config
|
|
149
|
+
options:(JS::NativeMoveSdk::MoveSdkOptions &)options {
|
|
150
|
+
|
|
151
|
+
id detectionServices = RCTConvertVecToArray(config.timelineDetectionServices());
|
|
152
|
+
id drivingServices = RCTConvertVecToArray(config.drivingServices());
|
|
153
|
+
id walkingServices = RCTConvertVecToArray(config.walkingServices());
|
|
154
|
+
id opt = convertOptions(options);
|
|
155
|
+
|
|
156
|
+
[MoveSDKInstance.shared updateConfig: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
- (void)setup:(JS::NativeMoveSdk::MoveSdkAuth &)auth
|
|
160
|
+
config:(JS::NativeMoveSdk::MoveSdkConfig &)config
|
|
161
|
+
options:(JS::NativeMoveSdk::MoveSdkOptions &)options
|
|
162
|
+
platformParams:(NSArray *)platformParams
|
|
163
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
164
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
165
|
+
|
|
166
|
+
id opt = convertOptions(options);
|
|
167
|
+
|
|
168
|
+
id detectionServices = RCTConvertVecToArray(config.timelineDetectionServices());
|
|
169
|
+
id drivingServices = RCTConvertVecToArray(config.drivingServices());
|
|
170
|
+
id walkingServices = RCTConvertVecToArray(config.walkingServices());
|
|
171
|
+
|
|
172
|
+
id userId = auth.userId();
|
|
173
|
+
id accessToken = auth.accessToken();
|
|
174
|
+
double projectId = auth.projectId();
|
|
175
|
+
id refreshToken = auth.refreshToken();
|
|
176
|
+
|
|
177
|
+
[MoveSDKInstance.shared setup: userId accessToken: accessToken refreshToken: refreshToken productId: projectId timelineDetectionServices: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
- (void)setupWithCode:(NSString *)code
|
|
181
|
+
config:(JS::NativeMoveSdk::MoveSdkConfig &)config
|
|
182
|
+
options:(JS::NativeMoveSdk::MoveSdkOptions &)options
|
|
183
|
+
platformParams:(NSArray *)platformParams
|
|
184
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
185
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
186
|
+
|
|
187
|
+
id opt = convertOptions(options);
|
|
188
|
+
|
|
189
|
+
id detectionServices = RCTConvertVecToArray(config.timelineDetectionServices());
|
|
190
|
+
id drivingServices = RCTConvertVecToArray(config.drivingServices());
|
|
191
|
+
id walkingServices = RCTConvertVecToArray(config.walkingServices());
|
|
192
|
+
|
|
193
|
+
[MoveSDKInstance.shared setup: code timelineDetectionServices: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt callback: ^(MoveSdkError * _Nullable error) {
|
|
194
|
+
if (error != nil) {
|
|
195
|
+
reject(error.title, error.text, nil);
|
|
196
|
+
} else {
|
|
197
|
+
resolve(@YES);
|
|
198
|
+
}
|
|
199
|
+
}];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
- (void)finishCurrentTrip {
|
|
203
|
+
|
|
204
|
+
[MoveSDKInstance.shared finishCurrentTrip];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
- (void)forceTripRecognition:(double)duration {
|
|
208
|
+
|
|
209
|
+
[MoveSDKInstance.shared forceTripRecognition];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
- (void)getBluetoothPermission:(RCTPromiseResolveBlock)resolve
|
|
213
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
214
|
+
|
|
215
|
+
[MoveSDKInstance.shared getBluetoothPermission:^(BOOL state) {
|
|
216
|
+
resolve(@(state));
|
|
217
|
+
}];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
- (void)getBluetoothState:(RCTPromiseResolveBlock)resolve
|
|
221
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
222
|
+
|
|
223
|
+
[MoveSDKInstance.shared getBluetoothState:^(BOOL state) {
|
|
224
|
+
resolve(@(state));
|
|
225
|
+
}];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
- (void)ignoreCurrentTrip {
|
|
229
|
+
|
|
230
|
+
[MoveSDKInstance.shared ignoreCurrentTrip];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
- (void)requestBluetoothAlwaysUsagePermission {
|
|
234
|
+
|
|
235
|
+
[MoveSDKInstance.shared requestBluetoothAlwaysUsagePermission];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
- (void)requestMotionPermission {
|
|
239
|
+
|
|
240
|
+
[MoveSDKInstance.shared requestMotionPermission];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
- (void)resolveError {
|
|
244
|
+
|
|
245
|
+
[MoveSDKInstance.shared resolveError];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
- (void)setAssistanceMetaData:(NSString *)data {
|
|
249
|
+
|
|
250
|
+
[MoveSDKInstance.shared setAssistanceMetaData: data];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
- (void)setTripMetadata:(NSDictionary *)metadata {
|
|
254
|
+
|
|
255
|
+
[MoveSDKInstance.shared setTripWithMetadata: metadata];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
- (void)startScanningDevices:(NSArray *)filter
|
|
259
|
+
uuid:(NSString *)uuid
|
|
260
|
+
manufacturerId:(NSNumber *)manufacturerId {
|
|
261
|
+
|
|
262
|
+
[MoveSDKInstance.shared startScanningDevices: filter uuid: uuid];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
- (void)stopScanningDevices {
|
|
266
|
+
|
|
267
|
+
[MoveSDKInstance.shared stopScanningDevices];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
- (void)getState:(RCTPromiseResolveBlock)resolve
|
|
271
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
272
|
+
|
|
273
|
+
resolve(MoveSDKInstance.shared.sdkState);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
- (void)getTripState:(RCTPromiseResolveBlock)resolve
|
|
277
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
278
|
+
|
|
279
|
+
resolve(MoveSDKInstance.shared.tripState);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
- (void)getAuthState:(RCTPromiseResolveBlock)resolve
|
|
283
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
284
|
+
|
|
285
|
+
resolve(MoveSDKInstance.shared.authState);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
- (void)getErrors:(RCTPromiseResolveBlock)resolve
|
|
289
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
290
|
+
|
|
291
|
+
resolve(MoveSDKInstance.shared.failures);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
- (void)getWarnings:(RCTPromiseResolveBlock)resolve
|
|
295
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
296
|
+
|
|
297
|
+
resolve(MoveSDKInstance.shared.warnings);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
- (void)shutdown:(BOOL)force
|
|
301
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
302
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
303
|
+
|
|
304
|
+
[MoveSDKInstance.shared shutdown: force callback:^(MoveSdkError * _Nullable error) {
|
|
305
|
+
if (error != nil) {
|
|
306
|
+
resolve(error.title);
|
|
307
|
+
} else {
|
|
308
|
+
resolve(@"SUCCESS");
|
|
309
|
+
}
|
|
310
|
+
}];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
- (void)geocode:(double)latitude
|
|
314
|
+
longitude:(double)longitude
|
|
315
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
316
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
317
|
+
|
|
318
|
+
[MoveSDKInstance.shared geocodeWithLatitude: latitude longitude: longitude callback:
|
|
319
|
+
^(NSString * _Nullable result, MoveSdkError * _Nullable error) {
|
|
320
|
+
if (error != nil) {
|
|
321
|
+
resolve(error);
|
|
322
|
+
} else {
|
|
323
|
+
resolve(result);
|
|
324
|
+
}
|
|
325
|
+
}];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
- (void)getDeviceQualifier:(RCTPromiseResolveBlock)resolve
|
|
329
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
330
|
+
|
|
331
|
+
resolve([MoveSDKInstance.shared getDeviceQualifier]);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
- (void)getRegisteredDevices:(RCTPromiseResolveBlock)resolve
|
|
335
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
336
|
+
|
|
337
|
+
NSArray *devices = [MoveSDKInstance.shared getRegisteredDevices];
|
|
338
|
+
resolve(devices);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
- (void)initiateAssistanceCall:(RCTPromiseResolveBlock)resolve
|
|
342
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
343
|
+
|
|
344
|
+
[MoveSDKInstance.shared initiateAssistanceCallWithCallback: ^(MoveSdkError * _Nullable error) {
|
|
345
|
+
if (error != nil) {
|
|
346
|
+
reject(error.title, error.text, nil);
|
|
347
|
+
} else {
|
|
348
|
+
resolve(@YES);
|
|
349
|
+
}
|
|
350
|
+
}];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
- (void)isAuthValid:(RCTPromiseResolveBlock)resolve
|
|
354
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
355
|
+
|
|
356
|
+
BOOL valid = [MoveSDKInstance.shared isAuthValid];
|
|
357
|
+
resolve(@(valid));
|
|
358
|
+
}
|
|
359
|
+
- (void)registerDevices:(NSArray *)devices
|
|
360
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
361
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
362
|
+
|
|
363
|
+
[MoveSDKInstance.shared registerDevices: devices];
|
|
364
|
+
resolve(@YES);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
- (void)setLiveLocationTag:(NSString *)tag
|
|
368
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
369
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
370
|
+
|
|
371
|
+
BOOL success = [MoveSDKInstance.shared setLiveLocationTag: tag];
|
|
372
|
+
resolve(@(success));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
- (void)startAutomaticDetection:(RCTPromiseResolveBlock)resolve
|
|
376
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
377
|
+
|
|
378
|
+
BOOL success = [MoveSDKInstance.shared startAutomaticDetection];
|
|
379
|
+
resolve(@(success));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
- (void)startTrip:(NSDictionary *)metadata
|
|
383
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
384
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
385
|
+
|
|
386
|
+
BOOL success = [MoveSDKInstance.shared startTrip: metadata];
|
|
387
|
+
resolve(@(success));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
- (void)stopAutomaticDetection:(RCTPromiseResolveBlock)resolve
|
|
392
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
393
|
+
|
|
394
|
+
BOOL success = [MoveSDKInstance.shared stopAutomaticDetection];
|
|
395
|
+
resolve(@(success));
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
- (void)synchronizeUserData:(RCTPromiseResolveBlock)resolve
|
|
400
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
401
|
+
|
|
402
|
+
[MoveSDKInstance.shared synchronizeUserData:^(BOOL success) {
|
|
403
|
+
resolve(@(success));
|
|
404
|
+
}];
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
- (void)unregisterDevices:(NSArray *)devices
|
|
408
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
409
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
410
|
+
|
|
411
|
+
[MoveSDKInstance.shared unregisterDevices: devices];
|
|
412
|
+
resolve(@YES);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Android only */
|
|
416
|
+
|
|
417
|
+
- (void)cancelTimer:(NSString *)key {}
|
|
418
|
+
|
|
419
|
+
- (void)canDrawOverlays:(RCTPromiseResolveBlock)resolve
|
|
420
|
+
reject:(RCTPromiseRejectBlock)reject {}
|
|
421
|
+
|
|
422
|
+
- (void)isAppIgnoringBatteryOptimization:(RCTPromiseResolveBlock)resolve
|
|
423
|
+
reject:(RCTPromiseRejectBlock)reject {}
|
|
424
|
+
|
|
425
|
+
- (void)keepActive:(BOOL)enabled {}
|
|
426
|
+
|
|
427
|
+
- (void)keepInForeground:(BOOL)enabled {}
|
|
428
|
+
|
|
429
|
+
- (void)mockLocations:(BOOL)allow {}
|
|
430
|
+
|
|
431
|
+
- (void)requestDrawOverlaysPermission {}
|
|
432
|
+
|
|
433
|
+
- (void)setTimer:(RCTResponseSenderBlock)callback
|
|
434
|
+
delay:(double)delay {}
|
|
435
|
+
|
|
436
|
+
#else
|
|
437
|
+
|
|
438
|
+
RCT_EXPORT_METHOD(setAssistanceMetaData: (NSString *) metadata) {
|
|
439
|
+
|
|
440
|
+
[MoveSDKInstance.shared setAssistanceMetaData: metadata];
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
RCT_EXPORT_METHOD(setTripMetadata: (id) metadata) {
|
|
444
|
+
|
|
445
|
+
[MoveSDKInstance.shared setTripWithMetadata: metadata];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
RCT_EXPORT_METHOD(forceTripRecognition: (id)value) {
|
|
449
|
+
|
|
450
|
+
[MoveSDKInstance.shared forceTripRecognition];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
RCT_EXPORT_METHOD(ignoreCurrentTrip) {
|
|
454
|
+
|
|
455
|
+
[MoveSDKInstance.shared ignoreCurrentTrip];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
RCT_EXPORT_METHOD(finishCurrentTrip) {
|
|
459
|
+
|
|
460
|
+
[MoveSDKInstance.shared finishCurrentTrip];
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
RCT_EXPORT_METHOD(stopScanningDevices) {
|
|
464
|
+
|
|
465
|
+
[MoveSDKInstance.shared stopScanningDevices];
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
RCT_EXPORT_METHOD(resolveError) {
|
|
469
|
+
|
|
470
|
+
[MoveSDKInstance.shared resolveError];
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
RCT_EXPORT_METHOD(requestMotionPermission) {
|
|
474
|
+
|
|
475
|
+
[MoveSDKInstance.shared requestMotionPermission];
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
RCT_EXPORT_METHOD(requestBluetoothAlwaysUsagePermission) {
|
|
479
|
+
|
|
480
|
+
[MoveSDKInstance.shared requestBluetoothAlwaysUsagePermission];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
RCT_EXPORT_METHOD(setup: (NSDictionary *)auth
|
|
484
|
+
config: (NSDictionary *)config
|
|
485
|
+
options: (NSDictionary *)options
|
|
486
|
+
platformParams:(NSArray *)platformParams
|
|
487
|
+
resolve: (RCTPromiseResolveBlock)resolve
|
|
488
|
+
reject: (RCTPromiseRejectBlock)reject) {
|
|
489
|
+
|
|
490
|
+
id opt = convertOptions(options);
|
|
491
|
+
|
|
492
|
+
id detectionServices = config[@"timelineDetectionServices"];
|
|
493
|
+
id drivingServices = config[@"drivingServices"];
|
|
494
|
+
id walkingServices = config[@"walkingServices"];
|
|
495
|
+
|
|
496
|
+
id userId = auth[@"userId"];
|
|
497
|
+
id accessToken = auth[@"accessToken"];
|
|
498
|
+
int projectId = [auth[@"projectId"] intValue];
|
|
499
|
+
id refreshToken = auth[@"refreshToken"];
|
|
500
|
+
|
|
501
|
+
[MoveSDKInstance.shared setup: userId accessToken: accessToken refreshToken: refreshToken productId: projectId timelineDetectionServices: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt];
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
RCT_EXPORT_METHOD(setupWithCode: (NSString *)code
|
|
505
|
+
config: (NSDictionary *)config
|
|
506
|
+
options: (NSDictionary *)options
|
|
507
|
+
platformParams:(NSArray *)platformParams
|
|
508
|
+
resolve: (RCTPromiseResolveBlock)resolve
|
|
509
|
+
reject: (RCTPromiseRejectBlock)reject) {
|
|
510
|
+
|
|
511
|
+
id opt = convertOptions(options);
|
|
512
|
+
|
|
513
|
+
id detectionServices = config[@"timelineDetectionServices"];
|
|
514
|
+
id drivingServices = config[@"drivingServices"];
|
|
515
|
+
id walkingServices = config[@"walkingServices"];
|
|
516
|
+
|
|
517
|
+
[MoveSDKInstance.shared setup: code timelineDetectionServices: detectionServices drivingServices: drivingServices walkingServices: walkingServices options: opt callback: ^(MoveSdkError * _Nullable error) {
|
|
518
|
+
if (error != nil) {
|
|
519
|
+
reject(error.title, error.text, nil);
|
|
520
|
+
} else {
|
|
521
|
+
resolve(@YES);
|
|
522
|
+
}
|
|
523
|
+
}];
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
RCT_EXPORT_METHOD(updateConfig: (NSDictionary *)config
|
|
527
|
+
options: (NSDictionary *)options) {
|
|
528
|
+
|
|
529
|
+
id opt = convertOptions(options);
|
|
530
|
+
|
|
531
|
+
id detectionServices = config[@"timelineDetectionServices"];
|
|
532
|
+
id drivingServices = config[@"drivingServices"];
|
|
533
|
+
id walkingServices = config[@"walkingServices"];
|
|
534
|
+
|
|
535
|
+
[MoveSDKInstance.shared updateConfig: detectionServices drivingServices: drivingServices walkingServices: walkingServices, options: opt];
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
RCT_EXPORT_METHOD(getState: (RCTPromiseResolveBlock)resolve
|
|
539
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
540
|
+
|
|
541
|
+
resolve(MoveSDKInstance.shared.sdkState);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
RCT_EXPORT_METHOD(getTripState: (RCTPromiseResolveBlock)resolve
|
|
545
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
546
|
+
|
|
547
|
+
resolve(MoveSDKInstance.shared.tripState);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
RCT_EXPORT_METHOD(getWarnings: (RCTPromiseResolveBlock)resolve
|
|
551
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
552
|
+
|
|
553
|
+
resolve(MoveSDKInstance.shared.warnings);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
RCT_EXPORT_METHOD(getErrors: (RCTPromiseResolveBlock)resolve
|
|
557
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
558
|
+
|
|
559
|
+
resolve(MoveSDKInstance.shared.failures);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
RCT_EXPORT_METHOD(initiateAssistanceCall: (RCTPromiseResolveBlock)resolve
|
|
563
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
564
|
+
|
|
565
|
+
[MoveSDKInstance.shared initiateAssistanceCallWithCallback: ^(MoveSdkError * _Nullable error) {
|
|
566
|
+
if (error != nil) {
|
|
567
|
+
reject(error.title, error.text, nil);
|
|
568
|
+
} else {
|
|
569
|
+
resolve(@YES);
|
|
570
|
+
}
|
|
571
|
+
}];
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
RCT_EXPORT_METHOD(setLiveLocationTag: (NSString*) tag
|
|
575
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
576
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
577
|
+
|
|
578
|
+
BOOL success = [MoveSDKInstance.shared setLiveLocationTag: tag];
|
|
579
|
+
resolve(@(success));
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
RCT_EXPORT_METHOD(startAutomaticDetection: (RCTPromiseResolveBlock)resolve
|
|
583
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
584
|
+
|
|
585
|
+
BOOL success = [MoveSDKInstance.shared startAutomaticDetection];
|
|
586
|
+
resolve(@(success));
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
RCT_EXPORT_METHOD(stopAutomaticDetection: (RCTPromiseResolveBlock)resolve
|
|
590
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
591
|
+
|
|
592
|
+
BOOL success = [MoveSDKInstance.shared stopAutomaticDetection];
|
|
593
|
+
resolve(@(success));
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
RCT_EXPORT_METHOD(shutdown: (BOOL) force
|
|
597
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
598
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
599
|
+
|
|
600
|
+
[MoveSDKInstance.shared shutdown: force callback:^(MoveSdkError * _Nullable error) {
|
|
601
|
+
if (error != nil) {
|
|
602
|
+
resolve(error.title);
|
|
603
|
+
} else {
|
|
604
|
+
resolve(@"SUCCESS");
|
|
605
|
+
}
|
|
606
|
+
}];
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
RCT_EXPORT_METHOD(getDeviceQualifier: (RCTPromiseResolveBlock)resolve
|
|
610
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
611
|
+
|
|
612
|
+
resolve([MoveSDKInstance.shared getDeviceQualifier]);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
RCT_EXPORT_METHOD(synchronizeUserData: (RCTPromiseResolveBlock)resolve
|
|
616
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
617
|
+
|
|
618
|
+
[MoveSDKInstance.shared synchronizeUserData:^(BOOL success) {
|
|
619
|
+
resolve(@(success));
|
|
620
|
+
}];
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
RCT_EXPORT_METHOD(startTrip: (id) metadata
|
|
624
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
625
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
626
|
+
|
|
627
|
+
BOOL success = [MoveSDKInstance.shared startTrip: metadata];
|
|
628
|
+
resolve(@(success));
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
RCT_EXPORT_METHOD(registerDevices: (NSArray*)devices
|
|
632
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
633
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
634
|
+
|
|
635
|
+
[MoveSDKInstance.shared registerDevices: devices];
|
|
636
|
+
resolve(@YES);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
RCT_EXPORT_METHOD(unregisterDevices: (NSArray*)devices
|
|
640
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
641
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
642
|
+
|
|
643
|
+
[MoveSDKInstance.shared unregisterDevices: devices];
|
|
644
|
+
resolve(@YES);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
RCT_EXPORT_METHOD(getRegisteredDevices: (RCTPromiseResolveBlock)resolve
|
|
648
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
649
|
+
|
|
650
|
+
NSArray *devices = [MoveSDKInstance.shared getRegisteredDevices];
|
|
651
|
+
resolve(devices);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
RCT_EXPORT_METHOD(getAuthState: (RCTPromiseResolveBlock)resolve
|
|
655
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
656
|
+
|
|
657
|
+
resolve(MoveSDKInstance.shared.authState);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
RCT_EXPORT_METHOD(isAuthValid: (RCTPromiseResolveBlock)resolve
|
|
661
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
662
|
+
|
|
663
|
+
BOOL valid = [MoveSDKInstance.shared isAuthValid];
|
|
664
|
+
resolve(@(valid));
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
RCT_EXPORT_METHOD(updateAuth: (NSDictionary*)auth
|
|
668
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
669
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
670
|
+
|
|
671
|
+
id userId = auth[@"userId"];
|
|
672
|
+
id accessToken = auth[@"accessToken"];
|
|
673
|
+
int projectId = [auth[@"projectId"] intValue];
|
|
674
|
+
id refreshToken = auth[@"refreshToken"];
|
|
675
|
+
|
|
676
|
+
[MoveSDKInstance.shared updateAuth: userId accessToken: accessToken refreshToken: refreshToken productId: projectId callback: ^(MoveSdkError * _Nullable error) {
|
|
677
|
+
if (error != nil) {
|
|
678
|
+
reject(error.title, error.text, nil);
|
|
679
|
+
} else {
|
|
680
|
+
resolve(@YES);
|
|
681
|
+
}
|
|
682
|
+
}];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
RCT_EXPORT_METHOD(geocode: (double)latitude: (double)longitude
|
|
686
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
687
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
688
|
+
|
|
689
|
+
[MoveSDKInstance.shared geocodeWithLatitude: latitude longitude: longitude callback:
|
|
690
|
+
^(NSString * _Nullable result, MoveSdkError * _Nullable error) {
|
|
691
|
+
if (error != nil) {
|
|
692
|
+
resolve(error);
|
|
693
|
+
} else {
|
|
694
|
+
resolve(result);
|
|
695
|
+
}
|
|
696
|
+
}];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
RCT_EXPORT_METHOD(getBluetoothPermission: (RCTPromiseResolveBlock)resolve
|
|
700
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
701
|
+
|
|
702
|
+
[MoveSDKInstance.shared getBluetoothPermission:^(BOOL state) {
|
|
703
|
+
resolve(@(state));
|
|
704
|
+
}];
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
RCT_EXPORT_METHOD(getBluetoothState: (RCTPromiseResolveBlock)resolve
|
|
708
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
709
|
+
|
|
710
|
+
[MoveSDKInstance.shared getBluetoothState:^(BOOL state) {
|
|
711
|
+
resolve(@(state));
|
|
712
|
+
}];
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
#endif
|
|
716
|
+
|
|
717
|
+
@end
|