@stream-io/video-react-native-sdk 1.9.27 → 1.9.29

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.9.29](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.9.28...@stream-io/video-react-native-sdk-1.9.29) (2025-02-12)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * warn natively if notifee is not configured for keep call alive ([#1678](https://github.com/GetStream/stream-video-js/issues/1678)) ([f6f11ad](https://github.com/GetStream/stream-video-js/commit/f6f11ad5f691ce56f65d824e1ab12c6ebc7540c4)), closes [#1587](https://github.com/GetStream/stream-video-js/issues/1587)
11
+
12
+ ## [1.9.28](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.9.27...@stream-io/video-react-native-sdk-1.9.28) (2025-02-11)
13
+
14
+ ### Dependency Updates
15
+
16
+ * `@stream-io/video-client` updated to version `1.16.6`
17
+ * `@stream-io/video-react-bindings` updated to version `1.4.14`
18
+ * `@stream-io/video-filters-react-native` updated to version `0.2.7`
19
+
20
+ ### Bug Fixes
21
+
22
+ * prefer the async apply constraints for flip ([#1679](https://github.com/GetStream/stream-video-js/issues/1679)) ([8c246cc](https://github.com/GetStream/stream-video-js/commit/8c246cc4e9f1ac766366cf24b82dd99aa868017d))
23
+
5
24
  ## [1.9.27](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.9.26...@stream-io/video-react-native-sdk-1.9.27) (2025-02-10)
6
25
 
7
26
  ### Dependency Updates
@@ -12,6 +12,8 @@ import com.facebook.react.bridge.ReactApplicationContext
12
12
  import com.facebook.react.bridge.ReactContextBaseJavaModule
13
13
  import com.facebook.react.bridge.ReactMethod
14
14
  import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
15
+ import com.streamvideo.reactnative.util.CallAlivePermissionsHelper
16
+ import com.streamvideo.reactnative.util.CallAliveServiceChecker
15
17
  import com.streamvideo.reactnative.util.PiPHelper
16
18
  import com.streamvideo.reactnative.util.RingtoneUtil
17
19
 
@@ -59,6 +61,22 @@ class StreamVideoReactNativeModule(reactContext: ReactApplicationContext) :
59
61
  }
60
62
  }
61
63
 
64
+ @ReactMethod
65
+ fun isCallAliveConfigured(promise: Promise) {
66
+ val permissionsDeclared =
67
+ CallAlivePermissionsHelper.hasForegroundServicePermissionsDeclared(reactApplicationContext)
68
+ if (!permissionsDeclared) {
69
+ promise.resolve(false)
70
+ return
71
+ }
72
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
73
+ val isForegroundServiceDeclared = CallAliveServiceChecker.isForegroundServiceDeclared(reactApplicationContext)
74
+ promise.resolve(isForegroundServiceDeclared)
75
+ } else {
76
+ promise.resolve(true)
77
+ }
78
+ }
79
+
62
80
  @Suppress("UNUSED_PARAMETER")
63
81
  @ReactMethod
64
82
  fun addListener(eventName: String?) {
@@ -0,0 +1,54 @@
1
+ package com.streamvideo.reactnative.util
2
+
3
+ import android.content.pm.PackageInfo
4
+ import android.content.pm.PackageManager
5
+ import android.util.Log
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+
8
+
9
+ object CallAlivePermissionsHelper {
10
+ private const val NAME = "StreamVideoReactNative"
11
+
12
+ fun hasForegroundServicePermissionsDeclared(context: ReactApplicationContext): Boolean {
13
+ val packageManager = context.packageManager
14
+ val packageName = context.packageName
15
+
16
+ try {
17
+ val packageInfo: PackageInfo =
18
+ packageManager.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS)
19
+ val requestedPermissions = packageInfo.requestedPermissions
20
+
21
+ if (requestedPermissions != null) {
22
+ val requiredPermissions = arrayOf(
23
+ "android.permission.FOREGROUND_SERVICE",
24
+ "android.permission.FOREGROUND_SERVICE_CAMERA",
25
+ "android.permission.FOREGROUND_SERVICE_MICROPHONE",
26
+ "android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE",
27
+ "android.permission.FOREGROUND_SERVICE_DATA_SYNC"
28
+ )
29
+
30
+ val missingPermissions =
31
+ requiredPermissions.filterNot { requestedPermissions.contains(it) }
32
+
33
+ if (missingPermissions.isNotEmpty()) {
34
+ Log.w(
35
+ NAME,
36
+ "Missing ForegroundServicePermissions: ${missingPermissions.joinToString(", ")}"
37
+ )
38
+ return false
39
+ } else {
40
+ return true
41
+ }
42
+ }
43
+ } catch (e: PackageManager.NameNotFoundException) {
44
+ // do nothing, this can never happen actually
45
+ Log.e(
46
+ NAME,
47
+ "Package not found: $packageName",
48
+ e
49
+ )
50
+ }
51
+ return false
52
+ }
53
+
54
+ }
@@ -0,0 +1,96 @@
1
+ package com.streamvideo.reactnative.util
2
+
3
+ import android.content.ComponentName
4
+ import android.content.pm.PackageManager
5
+ import android.content.pm.ServiceInfo
6
+ import android.os.Build
7
+ import android.util.Log
8
+ import androidx.annotation.RequiresApi
9
+ import com.facebook.react.bridge.ReactApplicationContext
10
+
11
+ @RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
12
+ object CallAliveServiceChecker {
13
+ private const val NAME = "StreamVideoReactNative"
14
+
15
+ fun isForegroundServiceDeclared(context: ReactApplicationContext): Boolean {
16
+ val packageManager = context.packageManager
17
+ val packageName = context.packageName // Get the package name of your app
18
+ val componentName = ComponentName(
19
+ packageName,
20
+ "app.notifee.core.ForegroundService"
21
+ ) // Use service name string
22
+
23
+ try {
24
+ val serviceInfo =
25
+ packageManager.getServiceInfo(componentName, PackageManager.GET_META_DATA)
26
+
27
+ val expectedForegroundServiceTypes =
28
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE or
29
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC or
30
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA or
31
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE or
32
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
33
+
34
+ val actualForegroundServiceType = serviceInfo.foregroundServiceType
35
+
36
+ if (actualForegroundServiceType == expectedForegroundServiceTypes) {
37
+ return true
38
+ } else {
39
+ Log.w(
40
+ NAME,
41
+ "android:foregroundServiceType does not match: expected=${
42
+ foregroundServiceTypeToString(
43
+ expectedForegroundServiceTypes
44
+ )
45
+ }, actual=${foregroundServiceTypeToString(actualForegroundServiceType)}"
46
+ )
47
+ return false
48
+ }
49
+
50
+ } catch (e: PackageManager.NameNotFoundException) {
51
+ Log.d(NAME, "Service not found: " + e.message)
52
+ return false // Service not declared
53
+ }
54
+ }
55
+
56
+ private fun foregroundServiceTypeToString(foregroundServiceType: Int): String {
57
+ val types = mutableListOf<String>()
58
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE != 0) {
59
+ types.add("shortService")
60
+ }
61
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC != 0) {
62
+ types.add("dataSync")
63
+ }
64
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA != 0) {
65
+ types.add("camera")
66
+ }
67
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE != 0) {
68
+ types.add("microphone")
69
+ }
70
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE != 0) {
71
+ types.add("connectedDevice")
72
+ }
73
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION != 0) {
74
+ types.add("location")
75
+ }
76
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK != 0) {
77
+ types.add("mediaPlayback")
78
+ }
79
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION != 0) {
80
+ types.add("mediaProjection")
81
+ }
82
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL != 0) {
83
+ types.add("phoneCall")
84
+ }
85
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_HEALTH != 0) {
86
+ types.add("health")
87
+ }
88
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING != 0) {
89
+ types.add("remoteMessaging")
90
+ }
91
+ if (foregroundServiceType and ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED != 0) {
92
+ types.add("systemExempted")
93
+ }
94
+ return types.joinToString("|")
95
+ }
96
+ }
@@ -12,10 +12,18 @@ var _videoClient = require("@stream-io/video-client");
12
12
  var _notifee = require("../utils/push/libs/notifee");
