react-native-move-sdk 2.13.0 → 2.14.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.
Files changed (89) hide show
  1. package/android/build.gradle.kts +42 -0
  2. package/android/gradle.properties +16 -6
  3. package/android/settings.gradle.kts +35 -0
  4. package/android/src/{main/java/in/dolph/move/sdk → legacy}/MoveSdkModule.kt +30 -195
  5. package/android/src/main/AndroidManifest.xml +1 -11
  6. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/DeviceScanner.kt +19 -21
  7. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/Mapper.kt +3 -2
  8. package/android/src/main/java/com/movesdk/MoveExtensions.kt +188 -0
  9. package/android/src/main/java/{in/dolph/move/sdk/MoveSdkRepository.kt → com/movesdk/MoveSdkConfigRepository.kt} +3 -1
  10. package/android/src/main/java/com/movesdk/MoveSdkPackage.kt +32 -0
  11. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/NativeMoveSdkWrapper.kt +201 -61
  12. package/android/src/main/java/com/movesdk/extentions/ConnectionExt.kt +52 -0
  13. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/extentions/PermissionUtils.kt +1 -1
  14. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/extentions/SharedPreferencesExt.kt +1 -1
  15. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/metadata/MetadataStorage.kt +1 -1
  16. package/android/src/main/java/{in/dolph/move/sdk → com/movesdk}/metadata/MetadataStorageImpl.kt +2 -2
  17. package/android/src/main/java/com/movesdk/shared/Constants.kt +39 -0
  18. package/android/src/turbo/MoveSdkModule.kt +422 -0
  19. package/ios/MoveSdk.h +13 -0
  20. package/ios/MoveSdk.mm +717 -0
  21. package/ios/MoveSdk.swift +1022 -0
  22. package/ios/{NativeModule/MoveSdkDeviceScanner.swift → MoveSdkDeviceScanner.swift} +1 -1
  23. package/lib/commonjs/NativeMoveSdk.js +21 -0
  24. package/lib/commonjs/NativeMoveSdk.js.map +1 -0
  25. package/lib/commonjs/components/LazyMoveSdk.js +22 -41
  26. package/lib/commonjs/components/LazyMoveSdk.js.map +1 -1
  27. package/lib/commonjs/index.js +331 -25
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/package.json +1 -0
  30. package/lib/module/NativeMoveSdk.js +17 -0
  31. package/lib/module/NativeMoveSdk.js.map +1 -0
  32. package/lib/module/components/LazyMoveSdk.js +15 -20
  33. package/lib/module/components/LazyMoveSdk.js.map +1 -1
  34. package/lib/module/index.js +337 -3
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/package.json +1 -0
  37. package/lib/typescript/commonjs/example/src/App.d.ts +2 -0
  38. package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/package.json +1 -0
  40. package/lib/typescript/commonjs/src/NativeMoveSdk.d.ts +138 -0
  41. package/lib/typescript/commonjs/src/NativeMoveSdk.d.ts.map +1 -0
  42. package/lib/typescript/{components → commonjs/src/components}/LazyMoveSdk.d.ts +2 -1
  43. package/lib/typescript/commonjs/src/components/LazyMoveSdk.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/src/index.d.ts +84 -0
  45. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  46. package/lib/typescript/module/example/src/App.d.ts +2 -0
  47. package/lib/typescript/module/example/src/App.d.ts.map +1 -0
  48. package/lib/typescript/module/package.json +1 -0
  49. package/lib/typescript/module/src/NativeMoveSdk.d.ts +138 -0
  50. package/lib/typescript/module/src/NativeMoveSdk.d.ts.map +1 -0
  51. package/lib/typescript/module/src/components/LazyMoveSdk.d.ts +8 -0
  52. package/lib/typescript/module/src/components/LazyMoveSdk.d.ts.map +1 -0
  53. package/lib/typescript/module/src/index.d.ts +84 -0
  54. package/lib/typescript/module/src/index.d.ts.map +1 -0
  55. package/package.json +197 -138
  56. package/react-native-move-sdk.podspec +30 -9
  57. package/src/NativeMoveSdk.ts +191 -0
  58. package/src/components/LazyMoveSdk.tsx +2 -2
  59. package/src/{MoveSdk.ts → index.tsx} +131 -199
  60. package/android/.project +0 -17
  61. package/android/build.gradle +0 -153
  62. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  63. package/android/gradle/wrapper/gradle-wrapper.properties +0 -8
  64. package/android/gradlew +0 -183
  65. package/android/gradlew.bat +0 -100
  66. package/android/src/main/java/in/dolph/move/sdk/MoveExtensions.kt +0 -72
  67. package/android/src/main/java/in/dolph/move/sdk/MoveSdkPackage.kt +0 -19
  68. package/android/src/main/java/in/dolph/move/sdk/WrapperBtConnectionsReceiver.kt +0 -99
  69. package/android/src/main/res/drawable-anydpi-v24/ic_notification.xml +0 -13
  70. package/android/src/main/res/drawable-hdpi/ic_notification.png +0 -0
  71. package/android/src/main/res/drawable-mdpi/ic_notification.png +0 -0
  72. package/android/src/main/res/drawable-xhdpi/ic_notification.png +0 -0
  73. package/android/src/main/res/drawable-xxhdpi/ic_notification.png +0 -0
  74. package/android/src/main/res/values/strings.xml +0 -9
  75. package/android/src/main/strings.xml +0 -0
  76. package/android/src/test/java/io/dolphin/move/MoveWrapperTest.kt +0 -190
  77. package/ios/MoveSdk-Bridging-Header.h +0 -3
  78. package/ios/MoveSdk.xcodeproj/project.pbxproj +0 -287
  79. package/ios/MoveSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  80. package/ios/MoveSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  81. package/ios/NativeModule/MoveSdk.h +0 -144
  82. package/ios/NativeModule/MoveSdk.swift +0 -1359
  83. package/lib/commonjs/MoveSdk.js +0 -443
  84. package/lib/commonjs/MoveSdk.js.map +0 -1
  85. package/lib/module/MoveSdk.js +0 -432
  86. package/lib/module/MoveSdk.js.map +0 -1
  87. package/lib/typescript/MoveSdk.d.ts +0 -158
  88. package/lib/typescript/index.d.ts +0 -3
  89. package/src/index.ts +0 -3
