@stream-io/video-react-native-sdk 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +24 -17
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/commonjs/utils/hooks/usePrevious.js.map +1 -1
- package/dist/commonjs/utils/push/ios.js +3 -2
- package/dist/commonjs/utils/push/ios.js.map +1 -1
- package/dist/commonjs/utils/push/utils.js +5 -3
- package/dist/commonjs/utils/push/utils.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +24 -17
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/module/utils/hooks/usePrevious.js.map +1 -1
- package/dist/module/utils/push/ios.js +3 -2
- package/dist/module/utils/push/ios.js.map +1 -1
- package/dist/module/utils/push/utils.js +5 -3
- package/dist/module/utils/push/utils.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
- package/dist/typescript/utils/hooks/usePrevious.d.ts +1 -1
- package/dist/typescript/utils/hooks/usePrevious.d.ts.map +1 -1
- package/dist/typescript/utils/push/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/utils.d.ts +1 -1
- package/dist/typescript/utils/push/utils.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +39 -19
- package/src/utils/hooks/usePrevious.ts +1 -1
- package/src/utils/push/ios.ts +9 -3
- package/src/utils/push/utils.ts +10 -4
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.6.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.6.0...@stream-io/video-react-native-sdk-1.6.1) (2025-01-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
* **rn-video:** upgrade to expo ver 52 ([#1630](https://github.com/GetStream/stream-video-js/issues/1630)) ([7eec9b0](https://github.com/GetStream/stream-video-js/commit/7eec9b0616a6c8f397a00d0c48da8932fd2b7dfc))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* foreground service cannot be started in background exception ([#1635](https://github.com/GetStream/stream-video-js/issues/1635)) ([bb82021](https://github.com/GetStream/stream-video-js/commit/bb820214b85e08c7be726e0da27b6739681e07e2))
|
|
14
|
+
|
|
5
15
|
## [1.6.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.5.2...@stream-io/video-react-native-sdk-1.6.0) (2025-01-02)
|
|
6
16
|
|
|
7
17
|
### Dependency Updates
|
|
@@ -10,6 +10,7 @@ var _utils = require("../utils");
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
var _videoClient = require("@stream-io/video-client");
|
|
12
12
|
var _notifee = require("../utils/push/libs/notifee");
|
|
13
|
+
var _hooks = require("../utils/hooks");
|
|
13
14
|
const notifeeLib = (0, _notifee.getNotifeeLibNoThrowForKeepCallAlive)();
|
|
14
15
|
function setForegroundService() {
|
|
15
16
|
notifeeLib?.default.registerForegroundService(() => {
|
|
@@ -26,7 +27,7 @@ async function startForegroundService(call_cid) {
|
|
|
26
27
|
body
|
|
27
28
|
} = foregroundServiceConfig.android.notificationTexts;
|
|
28
29
|
|
|
29
|
-
//
|
|
30
|
+
// check for notification permission and then start the foreground service
|
|
30
31
|
if (!notifeeLib) return;
|
|
31
32
|
const settings = await notifeeLib.default.getNotificationSettings();
|
|
32
33
|
if (settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED) {
|
|
@@ -71,11 +72,18 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
71
72
|
setForegroundService();
|
|
72
73
|
}
|
|
73
74
|
const foregroundServiceStartedRef = (0, _react.useRef)(false);
|
|
74
|
-
const
|
|
75
|
+
const call = (0, _videoReactBindings.useCall)();
|
|
76
|
+
const activeCallCid = call?.cid;
|
|
75
77
|
const {
|
|
76
78
|
useCallCallingState
|
|
77
79
|
} = (0, _videoReactBindings.useCallStateHooks)();
|
|
78
80
|
const callingState = useCallCallingState();
|
|
81
|
+
const prevCallingState = (0, _hooks.usePrevious)(callingState);
|
|
82
|
+
const isStartingToJoin = prevCallingState === _videoClient.CallingState.IDLE && callingState === _videoClient.CallingState.JOINING;
|
|
83
|
+
const isStartingToJoinFromRinging = prevCallingState === _videoClient.CallingState.RINGING && callingState === _videoClient.CallingState.JOINING;
|
|
84
|
+
const isOutgoingCall = callingState === _videoClient.CallingState.RINGING && call?.isCreatedByMe;
|
|
85
|
+
const isCallJoined = callingState === _videoClient.CallingState.JOINED;
|
|
86
|
+
const shouldStartForegroundService = isStartingToJoin || isStartingToJoinFromRinging || isOutgoingCall || isCallJoined;
|
|
79
87
|
(0, _react.useEffect)(() => {
|
|
80
88
|
if (_reactNative.Platform.OS === 'ios' || !activeCallCid) {
|
|
81
89
|
return;
|
|
@@ -83,30 +91,29 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
83
91
|
if (!notifeeLib) return;
|
|
84
92
|
|
|
85
93
|
// start foreground service as soon as the call is joined
|
|
86
|
-
if (
|
|
94
|
+
if (shouldStartForegroundService) {
|
|
87
95
|
const run = async () => {
|
|
88
96
|
if (foregroundServiceStartedRef.current) {
|
|
89
97
|
return;
|
|
90
98
|
}
|
|
91
99
|
const notifee = notifeeLib.default;
|
|
92
|
-
notifee.getDisplayedNotifications()
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
100
|
+
const displayedNotifications = await notifee.getDisplayedNotifications();
|
|
101
|
+
const activeCallNotification = displayedNotifications.find(notification => notification.id === activeCallCid);
|
|
102
|
+
if (activeCallNotification) {
|
|
103
|
+
// this means that we have a incoming call notification shown as foreground service and we must stop it
|
|
104
|
+
notifee.stopForegroundService();
|
|
105
|
+
notifee.cancelDisplayedNotification(activeCallCid);
|
|
106
|
+
}
|
|
107
|
+
// check for notification permission and then start the foreground service
|
|
108
|
+
startForegroundService(activeCallCid).then(() => {
|
|
109
|
+
foregroundServiceStartedRef.current = true;
|
|
103
110
|
});
|
|
104
111
|
};
|
|
105
112
|
run();
|
|
106
113
|
} else if (callingState === _videoClient.CallingState.RINGING) {
|
|
107
|
-
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
108
114
|
return () => {
|
|
109
|
-
//
|
|
115
|
+
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
116
|
+
// NOTE: cancels only the non fg service notifications
|
|
110
117
|
notifeeLib.default.cancelDisplayedNotification(activeCallCid);
|
|
111
118
|
};
|
|
112
119
|
} else if (callingState === _videoClient.CallingState.IDLE || callingState === _videoClient.CallingState.LEFT) {
|
|
@@ -124,7 +131,7 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
124
131
|
});
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
|
-
}, [activeCallCid, callingState]);
|
|
134
|
+
}, [activeCallCid, callingState, shouldStartForegroundService]);
|
|
128
135
|
(0, _react.useEffect)(() => {
|
|
129
136
|
return () => {
|
|
130
137
|
// stop foreground service when this effect is unmounted
|
|
@@ -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","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","useRef","
|
|
1
|
+
{"version":3,"names":["_videoReactBindings","require","_react","_utils","_reactNative","_videoClient","_notifee","_hooks","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","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","useRef","call","useCall","activeCallCid","cid","useCallCallingState","useCallStateHooks","callingState","prevCallingState","usePrevious","isStartingToJoin","CallingState","IDLE","JOINING","isStartingToJoinFromRinging","RINGING","isOutgoingCall","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","useEffect","Platform","OS","run","current","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","then","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;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAIA,IAAAM,MAAA,GAAAN,OAAA;AAEA,MAAMO,UAAU,GAAG,IAAAC,6CAAoC,EAAC,CAAC;AAEzD,SAASC,oBAAoBA,CAAA,EAAG;EAC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I,CACvDC,YAAY,IAAKA,YAAY,CAAC5C,EAAE,KAAKgB,aACxC,CAAC;UACD,IAAI0B,sBAAsB,EAAE;YAC1B;YACAnE,UAAU,CAACG,OAAO,CAACmE,qBAAqB,CAAC,CAAC;UAC5C;QACF,CAAC,CAAC;MACN;IACF;EACF,CAAC,EAAE,CAAC7B,aAAa,EAAEI,YAAY,EAAEa,4BAA4B,CAAC,CAAC;EAE/D,IAAAC,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAItB,2BAA2B,CAAC0B,OAAO,EAAE;QACvC,IAAI,CAAC/D,UAAU,EAAE;QACjBA,UAAU,CAACG,OAAO,CAACmE,qBAAqB,CAAC,CAAC;QAC1CjC,2BAA2B,CAAC0B,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAACW,OAAA,CAAAtC,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","usePrevious","value","valueRef","useRef","useEffect","current","exports"],"sourceRoot":"../../../../src","sources":["utils/hooks/usePrevious.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,
|
|
1
|
+
{"version":3,"names":["_react","require","usePrevious","value","valueRef","useRef","useEffect","current","exports"],"sourceRoot":"../../../../src","sources":["utils/hooks/usePrevious.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,GAAOC,KAAQ,IAAK;EAC1C,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAACF,KAAK,CAAC;EAE9B,IAAAG,gBAAS,EAAC,MAAM;IACdF,QAAQ,CAACG,OAAO,GAAGJ,KAAK;EAC1B,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAOC,QAAQ,CAACG,OAAO;AACzB,CAAC;AAACC,OAAA,CAAAN,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -33,8 +33,9 @@ function processNonRingingNotificationStreamPayload(streamPayload) {
|
|
|
33
33
|
const oniOSExpoNotificationEvent = event => {
|
|
34
34
|
const pushConfig = _StreamVideoRN.StreamVideoRN.getConfig().push;
|
|
35
35
|
if (pushConfig) {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const trigger = event.request.trigger;
|
|
37
|
+
if (trigger && typeof trigger === 'object' && 'type' in trigger && trigger.type === 'push' && trigger.payload?.stream) {
|
|
38
|
+
const streamPayload = trigger.payload.stream;
|
|
38
39
|
processNonRingingNotificationStreamPayload(streamPayload);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_rxSubjects","_libs","_videoClient","_pushLogoutCallback","_StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","pushNonRingingCallData$","next","oniOSExpoNotificationEvent","event","pushConfig","StreamVideoRN","getConfig","push","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_rxSubjects","_libs","_videoClient","_pushLogoutCallback","_StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","pushNonRingingCallData$","next","oniOSExpoNotificationEvent","event","pushConfig","StreamVideoRN","getConfig","push","trigger","request","payload","stream","exports","oniOSNotifeeEvent","Platform","OS","detail","notifeeLib","getNotifeeLibThrowIfNotInstalledForPush","EventType","PRESS","notification","data","result","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getPushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","setPushLogoutCallback","removeDevice","err","logger","getLogger","push_provider_name","addDevice","isExpo","expoNotificationsLib","getExpoNotificationsLib","getDevicePushTokenAsync","then","devicePushToken","subscription","addPushTokenListener","remove","addEventListener","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAOA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AAEA,IAAAK,cAAA,GAAAL,OAAA;AAKA,IAAIM,YAAY,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAE5C,SAASC,0CAA0CA,CACjDC,aAAgC,EAChC;EACA,IACEA,aAAa,EAAEC,MAAM,KAAK,cAAc,IACxCD,aAAa,EAAEE,IAAI,KAAK,WAAW,EACnC;IACA,MAAMC,GAAG,GAAGH,aAAa,CAACI,QAAQ;IAClC,MAAMF,IAAI,GAAGF,aAAa,CAACE,IAAI;IAC/BG,mCAAuB,CAACC,IAAI,CAAC;MAAEH,GAAG;MAAED;IAAK,CAAC,CAAC;IAC3C,OAAO;MAAEC,GAAG;MAAED;IAAK,CAAC;EACtB;AACF;AAEO,MAAMK,0BAA0B,GAAIC,KAAuB,IAAK;EACrE,MAAMC,UAAU,GAAGC,4BAAa,CAACC,SAAS,CAAC,CAAC,CAACC,IAAI;EACjD,IAAIH,UAAU,EAAE;IACd,MAAMI,OAAO,GAAGL,KAAK,CAACM,OAAO,CAACD,OAAO;IACrC,IACEA,OAAO,IACP,OAAOA,OAAO,KAAK,QAAQ,IAC3B,MAAM,IAAIA,OAAO,IACjBA,OAAO,CAACX,IAAI,KAAK,MAAM,IACvBW,OAAO,CAACE,OAAO,EAAEC,MAAM,EACvB;MACA,MAAMhB,aAAa,GAAGa,OAAO,CAACE,OAAO,CAACC,MAA2B;MACjEjB,0CAA0C,CAACC,aAAa,CAAC;IAC3D;EACF;AACF,CAAC;AAACiB,OAAA,CAAAV,0BAAA,GAAAA,0BAAA;AAEK,MAAMW,iBAAiB,GA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;IACrB,MAAMC,oBAAoB,GAAG,IAAAC,6BAAuB,EAAC,CAAC;IACtDD,oBAAoB,CAACE,uBAAuB,CAAC,CAAC,CAACC,IAAI,CAAEC,eAAe,IAAK;MACvEhB,cAAc,CAACgB,eAAe,CAACjC,IAAI,CAAC;IACtC,CAAC,CAAC;IACF,MAAMkC,YAAY,GAAGL,oBAAoB,CAACM,oBAAoB,CAC3DF,eAAe,IAAK;MACnBhB,cAAc,CAACgB,eAAe,CAACjC,IAAI,CAAC;IACtC,CACF,CAAC;IACDc,sBAAsB,CAAC,MAAM;MAC3BoB,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,MAAMhC,sBAAsB,GAAG,IAAAC,+BAAyB,EAAC,CAAC;IAC1DD,sBAAsB,CAACiC,gBAAgB,CAAC,UAAU,EAAGnE,KAAK,IAAK;MAC7D+C,cAAc,CAAC/C,KAAK,CAAC;IACvB,CAAC,CAAC;IACF4C,sBAAsB,CAAC,MAAM;MAC3BV,sBAAsB,CAACkC,mBAAmB,CAAC,UAAU,CAAC;IACxD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -20,13 +20,15 @@ function isNotifeeStreamVideoEvent(event) {
|
|
|
20
20
|
return notification?.data?.sender === 'stream.video';
|
|
21
21
|
}
|
|
22
22
|
function isExpoNotificationStreamVideoEvent(event) {
|
|
23
|
-
|
|
23
|
+
const trigger = event.request.trigger;
|
|
24
|
+
if (trigger && typeof trigger === 'object' && 'type' in trigger && trigger.type === 'push') {
|
|
24
25
|
// iOS
|
|
25
|
-
const streamPayload =
|
|
26
|
+
const streamPayload = trigger.payload?.stream;
|
|
26
27
|
// Android
|
|
27
|
-
const remoteMessageData =
|
|
28
|
+
const remoteMessageData = trigger.remoteMessage?.data;
|
|
28
29
|
return streamPayload?.sender === 'stream.video' || remoteMessageData?.sender === 'stream.video';
|
|
29
30
|
}
|
|
31
|
+
return false;
|
|
30
32
|
}
|
|
31
33
|
function isPushNotificationiOSStreamVideoEvent(notification) {
|
|
32
34
|
const data = notification.getData();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isFirebaseStreamVideoMessage","message","data","sender","isNotifeeStreamVideoEvent","event","detail","notification","isExpoNotificationStreamVideoEvent","
|
|
1
|
+
{"version":3,"names":["isFirebaseStreamVideoMessage","message","data","sender","isNotifeeStreamVideoEvent","event","detail","notification","isExpoNotificationStreamVideoEvent","trigger","request","type","streamPayload","payload","stream","remoteMessageData","remoteMessage","isPushNotificationiOSStreamVideoEvent","getData"],"sourceRoot":"../../../../src","sources":["utils/push/utils.ts"],"mappings":";;;;;;;;;AAcO,SAASA,4BAA4BA,CAC1CC,OAA6C,EAC7C;EACA,OAAOA,OAAO,CAACC,IAAI,EAAEC,MAAM,KAAK,cAAc;AAChD;AAEO,SAASC,yBAAyBA,CAACC,KAAY,EAAE;EACtD,MAAM;IAAEC;EAAO,CAAC,GAAGD,KAAK;EACxB,MAAM;IAAEE;EAAa,CAAC,GAAGD,MAAM;EAC/B,OAAOC,YAAY,EAAEL,IAAI,EAAEC,MAAM,KAAK,cAAc;AACtD;AAEO,SAASK,kCAAkCA,CAACH,KAAuB,EAAE;EAC1E,MAAMI,OAAO,GAAGJ,KAAK,CAACK,OAAO,CAACD,OAAO;EACrC,IACEA,OAAO,IACP,OAAOA,OAAO,KAAK,QAAQ,IAC3B,MAAM,IAAIA,OAAO,IACjBA,OAAO,CAACE,IAAI,KAAK,MAAM,EACvB;IACA;IACA,MAAMC,aAAa,GAAGH,OAAO,CAACI,OAAO,EAAEC,MAA2B;IAClE;IACA,MAAMC,iBAAiB,GAAGN,OAAO,CAACO,aAAa,EAAEd,IAAI;IACrD,OACEU,aAAa,EAAET,MAAM,KAAK,cAAc,IACxCY,iBAAiB,EAAEZ,MAAM,KAAK,cAAc;EAEhD;EACA,OAAO,KAAK;AACd;AAEO,SAASc,qCAAqCA,CACnDV,YAAqC,EACrC;EACA,MAAML,IAAI,GAAGK,YAAY,CAACW,OAAO,CAAC,CAAC;EACnC,MAAMN,aAAa,GAAGV,IAAI,EAAEY,MAA2B;EACvD,OAAOF,aAAa,EAAET,MAAM,KAAK,cAAc;AACjD","ignoreList":[]}
|
package/dist/commonjs/version.js
CHANGED
|
@@ -4,6 +4,7 @@ import { StreamVideoRN } from '../utils';
|
|
|
4
4
|
import { 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
|
+
import { usePrevious } from '../utils/hooks';
|
|
7
8
|
const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
|
|
8
9
|
function setForegroundService() {
|
|
9
10
|
notifeeLib?.default.registerForegroundService(() => {
|
|
@@ -20,7 +21,7 @@ async function startForegroundService(call_cid) {
|
|
|
20
21
|
body
|
|
21
22
|
} = foregroundServiceConfig.android.notificationTexts;
|
|
22
23
|
|
|
23
|
-
//
|
|
24
|
+
// check for notification permission and then start the foreground service
|
|
24
25
|
if (!notifeeLib) return;
|
|
25
26
|
const settings = await notifeeLib.default.getNotificationSettings();
|
|
26
27
|
if (settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED) {
|
|
@@ -65,11 +66,18 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
65
66
|
setForegroundService();
|
|
66
67
|
}
|
|
67
68
|
const foregroundServiceStartedRef = useRef(false);
|
|
68
|
-
const
|
|
69
|
+
const call = useCall();
|
|
70
|
+
const activeCallCid = call?.cid;
|
|
69
71
|
const {
|
|
70
72
|
useCallCallingState
|
|
71
73
|
} = useCallStateHooks();
|
|
72
74
|
const callingState = useCallCallingState();
|
|
75
|
+
const prevCallingState = usePrevious(callingState);
|
|
76
|
+
const isStartingToJoin = prevCallingState === CallingState.IDLE && callingState === CallingState.JOINING;
|
|
77
|
+
const isStartingToJoinFromRinging = prevCallingState === CallingState.RINGING && callingState === CallingState.JOINING;
|
|
78
|
+
const isOutgoingCall = callingState === CallingState.RINGING && call?.isCreatedByMe;
|
|
79
|
+
const isCallJoined = callingState === CallingState.JOINED;
|
|
80
|
+
const shouldStartForegroundService = isStartingToJoin || isStartingToJoinFromRinging || isOutgoingCall || isCallJoined;
|
|
73
81
|
useEffect(() => {
|
|
74
82
|
if (Platform.OS === 'ios' || !activeCallCid) {
|
|
75
83
|
return;
|
|
@@ -77,30 +85,29 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
77
85
|
if (!notifeeLib) return;
|
|
78
86
|
|
|
79
87
|
// start foreground service as soon as the call is joined
|
|
80
|
-
if (
|
|
88
|
+
if (shouldStartForegroundService) {
|
|
81
89
|
const run = async () => {
|
|
82
90
|
if (foregroundServiceStartedRef.current) {
|
|
83
91
|
return;
|
|
84
92
|
}
|
|
85
93
|
const notifee = notifeeLib.default;
|
|
86
|
-
notifee.getDisplayedNotifications()
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
});
|
|
94
|
+
const displayedNotifications = await notifee.getDisplayedNotifications();
|
|
95
|
+
const activeCallNotification = displayedNotifications.find(notification => notification.id === activeCallCid);
|
|
96
|
+
if (activeCallNotification) {
|
|
97
|
+
// this means that we have a incoming call notification shown as foreground service and we must stop it
|
|
98
|
+
notifee.stopForegroundService();
|
|
99
|
+
notifee.cancelDisplayedNotification(activeCallCid);
|
|
100
|
+
}
|
|
101
|
+
// check for notification permission and then start the foreground service
|
|
102
|
+
startForegroundService(activeCallCid).then(() => {
|
|
103
|
+
foregroundServiceStartedRef.current = true;
|
|
97
104
|
});
|
|
98
105
|
};
|
|
99
106
|
run();
|
|
100
107
|
} else if (callingState === CallingState.RINGING) {
|
|
101
|
-
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
102
108
|
return () => {
|
|
103
|
-
//
|
|
109
|
+
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
110
|
+
// NOTE: cancels only the non fg service notifications
|
|
104
111
|
notifeeLib.default.cancelDisplayedNotification(activeCallCid);
|
|
105
112
|
};
|
|
106
113
|
} else if (callingState === CallingState.IDLE || callingState === CallingState.LEFT) {
|
|
@@ -118,7 +125,7 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
118
125
|
});
|
|
119
126
|
}
|
|
120
127
|
}
|
|
121
|
-
}, [activeCallCid, callingState]);
|
|
128
|
+
}, [activeCallCid, callingState, shouldStartForegroundService]);
|
|
122
129
|
useEffect(() => {
|
|
123
130
|
return () => {
|
|
124
131
|
// stop foreground service when this effect is unmounted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","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","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","activeCallCid","cid","useCallCallingState","callingState","
|
|
1
|
+
{"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","Platform","CallingState","getLogger","getNotifeeLibNoThrowForKeepCallAlive","getKeepCallAliveForegroundServiceTypes","usePrevious","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","displayNotification","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","call","activeCallCid","cid","useCallCallingState","callingState","prevCallingState","isStartingToJoin","IDLE","JOINING","isStartingToJoinFromRinging","RINGING","isOutgoingCall","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","OS","run","current","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","then","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,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,YAAY,EAAEC,SAAS,QAAQ,yBAAyB;AACjE,SACEC,oCAAoC,EACpCC,sCAAsC,QACjC,4BAA4B;AACnC,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,MAAMC,UAAU,GAAGH,oCAAoC,CAAC,CAAC;AAEzD,SAASI,oBAAoBA,CAAA,EAAG;EAC9BD,UAAU,EAAEE,OAAO,CAACC,yBAAyB,CAAC,MAAM;IAClD,OAAO,IAAIC,OAAO,CAAC,MAAM;MACvB,MAAMC,MAAM,GAAGT,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAC;MACzDS,MAAM,CAAC,MAAM,EAAE,iDAAiD,CAAC;IACnE,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;AAEA,eAAeC,sBAAsBA,CAACC,QAAgB,EAAE;EACtD,MAAMC,uBAAuB,GAAGf,aAAa,CAACgB,SAAS,CAAC,CAAC,CAACC,iBAAiB;EAC3E,MAAM;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGJ,uBAAuB,CAACK,OAAO,CAACC,iBAAiB;;EAEzE;EACA,IAAI,CAACd,UAAU,EAAE;EACjB,MAAMe,QAAQ,GAAG,MAAMf,UAAU,CAAC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
-
{"version":3,"names":["useEffect","useRef","usePrevious","value","valueRef","current"],"sourceRoot":"../../../../src","sources":["utils/hooks/usePrevious.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAO,MAAMC,WAAW,
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","usePrevious","value","valueRef","current"],"sourceRoot":"../../../../src","sources":["utils/hooks/usePrevious.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAO,MAAMC,WAAW,GAAOC,KAAQ,IAAK;EAC1C,MAAMC,QAAQ,GAAGH,MAAM,CAACE,KAAK,CAAC;EAE9BH,SAAS,CAAC,MAAM;IACdI,QAAQ,CAACC,OAAO,GAAGF,KAAK;EAC1B,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAOC,QAAQ,CAACC,OAAO;AACzB,CAAC","ignoreList":[]}
|
|
@@ -25,8 +25,9 @@ function processNonRingingNotificationStreamPayload(streamPayload) {
|
|
|
25
25
|
export const oniOSExpoNotificationEvent = event => {
|
|
26
26
|
const pushConfig = StreamVideoRN.getConfig().push;
|
|
27
27
|
if (pushConfig) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const trigger = event.request.trigger;
|
|
29
|
+
if (trigger && typeof trigger === 'object' && 'type' in trigger && trigger.type === 'push' && trigger.payload?.stream) {
|
|
30
|
+
const streamPayload = trigger.payload.stream;
|
|
30
31
|
processNonRingingNotificationStreamPayload(streamPayload);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","pushNonRingingCallData$","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","getLogger","setPushLogoutCallback","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","next","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","
|
|
1
|
+
{"version":3,"names":["Platform","pushNonRingingCallData$","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","getLogger","setPushLogoutCallback","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","next","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","trigger","request","payload","stream","oniOSNotifeeEvent","OS","detail","notifeeLib","EventType","PRESS","notification","data","result","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","logger","push_provider_name","addDevice","isExpo","expoNotificationsLib","getDevicePushTokenAsync","then","devicePushToken","subscription","addPushTokenListener","remove","addEventListener","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAEEC,uBAAuB,EACvBC,uCAAuC,EACvCC,yBAAyB,QAEpB,QAAQ;AACf,SAA4BC,SAAS,QAAQ,yBAAyB;AACtE,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SAASC,aAAa,QAAQ,kBAAkB;AAKhD,IAAIC,YAAY,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAE5C,SAASC,0CAA0CA,CACjDC,aAAgC,EAChC;EACA,IACEA,aAAa,EAAEC,MAAM,KAAK,cAAc,IACxCD,aAAa,EAAEE,IAAI,KAAK,WAAW,EACnC;IACA,MAAMC,GAAG,GAAGH,aAAa,CAACI,QAAQ;IAClC,MAAMF,IAAI,GAAGF,aAAa,CAACE,IAAI;IAC/Bb,uBAAuB,CAACgB,IAAI,CAAC;MAAEF,GAAG;MAAED;IAAK,CAAC,CAAC;IAC3C,OAAO;MAAEC,GAAG;MA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Event(event) {
|
|
|
11
11
|
return notification?.data?.sender === 'stream.video';
|
|
12
12
|
}
|
|
13
13
|
export function isExpoNotificationStreamVideoEvent(event) {
|
|
14
|
-
|
|
14
|
+
const trigger = event.request.trigger;
|
|
15
|
+
if (trigger && typeof trigger === 'object' && 'type' in trigger && trigger.type === 'push') {
|
|
15
16
|
// iOS
|
|
16
|
-
const streamPayload =
|
|
17
|
+
const streamPayload = trigger.payload?.stream;
|
|
17
18
|
// Android
|
|
18
|
-
const remoteMessageData =
|
|
19
|
+
const remoteMessageData = trigger.remoteMessage?.data;
|
|
19
20
|
return streamPayload?.sender === 'stream.video' || remoteMessageData?.sender === 'stream.video';
|
|
20
21
|
}
|
|
22
|
+
return false;
|
|
21
23
|
}
|
|
22
24
|
export function isPushNotificationiOSStreamVideoEvent(notification) {
|
|
23
25
|
const data = notification.getData();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isFirebaseStreamVideoMessage","message","data","sender","isNotifeeStreamVideoEvent","event","detail","notification","isExpoNotificationStreamVideoEvent","
|
|
1
|
+
{"version":3,"names":["isFirebaseStreamVideoMessage","message","data","sender","isNotifeeStreamVideoEvent","event","detail","notification","isExpoNotificationStreamVideoEvent","trigger","request","type","streamPayload","payload","stream","remoteMessageData","remoteMessage","isPushNotificationiOSStreamVideoEvent","getData"],"sourceRoot":"../../../../src","sources":["utils/push/utils.ts"],"mappings":"AAcA,OAAO,SAASA,4BAA4BA,CAC1CC,OAA6C,EAC7C;EACA,OAAOA,OAAO,CAACC,IAAI,EAAEC,MAAM,KAAK,cAAc;AAChD;AAEA,OAAO,SAASC,yBAAyBA,CAACC,KAAY,EAAE;EACtD,MAAM;IAAEC;EAAO,CAAC,GAAGD,KAAK;EACxB,MAAM;IAAEE;EAAa,CAAC,GAAGD,MAAM;EAC/B,OAAOC,YAAY,EAAEL,IAAI,EAAEC,MAAM,KAAK,cAAc;AACtD;AAEA,OAAO,SAASK,kCAAkCA,CAACH,KAAuB,EAAE;EAC1E,MAAMI,OAAO,GAAGJ,KAAK,CAACK,OAAO,CAACD,OAAO;EACrC,IACEA,OAAO,IACP,OAAOA,OAAO,KAAK,QAAQ,IAC3B,MAAM,IAAIA,OAAO,IACjBA,OAAO,CAACE,IAAI,KAAK,MAAM,EACvB;IACA;IACA,MAAMC,aAAa,GAAGH,OAAO,CAACI,OAAO,EAAEC,MAA2B;IAClE;IACA,MAAMC,iBAAiB,GAAGN,OAAO,CAACO,aAAa,EAAEd,IAAI;IACrD,OACEU,aAAa,EAAET,MAAM,KAAK,cAAc,IACxCY,iBAAiB,EAAEZ,MAAM,KAAK,cAAc;EAEhD;EACA,OAAO,KAAK;AACd;AAEA,OAAO,SAASc,qCAAqCA,CACnDV,YAAqC,EACrC;EACA,MAAML,IAAI,GAAGK,YAAY,CAACW,OAAO,CAAC,CAAC;EACnC,MAAMN,aAAa,GAAGV,IAAI,EAAEY,MAA2B;EACvD,OAAOF,aAAa,EAAET,MAAM,KAAK,cAAc;AACjD","ignoreList":[]}
|
package/dist/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '1.6.
|
|
1
|
+
export const version = '1.6.1';
|
|
2
2
|
//# sourceMappingURL=version.js.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":"AAiEA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAmGzC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const usePrevious: (value:
|
|
1
|
+
export declare const usePrevious: <T>(value: T) => T;
|
|
2
2
|
//# sourceMappingURL=usePrevious.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrevious.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/usePrevious.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"usePrevious.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/usePrevious.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,MAQtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/ios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EACL,gBAAgB,EAIhB,uBAAuB,EACxB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAa,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAkBzD,eAAO,MAAM,0BAA0B,UAAW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/ios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EACL,gBAAgB,EAIhB,uBAAuB,EACxB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAa,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAkBzD,eAAO,MAAM,0BAA0B,UAAW,gBAAgB,SAejE,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAE3B;IACD,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,SAcA,CAAC;AAEF,wBAAgB,qCAAqC,CACnD,YAAY,EAAE,uBAAuB,QAiBtC;AAED,2BAA2B;AAC3B,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,iBAiD1D"}
|
|
@@ -10,6 +10,6 @@ export type StreamPushPayload = {
|
|
|
10
10
|
} | undefined;
|
|
11
11
|
export declare function isFirebaseStreamVideoMessage(message: FirebaseMessagingTypes.RemoteMessage): boolean;
|
|
12
12
|
export declare function isNotifeeStreamVideoEvent(event: Event): boolean;
|
|
13
|
-
export declare function isExpoNotificationStreamVideoEvent(event: ExpoNotification): boolean
|
|
13
|
+
export declare function isExpoNotificationStreamVideoEvent(event: ExpoNotification): boolean;
|
|
14
14
|
export declare function isPushNotificationiOSStreamVideoEvent(notification: PushNotificationiOSType): boolean;
|
|
15
15
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,MAAM,iBAAiB,GACzB;IACE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,GAAG,mBAAmB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,GACD,SAAS,CAAC;AAEd,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,sBAAsB,CAAC,aAAa,WAG9C;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAIrD;AAED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,MAAM,iBAAiB,GACzB;IACE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,GAAG,mBAAmB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,GACD,SAAS,CAAC;AAEd,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,sBAAsB,CAAC,aAAa,WAG9C;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAIrD;AAED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,gBAAgB,WAkBzE;AAED,wBAAgB,qCAAqC,CACnD,YAAY,EAAE,uBAAuB,WAKtC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.6.
|
|
1
|
+
export declare const version = "1.6.1";
|
|
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.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"expo": "50.0.19",
|
|
136
136
|
"expo-build-properties": "^0.12.3",
|
|
137
137
|
"expo-modules-core": "1.12.16",
|
|
138
|
-
"expo-notifications": "~0.
|
|
138
|
+
"expo-notifications": "~0.29.11",
|
|
139
139
|
"jest": "^29.7.0",
|
|
140
140
|
"react-native": "0.71.8",
|
|
141
141
|
"react-native-builder-bob": "^0.23.2",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getNotifeeLibNoThrowForKeepCallAlive,
|
|
8
8
|
getKeepCallAliveForegroundServiceTypes,
|
|
9
9
|
} from '../utils/push/libs/notifee';
|
|
10
|
+
import { usePrevious } from '../utils/hooks';
|
|
10
11
|
|
|
11
12
|
const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
|
|
12
13
|
|
|
@@ -23,7 +24,7 @@ async function startForegroundService(call_cid: string) {
|
|
|
23
24
|
const foregroundServiceConfig = StreamVideoRN.getConfig().foregroundService;
|
|
24
25
|
const { title, body } = foregroundServiceConfig.android.notificationTexts;
|
|
25
26
|
|
|
26
|
-
//
|
|
27
|
+
// check for notification permission and then start the foreground service
|
|
27
28
|
if (!notifeeLib) return;
|
|
28
29
|
const settings = await notifeeLib.default.getNotificationSettings();
|
|
29
30
|
if (
|
|
@@ -75,10 +76,29 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
75
76
|
}
|
|
76
77
|
const foregroundServiceStartedRef = useRef(false);
|
|
77
78
|
|
|
78
|
-
const
|
|
79
|
+
const call = useCall();
|
|
80
|
+
const activeCallCid = call?.cid;
|
|
79
81
|
const { useCallCallingState } = useCallStateHooks();
|
|
80
82
|
const callingState = useCallCallingState();
|
|
81
83
|
|
|
84
|
+
const prevCallingState = usePrevious(callingState);
|
|
85
|
+
|
|
86
|
+
const isStartingToJoin =
|
|
87
|
+
prevCallingState === CallingState.IDLE &&
|
|
88
|
+
callingState === CallingState.JOINING;
|
|
89
|
+
const isStartingToJoinFromRinging =
|
|
90
|
+
prevCallingState === CallingState.RINGING &&
|
|
91
|
+
callingState === CallingState.JOINING;
|
|
92
|
+
const isOutgoingCall =
|
|
93
|
+
callingState === CallingState.RINGING && call?.isCreatedByMe;
|
|
94
|
+
const isCallJoined = callingState === CallingState.JOINED;
|
|
95
|
+
|
|
96
|
+
const shouldStartForegroundService =
|
|
97
|
+
isStartingToJoin ||
|
|
98
|
+
isStartingToJoinFromRinging ||
|
|
99
|
+
isOutgoingCall ||
|
|
100
|
+
isCallJoined;
|
|
101
|
+
|
|
82
102
|
useEffect((): (() => void) | undefined => {
|
|
83
103
|
if (Platform.OS === 'ios' || !activeCallCid) {
|
|
84
104
|
return;
|
|
@@ -86,32 +106,32 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
86
106
|
if (!notifeeLib) return;
|
|
87
107
|
|
|
88
108
|
// start foreground service as soon as the call is joined
|
|
89
|
-
if (
|
|
109
|
+
if (shouldStartForegroundService) {
|
|
90
110
|
const run = async () => {
|
|
91
111
|
if (foregroundServiceStartedRef.current) {
|
|
92
112
|
return;
|
|
93
113
|
}
|
|
94
114
|
const notifee = notifeeLib.default;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
const displayedNotifications =
|
|
116
|
+
await notifee.getDisplayedNotifications();
|
|
117
|
+
const activeCallNotification = displayedNotifications.find(
|
|
118
|
+
(notification) => notification.id === activeCallCid
|
|
119
|
+
);
|
|
120
|
+
if (activeCallNotification) {
|
|
121
|
+
// this means that we have a incoming call notification shown as foreground service and we must stop it
|
|
122
|
+
notifee.stopForegroundService();
|
|
123
|
+
notifee.cancelDisplayedNotification(activeCallCid);
|
|
124
|
+
}
|
|
125
|
+
// check for notification permission and then start the foreground service
|
|
126
|
+
startForegroundService(activeCallCid).then(() => {
|
|
127
|
+
foregroundServiceStartedRef.current = true;
|
|
108
128
|
});
|
|
109
129
|
};
|
|
110
130
|
run();
|
|
111
131
|
} else if (callingState === CallingState.RINGING) {
|
|
112
|
-
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
113
132
|
return () => {
|
|
114
|
-
//
|
|
133
|
+
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
134
|
+
// NOTE: cancels only the non fg service notifications
|
|
115
135
|
notifeeLib.default.cancelDisplayedNotification(activeCallCid);
|
|
116
136
|
};
|
|
117
137
|
} else if (
|
|
@@ -136,7 +156,7 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
136
156
|
});
|
|
137
157
|
}
|
|
138
158
|
}
|
|
139
|
-
}, [activeCallCid, callingState]);
|
|
159
|
+
}, [activeCallCid, callingState, shouldStartForegroundService]);
|
|
140
160
|
|
|
141
161
|
useEffect(() => {
|
|
142
162
|
return () => {
|
package/src/utils/push/ios.ts
CHANGED
|
@@ -35,9 +35,15 @@ function processNonRingingNotificationStreamPayload(
|
|
|
35
35
|
export const oniOSExpoNotificationEvent = (event: ExpoNotification) => {
|
|
36
36
|
const pushConfig = StreamVideoRN.getConfig().push;
|
|
37
37
|
if (pushConfig) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const trigger = event.request.trigger;
|
|
39
|
+
if (
|
|
40
|
+
trigger &&
|
|
41
|
+
typeof trigger === 'object' &&
|
|
42
|
+
'type' in trigger &&
|
|
43
|
+
trigger.type === 'push' &&
|
|
44
|
+
trigger.payload?.stream
|
|
45
|
+
) {
|
|
46
|
+
const streamPayload = trigger.payload.stream as StreamPushPayload;
|
|
41
47
|
processNonRingingNotificationStreamPayload(streamPayload);
|
|
42
48
|
}
|
|
43
49
|
}
|
package/src/utils/push/utils.ts
CHANGED
|
@@ -25,17 +25,23 @@ export function isNotifeeStreamVideoEvent(event: Event) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function isExpoNotificationStreamVideoEvent(event: ExpoNotification) {
|
|
28
|
-
|
|
28
|
+
const trigger = event.request.trigger;
|
|
29
|
+
if (
|
|
30
|
+
trigger &&
|
|
31
|
+
typeof trigger === 'object' &&
|
|
32
|
+
'type' in trigger &&
|
|
33
|
+
trigger.type === 'push'
|
|
34
|
+
) {
|
|
29
35
|
// iOS
|
|
30
|
-
const streamPayload =
|
|
31
|
-
?.stream as StreamPushPayload;
|
|
36
|
+
const streamPayload = trigger.payload?.stream as StreamPushPayload;
|
|
32
37
|
// Android
|
|
33
|
-
const remoteMessageData =
|
|
38
|
+
const remoteMessageData = trigger.remoteMessage?.data;
|
|
34
39
|
return (
|
|
35
40
|
streamPayload?.sender === 'stream.video' ||
|
|
36
41
|
remoteMessageData?.sender === 'stream.video'
|
|
37
42
|
);
|
|
38
43
|
}
|
|
44
|
+
return false;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
export function isPushNotificationiOSStreamVideoEvent(
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.6.
|
|
1
|
+
export const version = '1.6.1';
|