13
13
  const notifeeLib = (0, _notifee.getNotifeeLibNoThrowForKeepCallAlive)();
14
14
  function setForegroundService() {
15
- notifeeLib?.default.registerForegroundService(() => {
16
- return new Promise(() => {
15
+ if (_reactNative.Platform.OS === 'ios' || !notifeeLib) return;
16
+ _reactNative.NativeModules.StreamVideoReactNative.isCallAliveConfigured().then(isConfigured => {
17
+ if (!isConfigured) {
17
18
  const logger = (0, _videoClient.getLogger)(['setForegroundService method']);
18
- logger('info', 'Foreground service running for call in progress');
19
+ logger('info', 'KeepCallAlive is not configured. Skipping foreground service setup.');
20
+ return;
21
+ }
22
+ notifeeLib.default.registerForegroundService(() => {
23
+ return new Promise(() => {
24
+ const logger = (0, _videoClient.getLogger)(['setForegroundService method']);
25
+ logger('info', 'Foreground service running for call in progress');
26
+ });
19
27
  });
20
28
  });
21
29
  }
@@ -28,6 +36,12 @@ async function startForegroundService(call_cid) {
28
36
 
29
37
  // check for notification permission and then start the foreground service
30
38
  if (!notifeeLib) return;
39
+ const isCallAliveConfigured = await _reactNative.NativeModules.StreamVideoReactNative.isCallAliveConfigured();
40
+ if (!isCallAliveConfigured) {
41
+ const logger = (0, _videoClient.getLogger)(['startForegroundService']);
42
+ logger('info', 'KeepCallAlive is not configured. Skipping foreground service setup.');
43
+ return;
44
+ }
31
45
  const settings = await notifeeLib.default.getNotificationSettings();
32
46
  if (settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED) {
33
47
  const logger = (0, _videoClient.getLogger)(['startForegroundService']);
@@ -1 +1 @@
1
- {"version":3,"names":["_videoReactBindings","require","_react","_utils","_reactNative","_videoClient","_notifee","notifeeLib","getNotifeeLibNoThrowForKeepCallAlive","setForegroundService","default","registerForegroundService","Promise","logger","getLogger","startForegroundService","call_cid","foregroundServiceConfig","StreamVideoRN","getConfig","foregroundService","title","body","android","notificationTexts","settings","getNotificationSettings","authorizationStatus","AuthorizationStatus","AUTHORIZED","channelId","channel","id","createChannel","foregroundServiceTypes","getKeepCallAliveForegroundServiceTypes","requestAnimationFrame","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","useRef","call","useCall","activeCallCid","cid","useCallCallingState","useCallStateHooks","callingState","isOutgoingCall","CallingState","RINGING","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","current","useEffect","Platform","OS","run","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","AppState","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT","then","exports"],"sourceRoot":"../../../src","sources":["hooks/useAndroidKeepCallAliveEffect.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,MAAMM,UAAU,GAAG,IAAAC,6CAAoC,EAAC,CAAC;AAEzD,SAASC,oBAAoBA,CAAA,EAAG;EAC9BF,UAAU,E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Bc,IAAI,CAAEf,sBAAsB,IAAK;UAChC,MAAME,sBAAsB,GAAGF,sBAAsB,CAACG,IAAI,CACvDC,YAAY,IAAKA,YAAY,CAACvC,EAAE,KAAKiB,aACxC,CAAC;UACD,IAAIoB,sBAAsB,EAAE;YAC1B;YACA9D,UAAU,CAACG,OAAO,CAAC8D,qBAAqB,CAAC,CAAC;UAC5C;QACF,CAAC,CAAC;MACN;IACF;EACF,CAAC,EAAE,CAACvB,aAAa,EAAEI,YAAY,EAAEO,4BAA4B,CAAC,CAAC;EAE/D,IAAAE,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAIjB,2BAA2B,CAACgB,OAAO,EAAE;QACvC,IAAI,CAACtD,UAAU,EAAE;QACjBA,UAAU,CAACG,OAAO,CAAC8D,qBAAqB,CAAC,CAAC;QAC1C3B,2BAA2B,CAACgB,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAACsB,OAAA,CAAAvC,6BAAA,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_videoReactBindings","require","_react","_utils","_reactNative","_videoClient","_notifee","notifeeLib","getNotifeeLibNoThrowForKeepCallAlive","setForegroundService","Platform","OS","NativeModules","StreamVideoReactNative","isCallAliveConfigured","then","isConfigured","logger","getLogger","default","registerForegroundService","Promise","startForegroundService","call_cid","foregroundServiceConfig","StreamVideoRN","getConfig","foregroundService","title","body","android","notificationTexts","settings","getNotificationSettings","authorizationStatus","AuthorizationStatus","AUTHORIZED","channelId","channel","id","createChannel","foregroundServiceTypes","getKeepCallAliveForegroundServiceTypes","requestAnimationFrame","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","useRef","call","useCall","activeCallCid","cid","useCallCallingState","useCallStateHooks","callingState","isOutgoingCall","CallingState","RINGING","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","current","useEffect","run","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","AppState","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT","exports"],"sourceRoot":"../../../src","sources":["hooks/useAndroidKeepCallAliveEffect.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,MAAMM,UAAU,GAAG,IAAAC,6CAAoC,EAAC,CAAC;AAEzD,SAASC,oBAAoBA,CAAA,EAAG;EAC9B,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,CAACJ,UAAU,EAAE;EAC1CK,0BAAa,CAACC,sBAAsB,CAACC,qBAAqB,CAAC,CAAC,CAACC,IAAI,CAC9DC,YAAqB,IAAK;IACzB,IAAI,CAACA,YAAY,EAAE;MACjB,MAAMC,MAAM,GAAG,IAAAC,sBAAS,EAAC,CAAC,6BAA6B,CAAC,CAAC;MACzDD,MAAM,CACJ,MAAM,EACN,qEACF,CAAC;MACD;IACF;IACAV,UAAU,CAACY,OAAO,CAACC,yBAAyB,CAAC,MAAM;MACjD,OAAO,IAAIC,OAAO,CAAC,MAAM;QACvB,MAAMJ,MAAM,GAAG,IAAAC,sBAAS,EAAC,CAAC,6BAA6B,CAAC,CAAC;QACzDD,MAAM,CAAC,MAAM,EAAE,iDAAiD,CAAC;MACnE,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CACF,CAAC;AACH;AAEA,eAAeK,sBAAsBA,CAACC,QAAgB,EAAE;EACtD,MAAMC,uBAAuB,GAAGC,oBAAa,CAACC,SAAS,CAAC,CAAC,CAACC,iBAAiB;EAC3E,MAAM;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGL,uBAA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AC1B;YACAnE,UAAU,CAACY,OAAO,CAAC0D,qBAAqB,CAAC,CAAC;UAC5C;QACF,CAAC,CAAC;MACN;IACF;EACF,CAAC,EAAE,CAACrB,aAAa,EAAEI,YAAY,EAAEO,4BAA4B,CAAC,CAAC;EAE/D,IAAAE,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAIjB,2BAA2B,CAACgB,OAAO,EAAE;QACvC,IAAI,CAAC7D,UAAU,EAAE;QACjBA,UAAU,CAACY,OAAO,CAAC0D,qBAAqB,CAAC,CAAC;QAC1CzB,2BAA2B,CAACgB,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAACmB,OAAA,CAAApC,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- const version = exports.version = '1.9.27';
7
+ const version = exports.version = '1.9.29';
8
8
  //# sourceMappingURL=version.js.map
@@ -1,15 +1,23 @@
1
1
  import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
2
2
  import { useEffect, useRef } from 'react';
3
3
  import { StreamVideoRN } from '../utils';
4
- import { AppState, Platform } from 'react-native';
4
+ import { NativeModules, AppState, Platform } from 'react-native';
5
5
  import { CallingState, getLogger } from '@stream-io/video-client';
6
6
  import { getNotifeeLibNoThrowForKeepCallAlive, getKeepCallAliveForegroundServiceTypes } from '../utils/push/libs/notifee';
7
7
  const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
8
8
  function setForegroundService() {
9
- notifeeLib?.default.registerForegroundService(() => {
10
- return new Promise(() => {
9
+ if (Platform.OS === 'ios' || !notifeeLib) return;
10
+ NativeModules.StreamVideoReactNative.isCallAliveConfigured().then(isConfigured => {
11
+ if (!isConfigured) {
11
12
  const logger = getLogger(['setForegroundService method']);
12
- logger('info', 'Foreground service running for call in progress');
13
+ logger('info', 'KeepCallAlive is not configured. Skipping foreground service setup.');
14
+ return;
15
+ }
16
+ notifeeLib.default.registerForegroundService(() => {
17
+ return new Promise(() => {
18
+ const logger = getLogger(['setForegroundService method']);
19
+ logger('info', 'Foreground service running for call in progress');
20
+ });
13
21
  });
14
22
  });
15
23
  }
@@ -22,6 +30,12 @@ async function startForegroundService(call_cid) {
22
30
 
23
31
  // check for notification permission and then start the foreground service
24
32
  if (!notifeeLib) return;
33
+ const isCallAliveConfigured = await NativeModules.StreamVideoReactNative.isCallAliveConfigured();
34
+ if (!isCallAliveConfigured) {
35
+ const logger = getLogger(['startForegroundService']);
36
+ logger('info', 'KeepCallAlive is not configured. Skipping foreground service setup.');
37
+ return;
38
+ }
25
39
  const settings = await notifeeLib.default.getNotificationSettings();
26
40
  if (settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED) {
27
41
  const logger = getLogger(['startForegroundService']);
@@ -1 +1 @@
1
- {"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","AppState","Platform","CallingState","getLogger","getNotifeeLibNoThrowForKeepCallAlive","getKeepCallAliveForegroundServiceTypes","notifeeLib","setForegroundService","default","registerForegroundService","Promise","logger","startForegroundService","call_cid","foregroundServiceConfig","getConfig","foregroundService","title","body","android","notificationTexts","settings","getNotificationSettings","authorizationStatus","AuthorizationStatus","AUTHORIZED","channelId","channel","id","createChannel","foregroundServiceTypes","requestAnimationFrame","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","call","activeCallCid","cid","useCallCallingState","callingState","isOutgoingCall","RINGING","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","current","OS","run","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT","then"],"sourceRoot":"../../../src","sources":["hooks/useAndroidKeepCallAliveEffect.ts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CAAC;MAC/D,CAAC;IACH,CAAC,MAAM,IACLG,YAAY,KAAK3C,YAAY,CAACkE,IAAI,IAClCvB,YAAY,KAAK3C,YAAY,CAACmE,IAAI,EAClC;MACA,IAAI7B,2BAA2B,CAACY,OAAO,EAAE;QACvC;QACA9C,UAAU,CAACE,OAAO,CAACqD,qBAAqB,CAAC,CAAC;QAC1CrB,2BAA2B,CAACY,OAAO,GAAG,KAAK;MAC7C,CAAC,MAAM;QACL9C,UAAU,CAACE,OAAO,CACfiD,yBAAyB,CAAC,CAAC,CAC3Ba,IAAI,CAAEd,sBAAsB,IAAK;UAChC,MAAME,sBAAsB,GAAGF,sBAAsB,CAACG,IAAI,CACvDC,YAAY,IAAKA,YAAY,CAAChC,EAAE,KAAKc,aACxC,CAAC;UACD,IAAIgB,sBAAsB,EAAE;YAC1B;YACApD,UAAU,CAACE,OAAO,CAACqD,qBAAqB,CAAC,CAAC;UAC5C;QACF,CAAC,CAAC;MACN;IACF;EACF,CAAC,EAAE,CAACnB,aAAa,EAAEG,YAAY,EAAEM,4BAA4B,CAAC,CAAC;EAE/DtD,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAI2C,2BAA2B,CAACY,OAAO,EAAE;QACvC,IAAI,CAAC9C,UAAU,EAAE;QACjBA,UAAU,CAACE,OAAO,CAACqD,qBAAqB,CAAC,CAAC;QAC1CrB,2BAA2B,CAACY,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","NativeModules","AppState","Platform","CallingState","getLogger","getNotifeeLibNoThrowForKeepCallAlive","getKeepCallAliveForegroundServiceTypes","notifeeLib","setForegroundService","OS","StreamVideoReactNative","isCallAliveConfigured","then","isConfigured","logger","default","registerForegroundService","Promise","startForegroundService","call_cid","foregroundServiceConfig","getConfig","foregroundService","title","body","android","notificationTexts","settings","getNotificationSettings","authorizationStatus","AuthorizationStatus","AUTHORIZED","channelId","channel","id","createChannel","foregroundServiceTypes","requestAnimationFrame","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","call","activeCallCid","cid","useCallCallingState","callingState","isOutgoingCall","RINGING","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","current","run","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT"],"sourceRoot":"../../../src","sources":["hooks/useAndroidKeepCallAliveEffect.ts"],"mappings":"AAAA,SAASA,OAAO,EAAEC,iBAAiB,QAAQ,iCAAiC;AAC5E,SAASC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,aAAa,QAAQ,UAAU;AACxC,SACEC,aAAa,EACbC,QAAQ,EAERC,QAAQ,QACH,cAAc;AACrB,SAASC,YAAY,EAAEC,SAAS,QAAQ,yBAAyB;AACjE,SACEC,oCAAoC,EACpCC,sCAAsC,QACjC,4BAA4B;AAEnC,MAAMC,UAAU,GAAGF,oCAAoC,CAAC,CAAC;AAEzD,SAASG,oBAAoBA,CAAA,EAAG;EAC9B,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAI,CAACF,UAAU,EAAE;EAC1CP,aAAa,CAACU,sBAAsB,CAACC,qBAAqB,CAAC,CAAC,CAACC,IAAI,CAC9DC,YAAqB,IAAK;IACzB,IAAI,CAACA,YAAY,EAAE;MACjB,MAAMC,MAAM,GAAGV,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAC;MACzDU,MAAM,CACJ,MAAM,EACN,qEACF,CAAC;MACD;IACF;IACAP,UAAU,CAACQ,OAAO,CAACC,yBAAyB,CAAC,MAAM;MACjD,OAAO,IAAIC,OAAO,CAAC,MAAM;QACvB,MAAMH,MAAM,GAAGV,SAAS,CAAC,CAAC,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,OAAO,GAAG,KAAK;MAC7C,CAAC,MAAM;QACLnD,UAAU,CAACQ,OAAO,CACf+C,yBAAyB,CAAC,CAAC,CAC3BlD,IAAI,CAAEiD,sBAAsB,IAAK;UAChC,MAAME,sBAAsB,GAAGF,sBAAsB,CAACG,IAAI,CACvDC,YAAY,IAAKA,YAAY,CAAC/B,EAAE,KAAKc,aACxC,CAAC;UACD,IAAIe,sBAAsB,EAAE;YAC1B;YACAxD,UAAU,CAACQ,OAAO,CAACmD,qBAAqB,CAAC,CAAC;UAC5C;QACF,CAAC,CAAC;MACN;IACF;EACF,CAAC,EAAE,CAAClB,aAAa,EAAEG,YAAY,EAAEM,4BAA4B,CAAC,CAAC;EAE/D5D,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAIiD,2BAA2B,CAACY,OAAO,EAAE;QACvC,IAAI,CAACnD,UAAU,EAAE;QACjBA,UAAU,CAACQ,OAAO,CAACmD,qBAAqB,CAAC,CAAC;QAC1CpB,2BAA2B,CAACY,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export const version = '1.9.27';
1
+ export const version = '1.9.29';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAndroidKeepCallAliveEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":"AAqEA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAyGzC,CAAC"}
1
+ {"version":3,"file":"useAndroidKeepCallAliveEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":"AAiGA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAyGzC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.9.27";
1
+ export declare const version = "1.9.29";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-native-sdk",
3
- "version": "1.9.27",
3
+ "version": "1.9.29",
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.16.5",
50
- "@stream-io/video-react-bindings": "1.4.13",
49
+ "@stream-io/video-client": "1.16.6",
50
+ "@stream-io/video-react-bindings": "1.4.14",
51
51
  "intl-pluralrules": "2.0.1",
52
52
  "lodash.merge": "^4.6.2",
53
53
  "react-native-url-polyfill": "1.3.0",
@@ -60,7 +60,7 @@
60
60
  "@react-native-community/push-notification-ios": ">=1.11.0",
61
61
  "@react-native-firebase/app": ">=17.5.0",
62
62
  "@react-native-firebase/messaging": ">=17.5.0",
63
- "@stream-io/react-native-webrtc": ">=125.0.4",
63
+ "@stream-io/react-native-webrtc": ">=125.0.5",
64
64
  "@stream-io/video-filters-react-native": ">=0.1.0",
65
65
  "expo": ">=47.0.0",
66
66
  "expo-build-properties": "*",
@@ -121,8 +121,8 @@
121
121
  "@react-native-firebase/app": "19.2.2",
122
122
  "@react-native-firebase/messaging": "19.2.2",
123
123
  "@react-native/eslint-config": "^0.74.84",
124
- "@stream-io/react-native-webrtc": "^125.0.4",
125
- "@stream-io/video-filters-react-native": "^0.2.6",
124
+ "@stream-io/react-native-webrtc": "^125.0.5",
125
+ "@stream-io/video-filters-react-native": "^0.2.7",
126
126
  "@testing-library/jest-native": "^5.4.2",
127
127
  "@testing-library/react-native": "^12.1.2",
128
128
  "@tsconfig/node14": "14.1.0",
@@ -1,7 +1,12 @@
1
1
  import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
2
2
  import { useEffect, useRef } from 'react';
3
3
  import { StreamVideoRN } from '../utils';
4
- import { AppState, AppStateStatus, Platform } from 'react-native';
4
+ import {
5
+ NativeModules,
6
+ AppState,
7
+ AppStateStatus,
8
+ Platform,
9
+ } from 'react-native';
5
10
  import { CallingState, getLogger } from '@stream-io/video-client';
6
11
  import {
7
12
  getNotifeeLibNoThrowForKeepCallAlive,
@@ -11,12 +16,25 @@ import {
11
16
  const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
12
17
 
13
18
  function setForegroundService() {
14
- notifeeLib?.default.registerForegroundService(() => {
15
- return new Promise(() => {
16
- const logger = getLogger(['setForegroundService method']);
17
- logger('info', 'Foreground service running for call in progress');
18
- });
19
- });
19
+ if (Platform.OS === 'ios' || !notifeeLib) return;
20
+ NativeModules.StreamVideoReactNative.isCallAliveConfigured().then(
21
+ (isConfigured: boolean) => {
22
+ if (!isConfigured) {
23
+ const logger = getLogger(['setForegroundService method']);
24
+ logger(
25
+ 'info',
26
+ 'KeepCallAlive is not configured. Skipping foreground service setup.'
27
+ );
28
+ return;
29
+ }
30
+ notifeeLib.default.registerForegroundService(() => {
31
+ return new Promise(() => {
32
+ const logger = getLogger(['setForegroundService method']);
33
+ logger('info', 'Foreground service running for call in progress');
34
+ });
35
+ });
36
+ }
37
+ );
20
38
  }
21
39
 
22
40
  async function startForegroundService(call_cid: string) {
@@ -25,6 +43,16 @@ async function startForegroundService(call_cid: string) {
25
43
 
26
44
  // check for notification permission and then start the foreground service
27
45
  if (!notifeeLib) return;
46
+ const isCallAliveConfigured =
47
+ await NativeModules.StreamVideoReactNative.isCallAliveConfigured();
48
+ if (!isCallAliveConfigured) {
49
+ const logger = getLogger(['startForegroundService']);
50
+ logger(
51
+ 'info',
52
+ 'KeepCallAlive is not configured. Skipping foreground service setup.'
53
+ );
54
+ return;
55
+ }
28
56
  const settings = await notifeeLib.default.getNotificationSettings();
29
57
  if (
30
58
  settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.9.27';
1
+ export const version = '1.9.29';