react-native-move-sdk 2.10.1 → 2.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/in/dolph/move/sdk/DeviceScanner.kt +23 -2
- package/android/src/main/java/in/dolph/move/sdk/MoveSdkModule.kt +13 -37
- package/android/src/main/java/in/dolph/move/sdk/MoveSdkRepository.kt +14 -151
- package/android/src/main/java/in/dolph/move/sdk/NativeMoveSdkWrapper.kt +50 -90
- package/android/src/main/java/in/dolph/move/sdk/extentions/PermissionUtils.kt +58 -0
- package/ios/NativeModule/MoveSdk.h +6 -0
- package/ios/NativeModule/MoveSdk.swift +48 -2
- package/ios/NativeModule/MoveSdkDeviceScanner.swift +17 -0
- package/lib/commonjs/MoveSdk.js +10 -2
- package/lib/commonjs/MoveSdk.js.map +1 -1
- package/lib/module/MoveSdk.js +10 -2
- package/lib/module/MoveSdk.js.map +1 -1
- package/lib/typescript/MoveSdk.d.ts +4 -7
- package/package.json +1 -1
- package/react-native-move-sdk.podspec +1 -1
- package/src/MoveSdk.ts +17 -31
- package/android/src/main/java/in/dolph/move/sdk/MoveNotificationConfig.kt +0 -52
- package/android/src/main/java/in/dolph/move/sdk/MoveSdkConfig.kt +0 -13
package/src/MoveSdk.ts
CHANGED
|
@@ -49,7 +49,8 @@ export type WarningReasons =
|
|
|
49
49
|
| 'LOCATION_POWER_MODE(1)'
|
|
50
50
|
| 'LOCATION_POWER_MODE(2)'
|
|
51
51
|
| 'LOCATION_POWER_MODE(3)'
|
|
52
|
-
| 'LOCATION_POWER_MODE(4)'
|
|
52
|
+
| 'LOCATION_POWER_MODE(4)'
|
|
53
|
+
| 'ENERGY_SAVER';
|
|
53
54
|
|
|
54
55
|
export type IssueListService = TimelineDetectionService | DrivingService | WalkingService;
|
|
55
56
|
|
|
@@ -95,7 +96,6 @@ export type MoveSdkAuth = {
|
|
|
95
96
|
export type NotificationConfig = {
|
|
96
97
|
title: string;
|
|
97
98
|
text: string;
|
|
98
|
-
channel: { id: string; name: string; description: string };
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
export type MoveSdkAndroidConfig = {
|
|
@@ -113,7 +113,7 @@ export type AuthStateEvent = {
|
|
|
113
113
|
refreshToken?: string;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
export type MoveSdkDeviceFilter = 'beacon' | 'paired';
|
|
116
|
+
export type MoveSdkDeviceFilter = 'beacon' | 'paired' | 'connected';
|
|
117
117
|
|
|
118
118
|
export type MoveSdkDevice = {
|
|
119
119
|
name: string;
|
|
@@ -191,18 +191,7 @@ export default class MoveSdk {
|
|
|
191
191
|
throw new Error('MOVE SDK needs notification configuration for Android');
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
platformParams = [
|
|
195
|
-
recognitionNotification.title,
|
|
196
|
-
recognitionNotification.text,
|
|
197
|
-
recognitionNotification.channel.id,
|
|
198
|
-
recognitionNotification.channel.name,
|
|
199
|
-
recognitionNotification.channel.description,
|
|
200
|
-
tripNotification.title,
|
|
201
|
-
tripNotification.text,
|
|
202
|
-
tripNotification.channel.id,
|
|
203
|
-
tripNotification.channel.name,
|
|
204
|
-
tripNotification.channel.description,
|
|
205
|
-
];
|
|
194
|
+
platformParams = [recognitionNotification.title, recognitionNotification.text, tripNotification.title, tripNotification.text];
|
|
206
195
|
}
|
|
207
196
|
|
|
208
197
|
return await NativeMoveSdk.setup(
|
|
@@ -220,7 +209,7 @@ export default class MoveSdk {
|
|
|
220
209
|
);
|
|
221
210
|
}
|
|
222
211
|
|
|
223
|
-
static async setupWithCode(code:string, config: MoveSdkConfig, android: MoveSdkAndroidConfig, options?: MoveSdkOptions): Promise<void> {
|
|
212
|
+
static async setupWithCode(code: string, config: MoveSdkConfig, android: MoveSdkAndroidConfig, options?: MoveSdkOptions): Promise<void> {
|
|
224
213
|
const { timelineDetectionServices, drivingServices, walkingServices } = config;
|
|
225
214
|
|
|
226
215
|
let platformParams: Array<string | boolean> = [];
|
|
@@ -233,18 +222,7 @@ export default class MoveSdk {
|
|
|
233
222
|
throw new Error('MOVE SDK needs notification configuration for Android');
|
|
234
223
|
}
|
|
235
224
|
|
|
236
|
-
platformParams = [
|
|
237
|
-
recognitionNotification.title,
|
|
238
|
-
recognitionNotification.text,
|
|
239
|
-
recognitionNotification.channel.id,
|
|
240
|
-
recognitionNotification.channel.name,
|
|
241
|
-
recognitionNotification.channel.description,
|
|
242
|
-
tripNotification.title,
|
|
243
|
-
tripNotification.text,
|
|
244
|
-
tripNotification.channel.id,
|
|
245
|
-
tripNotification.channel.name,
|
|
246
|
-
tripNotification.channel.description,
|
|
247
|
-
];
|
|
225
|
+
platformParams = [recognitionNotification.title, recognitionNotification.text, tripNotification.title, tripNotification.text];
|
|
248
226
|
}
|
|
249
227
|
|
|
250
228
|
return await NativeMoveSdk.setupWithCode(
|
|
@@ -384,7 +362,7 @@ export default class MoveSdk {
|
|
|
384
362
|
|
|
385
363
|
static addLogListener(logReceived: (event: MoveSdkLog) => void): ListenerSubscription {
|
|
386
364
|
return eventEmitter.addListener('MOVE_SDK_LOG', (event) => {
|
|
387
|
-
|
|
365
|
+
logReceived(event);
|
|
388
366
|
});
|
|
389
367
|
}
|
|
390
368
|
|
|
@@ -414,6 +392,14 @@ export default class MoveSdk {
|
|
|
414
392
|
}
|
|
415
393
|
}
|
|
416
394
|
|
|
395
|
+
static async getBluetoothPermission(): Promise<boolean> {
|
|
396
|
+
return await NativeMoveSdk.getBluetoothPermission();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
static async getBluetoothState(): Promise<boolean> {
|
|
400
|
+
return await NativeMoveSdk.getBluetoothState();
|
|
401
|
+
}
|
|
402
|
+
|
|
417
403
|
static async shutdown(force: boolean = true): Promise<ShutdownReturnType> {
|
|
418
404
|
return await NativeMoveSdk.shutdown(force);
|
|
419
405
|
}
|
|
@@ -495,7 +481,7 @@ export default class MoveSdk {
|
|
|
495
481
|
}
|
|
496
482
|
|
|
497
483
|
static addDeviceStateListener(onScanResult: (results: Array<MoveSdkDevice>) => void): ListenerSubscription {
|
|
498
|
-
return eventEmitter.addListener('MOVE_SDK_DEVICE_STATE', results => {
|
|
484
|
+
return eventEmitter.addListener('MOVE_SDK_DEVICE_STATE', (results) => {
|
|
499
485
|
onScanResult(results);
|
|
500
486
|
});
|
|
501
487
|
}
|
|
@@ -528,7 +514,7 @@ export default class MoveSdk {
|
|
|
528
514
|
NativeMoveSdk.updateConfig(timelineDetectionServices, drivingServices, walkingServices);
|
|
529
515
|
}
|
|
530
516
|
|
|
531
|
-
static setTripMetadata(metadata?: {[key: string]: string}) {
|
|
517
|
+
static setTripMetadata(metadata?: { [key: string]: string }) {
|
|
532
518
|
NativeMoveSdk.setTripMetadata(metadata);
|
|
533
519
|
}
|
|
534
520
|
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
package `in`.dolph.move.sdk
|
|
2
|
-
|
|
3
|
-
import android.app.NotificationChannel
|
|
4
|
-
import android.app.NotificationManager
|
|
5
|
-
import android.content.Context
|
|
6
|
-
import android.content.Context.NOTIFICATION_SERVICE
|
|
7
|
-
import androidx.core.app.NotificationCompat
|
|
8
|
-
import io.dolphin.move.MoveNotification
|
|
9
|
-
|
|
10
|
-
data class MoveNotificationConfig(
|
|
11
|
-
var title: String,
|
|
12
|
-
var text: String,
|
|
13
|
-
var icon: Int?,
|
|
14
|
-
var channelId: String,
|
|
15
|
-
var channelName: String,
|
|
16
|
-
var channelDescription: String
|
|
17
|
-
) {
|
|
18
|
-
|
|
19
|
-
fun toAndroidNotification(context: Context): NotificationCompat.Builder {
|
|
20
|
-
createChannel(context)
|
|
21
|
-
// TODO: Host app should decide on icon
|
|
22
|
-
return NotificationCompat.Builder(context, this.channelId)
|
|
23
|
-
.setSmallIcon(R.drawable.ic_notification)
|
|
24
|
-
.setContentTitle(this.title)
|
|
25
|
-
.setContentText(this.text)
|
|
26
|
-
.setChannelId(this.channelId)
|
|
27
|
-
.setSound(null)
|
|
28
|
-
.setSilent(true)
|
|
29
|
-
.setPriority(NotificationCompat.PRIORITY_MAX);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fun toMoveNotification(context: Context): MoveNotification {
|
|
33
|
-
createChannel(context)
|
|
34
|
-
return MoveNotification(
|
|
35
|
-
channelId = channelId,
|
|
36
|
-
contentText = text,
|
|
37
|
-
contentTitle = title,
|
|
38
|
-
drawableId = icon ?: R.drawable.ic_notification,
|
|
39
|
-
showWhen = false,
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private fun createChannel(context: Context) {
|
|
44
|
-
// Create the NotificationChannel
|
|
45
|
-
val importance = NotificationManager.IMPORTANCE_DEFAULT
|
|
46
|
-
val channel = NotificationChannel(channelId, channelName, importance)
|
|
47
|
-
channel.description = channelDescription
|
|
48
|
-
val notificationManager =
|
|
49
|
-
context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
|
50
|
-
notificationManager.createNotificationChannel(channel)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
package `in`.dolph.move.sdk
|
|
2
|
-
|
|
3
|
-
import io.dolphin.move.MoveAuth
|
|
4
|
-
import io.dolphin.move.MoveDetectionService
|
|
5
|
-
|
|
6
|
-
data class MoveSdkConfig(
|
|
7
|
-
val auth: MoveAuth,
|
|
8
|
-
// not used for now
|
|
9
|
-
val timelineDetectionServices: List<MoveDetectionService>,
|
|
10
|
-
val tripNotification: MoveNotificationConfig,
|
|
11
|
-
val recognitionNotification: MoveNotificationConfig,
|
|
12
|
-
val walkingNotification: MoveNotificationConfig,
|
|
13
|
-
)
|