@stream-io/video-react-native-sdk 1.2.15 → 1.2.17
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/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +8 -6
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/commonjs/utils/StreamVideoRN/index.js +7 -0
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/push/android.js +16 -4
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/libs/notifee.js +50 -5
- package/dist/commonjs/utils/push/libs/notifee.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +9 -7
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/module/utils/StreamVideoRN/index.js +7 -0
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/push/android.js +18 -6
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/libs/notifee.js +48 -5
- package/dist/module/utils/push/libs/notifee.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts +1 -1
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +4 -2
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/push/android.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/notifee.d.ts +20 -0
- package/dist/typescript/utils/push/libs/notifee.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/expo-config-plugin/dist/common/types.d.ts +1 -0
- package/expo-config-plugin/dist/withAndroidManifest.js +8 -4
- package/expo-config-plugin/dist/withAndroidPermissions.js +3 -0
- package/ios/StreamVideoReactNative.xcodeproj/project.xcworkspace/xcuserdata/santhoshvaiyapuri.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StreamVideoReactNative.xcodeproj/xcuserdata/santhoshvaiyapuri.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/package.json +7 -7
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +14 -8
- package/src/utils/StreamVideoRN/index.ts +7 -0
- package/src/utils/StreamVideoRN/types.ts +4 -2
- package/src/utils/push/android.ts +23 -4
- package/src/utils/push/libs/notifee.ts +58 -6
- package/src/version.ts +1 -1
- package/CHANGELOG.md +0 -1591
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getLogger } from '@stream-io/video-client';
|
|
2
|
+
import { PermissionsAndroid } from 'react-native';
|
|
3
|
+
var AndroidForegroundServiceType = /*#__PURE__*/function (AndroidForegroundServiceType) {
|
|
4
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CAMERA"] = 64] = "FOREGROUND_SERVICE_TYPE_CAMERA";
|
|
5
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE"] = 16] = "FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE";
|
|
6
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_DATA_SYNC"] = 1] = "FOREGROUND_SERVICE_TYPE_DATA_SYNC";
|
|
7
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_HEALTH"] = 256] = "FOREGROUND_SERVICE_TYPE_HEALTH";
|
|
8
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_LOCATION"] = 8] = "FOREGROUND_SERVICE_TYPE_LOCATION";
|
|
9
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK"] = 2] = "FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK";
|
|
10
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION"] = 32] = "FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION";
|
|
11
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING"] = 8192] = "FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING";
|
|
12
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MICROPHONE"] = 128] = "FOREGROUND_SERVICE_TYPE_MICROPHONE";
|
|
13
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_PHONE_CALL"] = 4] = "FOREGROUND_SERVICE_TYPE_PHONE_CALL";
|
|
14
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING"] = 512] = "FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING";
|
|
15
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_SHORT_SERVICE"] = 2048] = "FOREGROUND_SERVICE_TYPE_SHORT_SERVICE";
|
|
16
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_SPECIAL_USE"] = 1073741824] = "FOREGROUND_SERVICE_TYPE_SPECIAL_USE";
|
|
17
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED"] = 1024] = "FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED";
|
|
18
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MANIFEST"] = -1] = "FOREGROUND_SERVICE_TYPE_MANIFEST";
|
|
19
|
+
return AndroidForegroundServiceType;
|
|
20
|
+
}(AndroidForegroundServiceType || {});
|
|
3
21
|
let notifeeLib;
|
|
4
22
|
try {
|
|
5
23
|
notifeeLib = require('@notifee/react-native');
|
|
6
24
|
} catch (_e) {}
|
|
7
|
-
const isAndroid7OrBelow = Platform.OS === 'android' && Platform.Version < 26;
|
|
8
25
|
const INSTALLATION_INSTRUCTION = 'Please see https://notifee.app/react-native/docs/installation for installation instructions';
|
|
9
26
|
export function getNotifeeLibThrowIfNotInstalledForPush() {
|
|
10
27
|
if (!notifeeLib) {
|
|
@@ -13,10 +30,36 @@ export function getNotifeeLibThrowIfNotInstalledForPush() {
|
|
|
13
30
|
return notifeeLib;
|
|
14
31
|
}
|
|
15
32
|
export function getNotifeeLibNoThrowForKeepCallAlive() {
|
|
16
|
-
if (!notifeeLib
|
|
33
|
+
if (!notifeeLib) {
|
|
17
34
|
const logger = getLogger(['getNotifeeLibNoThrow']);
|
|
18
|
-
logger('info', `${'@notifee/react-native library not installed. It is required to keep call alive in the background for Android
|
|
35
|
+
logger('info', `${'@notifee/react-native library not installed. It is required to keep call alive in the background for Android. '}${INSTALLATION_INSTRUCTION}`);
|
|
19
36
|
}
|
|
20
37
|
return notifeeLib;
|
|
21
38
|
}
|
|
39
|
+
export async function getKeepCallAliveForegroundServiceTypes() {
|
|
40
|
+
const types = [];
|
|
41
|
+
const hasCameraPermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.CAMERA);
|
|
42
|
+
if (hasCameraPermission) {
|
|
43
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_CAMERA);
|
|
44
|
+
}
|
|
45
|
+
const hasMicrophonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
|
|
46
|
+
if (hasMicrophonePermission) {
|
|
47
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_MICROPHONE);
|
|
48
|
+
}
|
|
49
|
+
const hasConnectionPermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT);
|
|
50
|
+
if (hasConnectionPermission) {
|
|
51
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE);
|
|
52
|
+
}
|
|
53
|
+
if (types.length === 0) {
|
|
54
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
|
|
55
|
+
}
|
|
56
|
+
console.log({
|
|
57
|
+
types
|
|
58
|
+
});
|
|
59
|
+
return types;
|
|
60
|
+
}
|
|
61
|
+
export function getIncomingCallForegroundServiceTypes() {
|
|
62
|
+
const types = [AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE];
|
|
63
|
+
return types;
|
|
64
|
+
}
|
|
22
65
|
//# sourceMappingURL=notifee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getLogger","PermissionsAndroid","AndroidForegroundServiceType","notifeeLib","require","_e","INSTALLATION_INSTRUCTION","getNotifeeLibThrowIfNotInstalledForPush","Error","getNotifeeLibNoThrowForKeepCallAlive","logger","getKeepCallAliveForegroundServiceTypes","types","hasCameraPermission","check","PERMISSIONS","CAMERA","push","FOREGROUND_SERVICE_TYPE_CAMERA","hasMicrophonePermission","RECORD_AUDIO","FOREGROUND_SERVICE_TYPE_MICROPHONE","hasConnectionPermission","BLUETOOTH_CONNECT","FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE","length","FOREGROUND_SERVICE_TYPE_DATA_SYNC","console","log","getIncomingCallForegroundServiceTypes","FOREGROUND_SERVICE_TYPE_SHORT_SERVICE"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/notifee.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,kBAAkB,QAAQ,cAAc;AAAC,IAI7CC,4BAA4B,0BAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,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c,WAAW,CAACC,MACjC,CAAC;EACD,IAAIH,mBAAmB,EAAE;IACvBD,KAAK,CAACK,IAAI,CAACf,4BAA4B,CAACgB,8BAA8B,CAAC;EACzE;EACA,MAAMC,uBAAuB,GAAG,MAAMlB,kBAAkB,CAACa,KAAK,CAC5Db,kBAAkB,CAACc,WAAW,CAACK,YACjC,CAAC;EACD,IAAID,uBAAuB,EAAE;IAC3BP,KAAK,CAACK,IAAI,CAACf,4BAA4B,CAACmB,kCAAkC,CAAC;EAC7E;EACA,MAAMC,uBAAuB,GAAG,MAAMrB,kBAAkB,CAACa,KAAK,CAC5Db,kBAAkB,CAACc,WAAW,CAACQ,iBACjC,CAAC;EACD,IAAID,uBAAuB,EAAE;IAC3BV,KAAK,CAACK,IAAI,CACRf,4BAA4B,CAACsB,wCAC/B,CAAC;EACH;EACA,IAAIZ,KAAK,CAACa,MAAM,KAAK,CAAC,EAAE;IACtBb,KAAK,CAACK,IAAI,CAACf,4BAA4B,CAACwB,iCAAiC,CAAC;EAC5E;EACAC,OAAO,CAACC,GAAG,CAAC;IAAEhB;EAAM,CAAC,CAAC;EACtB,OAAOA,KAAK;AACd;AAEA,OAAO,SAASiB,qCAAqCA,CAAA,EAAG;EACtD,MAAMjB,KAAqC,GAAG,CAC5CV,4BAA4B,CAAC4B,qCAAqC,CACnE;EACD,OAAOlB,KAAK;AACd","ignoreList":[]}
|
package/dist/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '1.2.
|
|
1
|
+
export const version = '1.2.17';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This hook is used to keep the call alive in the background for Android.
|
|
3
3
|
* It starts a foreground service to keep the call alive as soon as the call is joined
|
|
4
4
|
* and stops the foreground Service when the call is left.
|
|
5
|
-
*
|
|
5
|
+
* Additionally: also responsible for cancelling any notifee displayed notification when the call has transitioned out of ringing
|
|
6
6
|
*/
|
|
7
7
|
export declare const useAndroidKeepCallAliveEffect: () => void;
|
|
8
8
|
//# sourceMappingURL=useAndroidKeepCallAliveEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAndroidKeepCallAliveEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAndroidKeepCallAliveEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":"AAgEA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAgFzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAiC,EAC/B,2BAA2B,EAC5B,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAiC,EAC/B,2BAA2B,EAC5B,MAAM,sCAAsC,CAAC;AAoB9C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,MAAM,CAA+B;IAEpD;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAO1E,MAAM,CAAC,gCAAgC,CACrC,aAAa,EAAE,OAAO,CACpB,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CACzE;IAWH;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAYvE,MAAM,CAAC,SAAS;IAIhB;;;OAGG;IACH,MAAM,CAAC,YAAY;IASnB;;;;OAIG;IACH,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,2BAA2B;CAYxC"}
|
|
@@ -111,10 +111,12 @@ export type StreamVideoConfig = {
|
|
|
111
111
|
};
|
|
112
112
|
foregroundService: {
|
|
113
113
|
android: {
|
|
114
|
+
/**
|
|
115
|
+
* The notification channel to keep call alive in the background for Android using a foreground service.
|
|
116
|
+
*/
|
|
117
|
+
channel: AndroidChannel;
|
|
114
118
|
/**
|
|
115
119
|
* The texts shown in the notification to keep call alive in the background
|
|
116
|
-
* for Android 24 and 25 platforms using a foreground service.
|
|
117
|
-
* On Android 26 and above, Picture in Picture mode is used to keep the call alive.
|
|
118
120
|
*/
|
|
119
121
|
notificationTexts: {
|
|
120
122
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;WAIG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,GAAG,EAAE;YACH;;;;eAIG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;SAC3B,CAAC;QACF,OAAO,EAAE;YACP;;;;eAIG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B;;;;;;;;;eASG;YACH,WAAW,CAAC,EAAE,cAAc,CAAC;YAC7B;;;;;;;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d,IAAI,EAAE,MAAM,CAAC;aACd,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/android.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/android.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AA8BhC,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAYzD,2CAA2C;AAC3C,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,UAAU,QA8EjE;AAED,0DAA0D;AAC1D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,iBA+C1D"}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
export type NotifeeLib = typeof import('@notifee/react-native');
|
|
2
|
+
declare enum AndroidForegroundServiceType {
|
|
3
|
+
FOREGROUND_SERVICE_TYPE_CAMERA = 64,
|
|
4
|
+
FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE = 16,
|
|
5
|
+
FOREGROUND_SERVICE_TYPE_DATA_SYNC = 1,
|
|
6
|
+
FOREGROUND_SERVICE_TYPE_HEALTH = 256,
|
|
7
|
+
FOREGROUND_SERVICE_TYPE_LOCATION = 8,
|
|
8
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK = 2,
|
|
9
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 32,
|
|
10
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING = 8192,
|
|
11
|
+
FOREGROUND_SERVICE_TYPE_MICROPHONE = 128,
|
|
12
|
+
FOREGROUND_SERVICE_TYPE_PHONE_CALL = 4,
|
|
13
|
+
FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING = 512,
|
|
14
|
+
FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 2048,
|
|
15
|
+
FOREGROUND_SERVICE_TYPE_SPECIAL_USE = 1073741824,
|
|
16
|
+
FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED = 1024,
|
|
17
|
+
FOREGROUND_SERVICE_TYPE_MANIFEST = -1
|
|
18
|
+
}
|
|
2
19
|
export declare function getNotifeeLibThrowIfNotInstalledForPush(): typeof import("@notifee/react-native");
|
|
3
20
|
export declare function getNotifeeLibNoThrowForKeepCallAlive(): typeof import("@notifee/react-native") | undefined;
|
|
21
|
+
export declare function getKeepCallAliveForegroundServiceTypes(): Promise<AndroidForegroundServiceType[]>;
|
|
22
|
+
export declare function getIncomingCallForegroundServiceTypes(): AndroidForegroundServiceType[];
|
|
23
|
+
export {};
|
|
4
24
|
//# sourceMappingURL=notifee.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifee.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/notifee.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,cAAc,uBAAuB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"notifee.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/notifee.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,cAAc,uBAAuB,CAAC,CAAC;AAEhE,aAAK,4BAA4B;IAC/B,8BAA8B,KAAK;IACnC,wCAAwC,KAAK;IAC7C,iCAAiC,IAAI;IACrC,8BAA8B,MAAM;IACpC,gCAAgC,IAAI;IACpC,sCAAsC,IAAI;IAC1C,wCAAwC,KAAK;IAC7C,wCAAwC,OAAO;IAC/C,kCAAkC,MAAM;IACxC,kCAAkC,IAAI;IACtC,wCAAwC,MAAM;IAC9C,qCAAqC,OAAO;IAC5C,mCAAmC,aAAa;IAChD,uCAAuC,OAAO;IAC9C,gCAAgC,KAAK;CACtC;AAWD,wBAAgB,uCAAuC,2CAQtD;AAED,wBAAgB,oCAAoC,uDASnD;AAED,wBAAsB,sCAAsC,4CA2B3D;AAED,wBAAgB,qCAAqC,mCAKpD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.2.
|
|
1
|
+
export declare const version = "1.2.17";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -10,6 +10,7 @@ export type ConfigProps = {
|
|
|
10
10
|
ringingPushNotifications?: RingingPushNotifications;
|
|
11
11
|
enableNonRingingPushNotifications?: boolean;
|
|
12
12
|
androidPictureInPicture?: AndroidPictureInPicture;
|
|
13
|
+
androidKeepCallAlive?: boolean;
|
|
13
14
|
enableScreenshare?: boolean;
|
|
14
15
|
appleTeamId?: string;
|
|
15
16
|
} | undefined;
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
4
|
const { prefixAndroidKeys, getMainApplicationOrThrow, getMainActivityOrThrow } = config_plugins_1.AndroidConfig.Manifest;
|
|
5
|
-
function getNotifeeService() {
|
|
5
|
+
function getNotifeeService(isKeepCallAliveEnabled = false) {
|
|
6
6
|
/* We add this service to the AndroidManifest.xml:
|
|
7
7
|
<service
|
|
8
8
|
android:name="app.notifee.core.ForegroundService"
|
|
9
9
|
android:stopWithTask="true"
|
|
10
10
|
android:foregroundServiceType="shortService" />
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
let foregroundServiceType = 'shortService';
|
|
13
|
+
if (isKeepCallAliveEnabled) {
|
|
14
|
+
foregroundServiceType =
|
|
15
|
+
'dataSync|camera|microphone|connectedDevice|' + foregroundServiceType;
|
|
16
|
+
}
|
|
13
17
|
let head = prefixAndroidKeys({
|
|
14
18
|
name: 'app.notifee.core.ForegroundService',
|
|
15
19
|
stopWithTask: 'true',
|
|
@@ -24,12 +28,12 @@ const withStreamVideoReactNativeSDKManifest = (configuration, props) => {
|
|
|
24
28
|
return (0, config_plugins_1.withAndroidManifest)(configuration, (config) => {
|
|
25
29
|
const androidManifest = config.modResults;
|
|
26
30
|
const mainApplication = getMainApplicationOrThrow(androidManifest);
|
|
27
|
-
if (props?.ringingPushNotifications) {
|
|
31
|
+
if (props?.ringingPushNotifications || props?.androidKeepCallAlive) {
|
|
28
32
|
/* Add the notifee foreground Service */
|
|
29
33
|
let services = mainApplication.service ?? [];
|
|
30
34
|
// we filter out the existing notifee service (if any) so that we can override it
|
|
31
35
|
services = services.filter((service) => service.$['android:name'] !== 'app.notifee.core.ForegroundService');
|
|
32
|
-
services.push(getNotifeeService());
|
|
36
|
+
services.push(getNotifeeService(!!props?.androidKeepCallAlive));
|
|
33
37
|
mainApplication.service = services;
|
|
34
38
|
}
|
|
35
39
|
if (props?.androidPictureInPicture) {
|
|
@@ -13,6 +13,9 @@ const withStreamVideoReactNativeSDKAndroidPermissions = (configuration, props) =
|
|
|
13
13
|
permissions.push('android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION');
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
if (props?.androidKeepCallAlive) {
|
|
17
|
+
permissions.push('android.permission.FOREGROUND_SERVICE_CAMERA', 'android.permission.FOREGROUND_SERVICE_MICROPHONE', 'android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE', 'android.permission.FOREGROUND_SERVICE_DATA_SYNC');
|
|
18
|
+
}
|
|
16
19
|
if (props?.ringingPushNotifications?.showWhenLockedAndroid) {
|
|
17
20
|
permissions.push('android.permission.USE_FULL_SCREEN_INTENT');
|
|
18
21
|
}
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>StreamVideoReactNative.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-native-sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"!**/.*"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@stream-io/video-client": "1.11.
|
|
50
|
-
"@stream-io/video-react-bindings": "1.1.
|
|
49
|
+
"@stream-io/video-client": "1.11.3",
|
|
50
|
+
"@stream-io/video-react-bindings": "1.1.20",
|
|
51
51
|
"intl-pluralrules": "2.0.1",
|
|
52
52
|
"lodash.merge": "^4.6.2",
|
|
53
53
|
"react-native-url-polyfill": "1.3.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"text-encoding-polyfill": "0.6.7"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@notifee/react-native": ">=
|
|
58
|
+
"@notifee/react-native": ">=9.0.0",
|
|
59
59
|
"@react-native-community/netinfo": ">=9.0.0",
|
|
60
60
|
"@react-native-community/push-notification-ios": ">=1.11.0",
|
|
61
61
|
"@react-native-firebase/app": ">=17.5.0",
|
|
@@ -119,14 +119,14 @@
|
|
|
119
119
|
"devDependencies": {
|
|
120
120
|
"@babel/preset-typescript": "^7.24.7",
|
|
121
121
|
"@expo/config-plugins": "~7.8.4",
|
|
122
|
-
"@notifee/react-native": "
|
|
122
|
+
"@notifee/react-native": "9.1.2",
|
|
123
123
|
"@react-native-community/netinfo": "9.3.9",
|
|
124
124
|
"@react-native-community/push-notification-ios": "1.11.0",
|
|
125
125
|
"@react-native-firebase/app": "17.5.0",
|
|
126
126
|
"@react-native-firebase/messaging": "17.5.0",
|
|
127
127
|
"@react-native/eslint-config": "^0.74.84",
|
|
128
128
|
"@stream-io/react-native-webrtc": "118.1.0",
|
|
129
|
-
"@stream-io/video-filters-react-native": "
|
|
129
|
+
"@stream-io/video-filters-react-native": "workspace:^",
|
|
130
130
|
"@testing-library/jest-native": "^5.4.2",
|
|
131
131
|
"@testing-library/react-native": "^12.1.2",
|
|
132
132
|
"@tsconfig/node14": "14.1.0",
|
|
@@ -168,4 +168,4 @@
|
|
|
168
168
|
"typescript"
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
|
-
}
|
|
171
|
+
}
|
|
@@ -3,14 +3,14 @@ import { useEffect, useRef } from 'react';
|
|
|
3
3
|
import { StreamVideoRN } from '../utils';
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
import { CallingState, getLogger } from '@stream-io/video-client';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import {
|
|
7
|
+
getNotifeeLibNoThrowForKeepCallAlive,
|
|
8
|
+
getKeepCallAliveForegroundServiceTypes,
|
|
9
|
+
} from '../utils/push/libs/notifee';
|
|
9
10
|
|
|
10
11
|
const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
|
|
11
12
|
|
|
12
13
|
function setForegroundService() {
|
|
13
|
-
if (!isAndroid7OrBelow) return;
|
|
14
14
|
notifeeLib?.default.registerForegroundService(() => {
|
|
15
15
|
return new Promise(() => {
|
|
16
16
|
const logger = getLogger(['setForegroundService method']);
|
|
@@ -20,7 +20,6 @@ function setForegroundService() {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async function startForegroundService(call_cid: string) {
|
|
23
|
-
if (!isAndroid7OrBelow) return;
|
|
24
23
|
const foregroundServiceConfig = StreamVideoRN.getConfig().foregroundService;
|
|
25
24
|
const { title, body } = foregroundServiceConfig.android.notificationTexts;
|
|
26
25
|
|
|
@@ -37,11 +36,18 @@ async function startForegroundService(call_cid: string) {
|
|
|
37
36
|
);
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
39
|
+
const channelId = foregroundServiceConfig.android.channel.id;
|
|
40
|
+
await notifeeLib.default.createChannel(
|
|
41
|
+
foregroundServiceConfig.android.channel
|
|
42
|
+
);
|
|
43
|
+
const foregroundServiceTypes = await getKeepCallAliveForegroundServiceTypes();
|
|
40
44
|
await notifeeLib.default.displayNotification({
|
|
41
45
|
id: call_cid,
|
|
42
46
|
title,
|
|
43
47
|
body,
|
|
44
48
|
android: {
|
|
49
|
+
channelId,
|
|
50
|
+
foregroundServiceTypes,
|
|
45
51
|
asForegroundService: true,
|
|
46
52
|
ongoing: true, // user cannot dismiss the notification
|
|
47
53
|
colorized: true,
|
|
@@ -60,10 +66,10 @@ let isSetForegroundServiceRan = false;
|
|
|
60
66
|
* This hook is used to keep the call alive in the background for Android.
|
|
61
67
|
* It starts a foreground service to keep the call alive as soon as the call is joined
|
|
62
68
|
* and stops the foreground Service when the call is left.
|
|
63
|
-
*
|
|
69
|
+
* Additionally: also responsible for cancelling any notifee displayed notification when the call has transitioned out of ringing
|
|
64
70
|
*/
|
|
65
71
|
export const useAndroidKeepCallAliveEffect = () => {
|
|
66
|
-
if (!isSetForegroundServiceRan
|
|
72
|
+
if (!isSetForegroundServiceRan) {
|
|
67
73
|
isSetForegroundServiceRan = true;
|
|
68
74
|
setForegroundService();
|
|
69
75
|
}
|
|
@@ -74,10 +80,10 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
74
80
|
const callingState = useCallCallingState();
|
|
75
81
|
|
|
76
82
|
useEffect((): (() => void) | undefined => {
|
|
77
|
-
if (!notifeeLib) return;
|
|
78
83
|
if (Platform.OS === 'ios' || !activeCallCid) {
|
|
79
84
|
return;
|
|
80
85
|
}
|
|
86
|
+
if (!notifeeLib) return;
|
|
81
87
|
|
|
82
88
|
// start foreground service as soon as the call is joined
|
|
83
89
|
if (callingState === CallingState.JOINED) {
|
|
@@ -9,6 +9,13 @@ import newNotificationCallbacks, {
|
|
|
9
9
|
const DEFAULT_STREAM_VIDEO_CONFIG: StreamVideoConfig = {
|
|
10
10
|
foregroundService: {
|
|
11
11
|
android: {
|
|
12
|
+
channel: {
|
|
13
|
+
id: 'stream_call_foreground_service',
|
|
14
|
+
name: 'To keep calls alive',
|
|
15
|
+
lights: false,
|
|
16
|
+
vibration: false,
|
|
17
|
+
importance: 3,
|
|
18
|
+
},
|
|
12
19
|
notificationTexts: {
|
|
13
20
|
title: 'Call in progress',
|
|
14
21
|
body: 'Tap to return to the call',
|
|
@@ -119,10 +119,12 @@ export type StreamVideoConfig = {
|
|
|
119
119
|
};
|
|
120
120
|
foregroundService: {
|
|
121
121
|
android: {
|
|
122
|
+
/**
|
|
123
|
+
* The notification channel to keep call alive in the background for Android using a foreground service.
|
|
124
|
+
*/
|
|
125
|
+
channel: AndroidChannel;
|
|
122
126
|
/**
|
|
123
127
|
* The texts shown in the notification to keep call alive in the background
|
|
124
|
-
* for Android 24 and 25 platforms using a foreground service.
|
|
125
|
-
* On Android 26 and above, Picture in Picture mode is used to keep the call alive.
|
|
126
128
|
*/
|
|
127
129
|
notificationTexts: {
|
|
128
130
|
title: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
|
|
2
2
|
import {
|
|
3
3
|
Call,
|
|
4
|
+
CallingState,
|
|
4
5
|
RxUtils,
|
|
5
6
|
StreamVideoClient,
|
|
6
7
|
getLogger,
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
getExpoTaskManagerLib,
|
|
18
19
|
getNotifeeLibThrowIfNotInstalledForPush,
|
|
19
20
|
NotifeeLib,
|
|
21
|
+
getIncomingCallForegroundServiceTypes,
|
|
20
22
|
} from './libs';
|
|
21
23
|
import {
|
|
22
24
|
pushAcceptedIncomingCallCId$,
|
|
@@ -212,14 +214,14 @@ const firebaseMessagingOnMessageHandler = async (
|
|
|
212
214
|
const created_by_id = data.created_by_id as string;
|
|
213
215
|
const receiver_id = data.receiver_id as string;
|
|
214
216
|
|
|
215
|
-
|
|
217
|
+
const shouldCallBeClosed = (callToCheck: Call) => {
|
|
216
218
|
const { mustEndCall } = shouldCallBeEnded(
|
|
217
219
|
callToCheck,
|
|
218
220
|
created_by_id,
|
|
219
221
|
receiver_id
|
|
220
222
|
);
|
|
221
223
|
return mustEndCall;
|
|
222
|
-
}
|
|
224
|
+
};
|
|
223
225
|
|
|
224
226
|
const canListenToWS = () =>
|
|
225
227
|
canAddPushWSSubscriptionsRef.current &&
|
|
@@ -244,17 +246,33 @@ const firebaseMessagingOnMessageHandler = async (
|
|
|
244
246
|
notifee.stopForegroundService();
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
249
|
+
const unsubscribeFunctions: Array<() => void> = [];
|
|
250
|
+
// check if service needs to be closed if accept/decline event was done on another device
|
|
247
251
|
const unsubscribe = callFromPush.on('all', () => {
|
|
248
252
|
if (!canListenToWS() || shouldCallBeClosed(callFromPush)) {
|
|
249
|
-
|
|
253
|
+
unsubscribeFunctions.forEach((fn) => fn());
|
|
250
254
|
notifee.stopForegroundService();
|
|
251
255
|
}
|
|
252
256
|
});
|
|
257
|
+
// check if service needs to be closed if call was left
|
|
258
|
+
const subscription = callFromPush.state.callingState$.subscribe(
|
|
259
|
+
(callingState) => {
|
|
260
|
+
if (
|
|
261
|
+
callingState === CallingState.IDLE ||
|
|
262
|
+
callingState === CallingState.LEFT
|
|
263
|
+
) {
|
|
264
|
+
unsubscribeFunctions.forEach((fn) => fn());
|
|
265
|
+
notifee.stopForegroundService();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
unsubscribeFunctions.push(unsubscribe);
|
|
270
|
+
unsubscribeFunctions.push(() => subscription.unsubscribe());
|
|
253
271
|
const unsubscriptionCallbacks =
|
|
254
272
|
RxUtils.getCurrentValue(pushUnsubscriptionCallbacks$) ?? [];
|
|
255
273
|
pushUnsubscriptionCallbacks$.next([
|
|
256
274
|
...unsubscriptionCallbacks,
|
|
257
|
-
|
|
275
|
+
...unsubscribeFunctions,
|
|
258
276
|
]);
|
|
259
277
|
});
|
|
260
278
|
});
|
|
@@ -290,6 +308,7 @@ const firebaseMessagingOnMessageHandler = async (
|
|
|
290
308
|
data,
|
|
291
309
|
android: {
|
|
292
310
|
channelId,
|
|
311
|
+
foregroundServiceTypes: getIncomingCallForegroundServiceTypes(),
|
|
293
312
|
asForegroundService,
|
|
294
313
|
sound: incomingCallChannel.sound,
|
|
295
314
|
vibrationPattern: incomingCallChannel.vibrationPattern,
|
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getLogger } from '@stream-io/video-client';
|
|
2
|
+
import { PermissionsAndroid } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export type NotifeeLib = typeof import('@notifee/react-native');
|
|
5
5
|
|
|
6
|
+
enum AndroidForegroundServiceType {
|
|
7
|
+
FOREGROUND_SERVICE_TYPE_CAMERA = 64,
|
|
8
|
+
FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE = 16,
|
|
9
|
+
FOREGROUND_SERVICE_TYPE_DATA_SYNC = 1,
|
|
10
|
+
FOREGROUND_SERVICE_TYPE_HEALTH = 256,
|
|
11
|
+
FOREGROUND_SERVICE_TYPE_LOCATION = 8,
|
|
12
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK = 2,
|
|
13
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 32,
|
|
14
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING = 8192,
|
|
15
|
+
FOREGROUND_SERVICE_TYPE_MICROPHONE = 128,
|
|
16
|
+
FOREGROUND_SERVICE_TYPE_PHONE_CALL = 4,
|
|
17
|
+
FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING = 512,
|
|
18
|
+
FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 2048,
|
|
19
|
+
FOREGROUND_SERVICE_TYPE_SPECIAL_USE = 1073741824,
|
|
20
|
+
FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED = 1024,
|
|
21
|
+
FOREGROUND_SERVICE_TYPE_MANIFEST = -1,
|
|
22
|
+
}
|
|
23
|
+
|
|
6
24
|
let notifeeLib: NotifeeLib | undefined;
|
|
7
25
|
|
|
8
26
|
try {
|
|
9
27
|
notifeeLib = require('@notifee/react-native');
|
|
10
28
|
} catch (_e) {}
|
|
11
29
|
|
|
12
|
-
const isAndroid7OrBelow = Platform.OS === 'android' && Platform.Version < 26;
|
|
13
|
-
|
|
14
30
|
const INSTALLATION_INSTRUCTION =
|
|
15
31
|
'Please see https://notifee.app/react-native/docs/installation for installation instructions';
|
|
16
32
|
|
|
@@ -25,12 +41,48 @@ export function getNotifeeLibThrowIfNotInstalledForPush() {
|
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
export function getNotifeeLibNoThrowForKeepCallAlive() {
|
|
28
|
-
if (!notifeeLib
|
|
44
|
+
if (!notifeeLib) {
|
|
29
45
|
const logger = getLogger(['getNotifeeLibNoThrow']);
|
|
30
46
|
logger(
|
|
31
47
|
'info',
|
|
32
|
-
`${'@notifee/react-native library not installed. It is required to keep call alive in the background for Android
|
|
48
|
+
`${'@notifee/react-native library not installed. It is required to keep call alive in the background for Android. '}${INSTALLATION_INSTRUCTION}`
|
|
33
49
|
);
|
|
34
50
|
}
|
|
35
51
|
return notifeeLib;
|
|
36
52
|
}
|
|
53
|
+
|
|
54
|
+
export async function getKeepCallAliveForegroundServiceTypes() {
|
|
55
|
+
const types: AndroidForegroundServiceType[] = [];
|
|
56
|
+
const hasCameraPermission = await PermissionsAndroid.check(
|
|
57
|
+
PermissionsAndroid.PERMISSIONS.CAMERA!
|
|
58
|
+
);
|
|
59
|
+
if (hasCameraPermission) {
|
|
60
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_CAMERA);
|
|
61
|
+
}
|
|
62
|
+
const hasMicrophonePermission = await PermissionsAndroid.check(
|
|
63
|
+
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO!
|
|
64
|
+
);
|
|
65
|
+
if (hasMicrophonePermission) {
|
|
66
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_MICROPHONE);
|
|
67
|
+
}
|
|
68
|
+
const hasConnectionPermission = await PermissionsAndroid.check(
|
|
69
|
+
PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT!
|
|
70
|
+
);
|
|
71
|
+
if (hasConnectionPermission) {
|
|
72
|
+
types.push(
|
|
73
|
+
AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (types.length === 0) {
|
|
77
|
+
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
|
|
78
|
+
}
|
|
79
|
+
console.log({ types });
|
|
80
|
+
return types;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function getIncomingCallForegroundServiceTypes() {
|
|
84
|
+
const types: AndroidForegroundServiceType[] = [
|
|
85
|
+
AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE,
|
|
86
|
+
];
|
|
87
|
+
return types;
|
|
88
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.2.
|
|
1
|
+
export const version = '1.2.17';
|