@@ -1,156 +1,91 @@
1
- import { NativeModules, NativeEventEmitter, Platform, EmitterSubscription } from 'react-native';
2
-
3
- export type SdkState = 'UNINITIALIZED' | 'READY' | 'RUNNING';
4
- export type TripState = 'UNKNOWN' | 'DRIVING' | 'HALT' | 'IDLE' | 'IGNORED';
5
- export type AuthState = 'UNKNOWN' | 'VALID' | 'EXPIRED' | 'INVALID';
6
- export type DrivingService = 'DISTRACTION_FREE_DRIVING' | 'DRIVING_BEHAVIOUR' | 'DEVICE_DISCOVERY';
7
- export type WalkingService = 'WALKING_LOCATION';
8
- export type OtherService = 'POINTS_OF_INTEREST';
9
- export type TimelineDetectionService = 'DRIVING' | 'CYCLING' | 'WALKING' | 'PLACES' | 'PUBLIC_TRANSPORT' | 'AUTOMATIC_IMPACT_DETECTION' | 'ASSISTANCE_CALL' | 'POINTS_OF_INTEREST';
10
-
11
- export type ErrorReasons =
12
- | 'BACKGROUND_LOCATION_PERMISSION_MISSING'
13
- | 'LOCATION_PERMISSION_MISSING'
14
- | 'MOTION_PERMISSION_MISSING'
15
- | 'ACTIVITY_PERMISSION_MISSING'
16
- | 'BATTERY_PERMISSION_MISSING'
17
- | 'UNAUTHORIZED'
18
- | 'INTERNET_PERMISSION_MISSING'
19
- | 'PHONE_PERMISSION_MISSING'
20
- | 'OVERLAY_PERMISSION_MISSING'
21
- | 'NOTIFICATION_MISSING'
22
- | 'ACCELEROMETER_MISSING'
23
- | 'GOOGLE_PLAY_LOCATION_ACCURACY_MISSING'
24
- | 'PRECISE_LOCATION_PERMISSION_MISSING';
25
-
26
- export type WarningReasons =
27
- | 'BACKGROUND_LOCATION_PERMISSION_MISSING'
28
- | 'MOTION_PERMISSION_MISSING'
29
- | 'ACTIVITY_PERMISSION_MISSING'
30
- | 'BATTERY_OPTIMIZATION'
31
- | 'BLUETOOTH_TURNED_OFF'
32
- | 'BLUETOOTH_SCAN_PERMISSION_MISSING'
33
- | 'BLUETOOTH_CONNECT_PERMISSION_MISSING'
34
- | 'GOOGLE_PLAY_LOCATION_ACCURACY_MISSING'
35
- | 'NOTIFICATION_PERMISSION_MISSING'
36
- | 'FINE_LOCATION_PERMISSION_MISSING'
37
- | 'BLUETOOTH_PERMISSION_MISSING'
38
- | 'GPS_OFF'
39
- | 'OFFLINE'
40
- | 'GO_EDITION'
41
- | 'ROOTED'
42
- | 'NO_SIM'
43
- | 'BACKGROUND_RESTRICTED'
44
- | 'MOCK_PROVIDER_LOCATION'
45
- | 'MOCK_PROVIDER'
46
- | 'LOCATION_MODE'
47
- | 'PLAY_SERVICES_MISSING'
48
- | 'LOCATION_POWER_MODE(0)'
49
- | 'LOCATION_POWER_MODE(1)'
50
- | 'LOCATION_POWER_MODE(2)'
51
- | 'LOCATION_POWER_MODE(3)'
52
- | 'LOCATION_POWER_MODE(4)'
53
- | 'ENERGY_SAVER';
54
-
55
- export type IssueListService = TimelineDetectionService | DrivingService | WalkingService;
56
-
57
- export type IssueListItem<ReasonsType> = {
58
- reasons: Array<ReasonsType>;
59
- service?: IssueListService;
1
+ import { NativeModules, NativeEventEmitter, Platform, type EmitterSubscription } from 'react-native';
2
+ import LazyMoveSdk from './components/LazyMoveSdk';
3
+
4
+ import type {
5
+ AuthState,
6
+ DrivingService,
7
+ ErrorListType,
8
+ ErrorReasons,
9
+ HealthListItem,
10
+ IssueListService,
11
+ MoveSdkDeviceFilter,
12
+ SdkState,
13
+ ShutdownReturnType,
14
+ TimelineDetectionService,
15
+ TripState,
16
+ WalkingService,
17
+ WarningListType,
18
+ WarningReasons,
19
+
20
+ AuthStateEvent,
21
+ IssueListItem,
22
+ MoveScanResult,
23
+ MoveSdkAndroidConfig,
24
+ MoveSdkAuth,
25
+ MoveSdkConfig,
26
+ MoveSdkDevice,
27
+ MoveSdkDeviceDiscovery,
28
+ MoveSdkOptions,
29
+ MoveSdkLog,
30
+ NotificationConfig,
31
+ } from './NativeMoveSdk';
32
+
33
+ export type {
34
+ AuthState,
35
+ DrivingService,
36
+ ErrorListType,
37
+ ErrorReasons,
38
+ HealthListItem,
39
+ IssueListService,
40
+ MoveSdkDeviceFilter,
41
+ SdkState,
42
+ ShutdownReturnType,
43
+ TimelineDetectionService,
44
+ TripState,
45
+ WalkingService,
46
+ WarningListType,
47
+ WarningReasons,
48
+
49
+ AuthStateEvent,
50
+ IssueListItem,
51
+ MoveScanResult,
52
+ MoveSdkAndroidConfig,
53
+ MoveSdkAuth,
54
+ MoveSdkConfig,
55
+ MoveSdkDevice,
56
+ MoveSdkDeviceDiscovery,
57
+ MoveSdkOptions,
58
+ MoveSdkLog,
59
+ NotificationConfig,
60
60
  };
61
61
 
62
- export type ErrorListType = Array<IssueListItem<ErrorReasons>>;
62
+ export { LazyMoveSdk };
63
63
 
64
- export type WarningListType = Array<IssueListItem<WarningReasons>>;
64
+ const LINKING_ERROR =
65
+ `The package 'react-native-move-sdk' doesn't seem to be linked. Make sure: \n\n` +
66
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
67
+ '- You rebuilt the app after installing the package\n' +
68
+ '- You are not using Expo Go\n';
65
69
 
66
- export type HealthReasons =
67
- | 'BATTERY_LEVEL'
68
- | 'CPU_USAGE'
69
- | 'DISK_USAGE'
70
- | 'INTERNET_USAGE'
71
- | 'MEMORY_USAGE'
72
- | 'NEW_VERSION'
73
- | 'UNIMPLEMENTED_LISTENERS';
70
+ // @ts-expect-error
71
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
74
72
 
75
- export type HealthListItem = {
76
- reason: HealthReasons;
77
- description: string;
78
- };
79
-
80
- export type MoveHealthScore = Array<HealthListItem>;
81
-
82
- export type ShutdownReturnType = 'NETWORK_ERROR' | 'SUCCESS' | 'UNINITIALIZED';
83
-
84
- export type MoveSdkConfig = {
85
- timelineDetectionServices: Array<TimelineDetectionService>;
86
- drivingServices: Array<DrivingService>;
87
- walkingServices: Array<WalkingService>;
88
- };
89
-
90
- export type MoveSdkDeviceDiscovery = {
91
- startDelay?: number;
92
- duration?: number;
93
- interval?: number;
94
- stopScanOnFirstDiscovered?: boolean;
95
- };
96
-
97
- export type MoveSdkOptions = {
98
- motionPermissionMandatory?: boolean;
99
- backgroundLocationPermissionMandatory?: boolean;
100
- overlayPermissionMandatory?: boolean;
101
- useBackendConfig?: boolean;
102
- deviceDiscovery?: MoveSdkDeviceDiscovery;
103
- };
104
-
105
- export type MoveSdkAuth = {
106
- userId: string;
107
- accessToken: string;
108
- refreshToken: string;
109
- projectId: number;
110
- };
111
-
112
- export type NotificationConfig = {
113
- title: string;
114
- text: string;
115
- };
116
-
117
- export type MoveSdkAndroidConfig = {
118
- notifications: {
119
- recognitionNotification: NotificationConfig;
120
- tripNotification: NotificationConfig;
121
- };
122
- };
123
-
124
- export type ListenerSubscription = EmitterSubscription;
125
-
126
- export type AuthStateEvent = {
127
- state: AuthState;
128
- accessToken?: string;
129
- refreshToken?: string;
130
- };
131
-
132
- export type MoveSdkDeviceFilter = 'beacon' | 'paired' | 'connected';
133
-
134
- export type MoveSdkDevice = {
135
- name: string;
136
- data: string;
137
- id: string;
138
- isConnected?: boolean;
139
- };
73
+ const MoveSdkModule = isTurboModuleEnabled
74
+ ? require('./NativeMoveSdk').default
75
+ : NativeModules.MoveSdk;
140
76
 
141
- export type MoveScanResult = {
142
- isDiscovered: boolean;
143
- device: MoveSdkDevice;
144
- name: string;
145
- };
77
+ const eventEmitter = new NativeEventEmitter(MoveSdkModule);
146
78
 
147
- export type MoveSdkLog = {
148
- message: string;
149
- value?: string;
150
- };
151
-
152
- const { MoveSdk: NativeMoveSdk } = NativeModules;
153
- const eventEmitter = new NativeEventEmitter(NativeMoveSdk);
79
+ const NativeMoveSdk = MoveSdkModule
80
+ ? MoveSdkModule
81
+ : new Proxy(
82
+ {},
83
+ {
84
+ get() {
85
+ throw new Error(LINKING_ERROR);
86
+ },
87
+ }
88
+ );
154
89
 
155
90
  export default class MoveSdk {
156
91
  static READY: SdkState = 'READY';
@@ -193,9 +128,6 @@ export default class MoveSdk {
193
128
  }
194
129
 
195
130
  static async setup(config: MoveSdkConfig, auth: MoveSdkAuth, android: MoveSdkAndroidConfig, options?: MoveSdkOptions): Promise<void> {
196
- const { timelineDetectionServices, drivingServices, walkingServices } = config;
197
-
198
- const { userId, projectId, accessToken, refreshToken } = auth;
199
131
 
200
132
  let platformParams: Array<string | boolean> = [];
201
133
  if (Platform.OS === 'android') {
@@ -207,26 +139,25 @@ export default class MoveSdk {
207
139
  throw new Error('MOVE SDK needs notification configuration for Android');
208
140
  }
209
141
 
210
- platformParams = [recognitionNotification.title, recognitionNotification.text, tripNotification.title, tripNotification.text];
142
+ platformParams = [
143
+ recognitionNotification.title,
144
+ recognitionNotification.text,
145
+ tripNotification.title,
146
+ tripNotification.text,
147
+ ];
211
148
  }
212
149
 
213
150
  return await NativeMoveSdk.setup(
214
- userId,
215
- accessToken,
216
- refreshToken,
217
- projectId,
151
+ auth,
218
152
  // Config
219
- timelineDetectionServices,
220
- drivingServices,
221
- walkingServices,
153
+ config,
222
154
  options,
223
155
  // Platform config
224
- ...platformParams
156
+ platformParams
225
157
  );
226
158
  }
227
159
 
228
- static async setupWithCode(code: string, config: MoveSdkConfig, android: MoveSdkAndroidConfig, options?: MoveSdkOptions): Promise<void> {
229
- const { timelineDetectionServices, drivingServices, walkingServices } = config;
160
+ static async setupWithCode(code:string, config: MoveSdkConfig, android: MoveSdkAndroidConfig, options?: MoveSdkOptions): Promise<void> {
230
161
 
231
162
  let platformParams: Array<string | boolean> = [];
232
163
  if (Platform.OS === 'android') {
@@ -238,18 +169,21 @@ export default class MoveSdk {
238
169
  throw new Error('MOVE SDK needs notification configuration for Android');
239
170
  }
240
171
 
241
- platformParams = [recognitionNotification.title, recognitionNotification.text, tripNotification.title, tripNotification.text];
172
+ platformParams = [
173
+ recognitionNotification.title,
174
+ recognitionNotification.text,
175
+ tripNotification.title,
176
+ tripNotification.text,
177
+ ];
242
178
  }
243
179
 
244
180
  return await NativeMoveSdk.setupWithCode(
245
181
  code,
246
182
  // Config
247
- timelineDetectionServices,
248
- drivingServices,
249
- walkingServices,
183
+ config,
250
184
  options,
251
185
  // Platform config
252
- ...platformParams
186
+ platformParams
253
187
  );
254
188
  }
255
189
 
@@ -257,11 +191,6 @@ export default class MoveSdk {
257
191
  NativeMoveSdk.allowMockLocations(allowMockLocations);
258
192
  }
259
193
 
260
- /* Deprecated */
261
- static init() {
262
- NativeMoveSdk.init();
263
- }
264
-
265
194
  static resolveError() {
266
195
  NativeMoveSdk.resolveError();
267
196
  }
@@ -334,21 +263,21 @@ export default class MoveSdk {
334
263
  NativeMoveSdk.setAssistanceMetaData(data);
335
264
  }
336
265
 
337
- static addTripStateListener(tripStateChanged: (state: TripState) => void): ListenerSubscription {
266
+ static addTripStateListener(tripStateChanged: (state: TripState) => void): EmitterSubscription {
338
267
  return eventEmitter.addListener('MOVE_SDK_TRIP_STATE', (event) => tripStateChanged(MoveSdk.tripStateFromNative(event.state)));
339
268
  }
340
269
 
341
- static addTripStartListener(tripStartTriggered: (start: Date) => void): ListenerSubscription {
270
+ static addTripStartListener(tripStartTriggered: (start: Date) => void): EmitterSubscription {
342
271
  return eventEmitter.addListener('MOVE_SDK_TRIP_START', (start) => tripStartTriggered(new Date(Number(start))));
343
272
  }
344
273
 
345
- static addSdkStateListener(sdkStateChanged: (state: SdkState) => void): ListenerSubscription {
274
+ static addSdkStateListener(sdkStateChanged: (state: SdkState) => void): EmitterSubscription {
346
275
  return eventEmitter.addListener('MOVE_SDK_STATE', (event) => {
347
276
  sdkStateChanged(MoveSdk.sdkStateFromNative(event.state));
348
277
  });
349
278
  }
350
279
 
351
- static addAuthStateListener(authStateChanged: (event: AuthStateEvent) => void): ListenerSubscription {
280
+ static addAuthStateListener(authStateChanged: (event: AuthStateEvent) => void): EmitterSubscription {
352
281
  return eventEmitter.addListener('MOVE_SDK_AUTH_STATE', (event) => {
353
282
  const transformedEvent = {
354
283
  ...event,
@@ -358,39 +287,39 @@ export default class MoveSdk {
358
287
  });
359
288
  }
360
289
 
361
- static addErrorsListener(errorsReceived: (errors: ErrorListType) => void): ListenerSubscription {
290
+ static addErrorsListener(errorsReceived: (errors: ErrorListType) => void): EmitterSubscription {
362
291
  return eventEmitter.addListener('MOVE_SDK_ERRORS', (event) => {
363
292
  errorsReceived(event.errors);
364
293
  });
365
294
  }
366
295
 
367
- static addWarningsListener(warningsReceived: (warnings: WarningListType) => void): ListenerSubscription {
296
+ static addWarningsListener(warningsReceived: (warnings: WarningListType) => void): EmitterSubscription {
368
297
  return eventEmitter.addListener('MOVE_SDK_WARNINGS', (event) => {
369
298
  warningsReceived(event.warnings);
370
299
  });
371
300
  }
372
301
 
373
- static addAppEventListener(appEventReceived: (event: string) => void): ListenerSubscription {
302
+ static addAppEventListener(appEventReceived: (event: string) => void): EmitterSubscription {
374
303
  return eventEmitter.addListener('MOVE_SDK_APP_EVENT', (event) => {
375
304
  appEventReceived(event);
376
305
  });
377
306
  }
378
307
 
379
- static addLogListener(logReceived: (event: MoveSdkLog) => void): ListenerSubscription {
308
+ static addLogListener(logReceived: (event: MoveSdkLog) => void): EmitterSubscription {
380
309
  return eventEmitter.addListener('MOVE_SDK_LOG', (event) => {
381
- logReceived(event);
310
+ logReceived(event);
382
311
  });
383
312
  }
384
313
 
385
- static addRemoteConfigChangeListener(configChangeReceived: (config: Array<IssueListService>) => void): ListenerSubscription {
314
+ static addRemoteConfigChangeListener(configChangeReceived: (config: Array<IssueListService>) => void): EmitterSubscription {
386
315
  return eventEmitter.addListener('MOVE_SDK_CONFIG_UPDATE', (config) => {
387
316
  configChangeReceived(config.services);
388
317
  });
389
318
  }
390
319
 
391
- static addHealthListener(scoreReceived: (health: MoveHealthScore) => void): ListenerSubscription {
392
- return eventEmitter.addListener('MOVE_SDK_HEALTH', (health) => {
393
- scoreReceived(health);
320
+ static addHealthListener(scoreReceived: (health: Array<HealthListItem>) => void): EmitterSubscription {
321
+ return eventEmitter.addListener('MOVE_SDK_HEALTH', (health) => {
322
+ scoreReceived(health);
394
323
  });
395
324
  }
396
325
 
@@ -414,14 +343,6 @@ export default class MoveSdk {
414
343
  }
415
344
  }
416
345
 
417
- static async getBluetoothPermission(): Promise<boolean> {
418
- return await NativeMoveSdk.getBluetoothPermission();
419
- }
420
-
421
- static async getBluetoothState(): Promise<boolean> {
422
- return await NativeMoveSdk.getBluetoothState();
423
- }
424
-
425
346
  static async shutdown(force: boolean = true): Promise<ShutdownReturnType> {
426
347
  return await NativeMoveSdk.shutdown(force);
427
348
  }
@@ -466,7 +387,7 @@ export default class MoveSdk {
466
387
 
467
388
  // **** PERMISSIONS MODULE END *****
468
389
 
469
- static startScanningDevices(sdkDevicesDetected: (state: Array<MoveSdkDevice>) => void, filter: MoveSdkDeviceFilter[] = ['paired'], uuid?: string, manufacturerId?: number): ListenerSubscription {
390
+ static startScanningDevices(sdkDevicesDetected: (state: Array<MoveSdkDevice>) => void, filter: MoveSdkDeviceFilter[] = ['paired'], uuid?: string, manufacturerId?: number): EmitterSubscription {
470
391
  const subscription = eventEmitter.addListener('MOVE_SDK_DEVICES', (devices) => {
471
392
  sdkDevicesDetected(devices);
472
393
  });
@@ -492,18 +413,26 @@ export default class MoveSdk {
492
413
  return await NativeMoveSdk.unregisterDevices(devices);
493
414
  }
494
415
 
495
- static requestBluetoothAlwaysUsagePermission(): void {
416
+ static requestBluetoothAlwaysUsagePermission() {
496
417
  NativeMoveSdk.requestBluetoothAlwaysUsagePermission();
497
418
  }
498
419
 
499
- static addDeviceDiscoveryListener(onScanResult: (state: Array<MoveScanResult>) => void): ListenerSubscription {
420
+ static async getBluetoothPermission() {
421
+ return await NativeMoveSdk.getBluetoothPermission();
422
+ }
423
+
424
+ static async getBluetoothState() {
425
+ return await NativeMoveSdk.getBluetoothState();
426
+ }
427
+
428
+ static addDeviceDiscoveryListener(onScanResult: (state: Array<MoveScanResult>) => void): EmitterSubscription {
500
429
  return eventEmitter.addListener('MOVE_SDK_SCAN_RESULT', (results) => {
501
430
  onScanResult(results);
502
431
  });
503
432
  }
504
433
 
505
- static addDeviceStateListener(onScanResult: (results: Array<MoveSdkDevice>) => void): ListenerSubscription {
506
- return eventEmitter.addListener('MOVE_SDK_DEVICE_STATE', (results) => {
434
+ static addDeviceStateListener(onScanResult: (results: Array<MoveSdkDevice>) => void): EmitterSubscription {
435
+ return eventEmitter.addListener('MOVE_SDK_DEVICE_STATE', results => {
507
436
  onScanResult(results);
508
437
  });
509
438
  }
@@ -532,11 +461,10 @@ export default class MoveSdk {
532
461
  }
533
462
 
534
463
  static updateConfig(config: MoveSdkConfig, options?: MoveSdkOptions) {
535
- const { timelineDetectionServices, drivingServices, walkingServices } = config;
536
- NativeMoveSdk.updateConfig(timelineDetectionServices, drivingServices, walkingServices, options);
464
+ NativeMoveSdk.updateConfig(config, options);
537
465
  }
538
466
 
539
- static setTripMetadata(metadata?: { [key: string]: string }) {
467
+ static setTripMetadata(metadata?: {[key: string]: string}) {
540
468
  NativeMoveSdk.setTripMetadata(metadata);
541
469
  }
542
470
 
@@ -547,4 +475,8 @@ export default class MoveSdk {
547
475
  static startNativeSdkStateListener() {
548
476
  NativeMoveSdk.startNativeSdkStateListener();
549
477
  }
478
+
479
+ static async requestHealthPermissions(): Promise<boolean> {
480
+ return await NativeMoveSdk.requestHealthPermissions();
481
+ }
550
482
  }
package/android/.project DELETED
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>android_</name>
4
- <comment>Project android_ created by Buildship.</comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- <buildCommand>
9
- <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
- <arguments>
11
- </arguments>
12
- </buildCommand>
13
- </buildSpec>
14
- <natures>
15
- <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
- </natures>
17
- </projectDescription>
@@ -1,153 +0,0 @@
1
- buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['MoveSdk_kotlinVersion']
4
-
5
- repositories {
6
- mavenCentral()
7
- google()
8
-
9
- }
10
-
11
- dependencies {
12
- classpath 'com.android.tools.build:gradle:7.2.2'
13
- // noinspection DifferentKotlinGradleVersion
14
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15
- }
16
- }
17
-
18
- apply plugin: 'com.android.library'
19
- apply plugin: 'kotlin-android'
20
-
21
- def getExtOrDefault(name) {
22
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['MoveSdk_' + name]
23
- }
24
-
25
- def getExtOrIntegerDefault(name) {
26
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['MoveSdk_' + name]).toInteger()
27
- }
28
-
29
- android {
30
- compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
31
- defaultConfig {
32
- minSdkVersion 26
33
- targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
34
- versionCode 1
35
- versionName "1.0"
36
- }
37
-
38
- buildTypes {
39
- release {
40
- minifyEnabled false
41
- }
42
- }
43
- lintOptions {
44
- disable 'GradleCompatible'
45
- }
46
- compileOptions {
47
- sourceCompatibility JavaVersion.VERSION_1_8
48
- targetCompatibility JavaVersion.VERSION_1_8
49
- }
50
- }
51
-
52
- repositories {
53
-
54
- mavenLocal()
55
- mavenCentral()
56
- google()
57
- maven {
58
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
59
- url "$rootDir/../node_modules/react-native/android"
60
- }
61
- maven {
62
- // Android JSC is installed from npm
63
- url "$rootDir/../node_modules/jsc-android/dist"
64
- }
65
- maven {
66
- url "https://dolphin.jfrog.io/artifactory/move-sdk-libs-release"
67
- }
68
- maven {
69
- url "https://dolphin.jfrog.io/artifactory/move-sdk-libs-release"
70
- }
71
- def found = false
72
- def defaultDir = null
73
- def androidSourcesName = 'React Native sources'
74
-
75
- if (rootProject.ext.has('reactNativeAndroidRoot')) {
76
- defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
77
- } else {
78
- defaultDir = new File(
79
- projectDir,
80
- '/../../../node_modules/react-native/android'
81
- )
82
- }
83
-
84
- if (defaultDir.exists()) {
85
- maven {
86
- url defaultDir.toString()
87
- name androidSourcesName
88
- }
89
-
90
- logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
91
- found = true
92
- } else {
93
- def parentDir = rootProject.projectDir
94
-
95
- 1.upto(5, {
96
- if (found) return true
97
- parentDir = parentDir.parentFile
98
-
99
- if (parentDir != null) {
100
-
101
-
102
- def androidSourcesDir = new File(
103
- parentDir,
104
- 'node_modules/react-native'
105
- )
106
-
107
- def androidPrebuiltBinaryDir = new File(
108
- parentDir,
109
- 'node_modules/react-native/android'
110
- )
111
-
112
- if (androidPrebuiltBinaryDir.exists()) {
113
- maven {
114
- url androidPrebuiltBinaryDir.toString()
115
- name androidSourcesName
116
- }
117
-
118
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
119
- found = true
120
- } else if (androidSourcesDir.exists()) {
121
- maven {
122
- url androidSourcesDir.toString()
123
- name androidSourcesName
124
- }
125
-
126
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
127
- found = true
128
- }
129
- }
130
- })
131
- }
132
-
133
- if (!found) {
134
- throw new GradleException(
135
- "${project.name}: unable to locate React Native android sources. " +
136
- "Ensure you have you installed React Native as a dependency in your project and try again."
137
- )
138
- }
139
- }
140
-
141
- def kotlin_version = getExtOrDefault('kotlinVersion')
142
-
143
- dependencies {
144
- // noinspection GradleDynamicVersion
145
-
146
- implementation "com.facebook.react:react-native:+"
147
- api "io.dolphin.move:move-sdk:2.13.0.94"
148
-
149
- testImplementation 'junit:junit:4.13.2'
150
- testImplementation "androidx.test:core:1.4.0"
151
- testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
152
- testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
153
- }
@@ -1,8 +0,0 @@
1
- distributionBase=GRADLE_USER_HOME
2
- distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
4
- zipStoreBase=GRADLE_USER_HOME
5
- zipStorePath=wrapper/dists
6
-
7
- android.useAndroidX=true
8
- android.enableJetifier=true