@stream-io/video-react-native-sdk 1.30.0 → 1.30.1-beta.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/android/src/main/AndroidManifest.xml +8 -1
- package/android/src/main/AndroidManifestNew.xml +11 -0
- package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +42 -5
- package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +70 -6
- package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +6 -4
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +149 -0
- package/dist/commonjs/hooks/push/index.js +0 -2
- package/dist/commonjs/hooks/push/index.js.map +1 -1
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +121 -0
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +64 -97
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
- package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
- package/dist/commonjs/providers/StreamCall/index.js +6 -6
- package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
- package/dist/commonjs/utils/StreamVideoRN/index.js +33 -21
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +68 -0
- package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +1 -0
- package/dist/commonjs/utils/internal/callingx/callingx.js +123 -0
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +52 -3
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
- package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
- package/dist/commonjs/utils/push/android.js +135 -202
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/internal/ios.js +17 -34
- package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
- package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -45
- package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
- package/dist/commonjs/utils/push/internal/utils.js +67 -52
- package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
- package/dist/commonjs/utils/push/ios.js.map +1 -1
- package/dist/commonjs/utils/push/libs/callingx.js +78 -0
- package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
- package/dist/commonjs/utils/push/libs/index.js +8 -19
- package/dist/commonjs/utils/push/libs/index.js.map +1 -1
- package/dist/commonjs/utils/push/libs/notifee/index.js +0 -19
- package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
- package/dist/commonjs/utils/push/setupCallingExpEvents.js +105 -0
- package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
- package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
- package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/commonjs/version.js.map +1 -1
- package/dist/module/hooks/push/index.js +0 -2
- package/dist/module/hooks/push/index.js.map +1 -1
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +114 -0
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +66 -99
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/modules/call-manager/CallManager.js +26 -0
- package/dist/module/modules/call-manager/CallManager.js.map +1 -1
- package/dist/module/providers/StreamCall/index.js +6 -6
- package/dist/module/providers/StreamCall/index.js.map +1 -1
- package/dist/module/utils/StreamVideoRN/index.js +33 -21
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/internal/callingx/audioSessionPromise.js +61 -0
- package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +1 -0
- package/dist/module/utils/internal/callingx/callingx.js +114 -0
- package/dist/module/utils/internal/callingx/callingx.js.map +1 -0
- package/dist/module/utils/internal/registerSDKGlobals.js +52 -3
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
- package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
- package/dist/module/utils/push/android.js +137 -204
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/internal/ios.js +17 -34
- package/dist/module/utils/push/internal/ios.js.map +1 -1
- package/dist/module/utils/push/internal/rxSubjects.js +0 -44
- package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
- package/dist/module/utils/push/internal/utils.js +63 -49
- package/dist/module/utils/push/internal/utils.js.map +1 -1
- package/dist/module/utils/push/ios.js.map +1 -1
- package/dist/module/utils/push/libs/callingx.js +70 -0
- package/dist/module/utils/push/libs/callingx.js.map +1 -0
- package/dist/module/utils/push/libs/index.js +1 -2
- package/dist/module/utils/push/libs/index.js.map +1 -1
- package/dist/module/utils/push/libs/notifee/index.js +0 -18
- package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
- package/dist/module/utils/push/setupCallingExpEvents.js +99 -0
- package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
- package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
- package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/version.js.map +1 -1
- package/dist/typescript/hooks/push/index.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
- package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
- package/dist/typescript/index.d.ts +1 -0
- package/dist/typescript/index.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts +20 -2
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +63 -25
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +16 -0
- package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +1 -0
- package/dist/typescript/utils/internal/callingx/callingx.d.ts +17 -0
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -0
- package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
- package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
- package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
- package/dist/typescript/utils/push/android.d.ts +1 -2
- package/dist/typescript/utils/push/android.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -33
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/utils.d.ts +14 -8
- package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
- package/dist/typescript/utils/push/ios.d.ts +1 -2
- package/dist/typescript/utils/push/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
- package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
- package/dist/typescript/utils/push/libs/index.d.ts +1 -2
- package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -1
- package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
- package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
- package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/dist/typescript/version.d.ts.map +1 -1
- package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
- package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
- package/expo-config-plugin/dist/withAppDelegate.js +19 -197
- package/expo-config-plugin/dist/withMainActivity.js +1 -1
- package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
- package/ios/StreamInCallManager.m +2 -0
- package/ios/StreamInCallManager.swift +19 -7
- package/ios/StreamVideoReactNative.h +7 -4
- package/ios/StreamVideoReactNative.m +189 -82
- package/package.json +13 -18
- package/src/hooks/push/index.ts +0 -2
- package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +147 -0
- package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +94 -120
- package/src/index.ts +1 -0
- package/src/modules/call-manager/CallManager.ts +36 -0
- package/src/modules/call-manager/native-module.d.ts +7 -0
- package/src/providers/StreamCall/index.tsx +6 -6
- package/src/utils/StreamVideoRN/index.ts +40 -30
- package/src/utils/StreamVideoRN/types.ts +65 -25
- package/src/utils/internal/callingx/audioSessionPromise.ts +65 -0
- package/src/utils/internal/callingx/callingx.ts +165 -0
- package/src/utils/internal/registerSDKGlobals.ts +47 -4
- package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
- package/src/utils/push/android.ts +196 -311
- package/src/utils/push/internal/ios.ts +28 -44
- package/src/utils/push/internal/rxSubjects.ts +0 -61
- package/src/utils/push/internal/utils.ts +104 -63
- package/src/utils/push/ios.ts +1 -6
- package/src/utils/push/libs/callingx.ts +93 -0
- package/src/utils/push/libs/index.ts +1 -2
- package/src/utils/push/libs/notifee/index.ts +0 -27
- package/src/utils/push/setupCallingExpEvents.ts +135 -0
- package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
- package/src/version.ts +1 -1
- package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
- package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
- package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
- package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +0 -67
- package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +0 -1
- package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
- package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
- package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
- package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
- package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
- package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
- package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
- package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
- package/dist/module/hooks/push/useProcessPushCallEffect.js +0 -60
- package/dist/module/hooks/push/useProcessPushCallEffect.js.map +0 -1
- package/dist/module/utils/push/libs/callkeep.js +0 -11
- package/dist/module/utils/push/libs/callkeep.js.map +0 -1
- package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
- package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
- package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
- package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
- package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
- package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
- package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +0 -8
- package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
- package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
- package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
- package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
- package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
- package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
- package/src/hooks/push/useProcessPushCallEffect.ts +0 -108
- package/src/utils/push/libs/callkeep.ts +0 -16
- package/src/utils/push/libs/voipPushNotification.ts +0 -17
- package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
|
@@ -4,48 +4,4 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
4
4
|
* Note: it is should be subscribed only when a user has connected to the websocket of Stream
|
|
5
5
|
*/
|
|
6
6
|
export const pushNonRingingCallData$ = new BehaviorSubject(undefined);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This rxjs subject is used to store the call cid of the accepted incoming call from push notification
|
|
10
|
-
* Note: it is should be subscribed only when a user has connected to the websocket of Stream
|
|
11
|
-
*/
|
|
12
|
-
export const pushAcceptedIncomingCallCId$ = new BehaviorSubject(undefined);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This rxjs subject is used to store the call cid of the tapped incoming call from push notification it is neither accepted nor rejected yet
|
|
16
|
-
* Note: it should be subscribed only when a user has connected to the websocket of Stream
|
|
17
|
-
*/
|
|
18
|
-
export const pushTappedIncomingCallCId$ = new BehaviorSubject(undefined);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This rxjs subject is used to store the call cid of the delivered incoming call from push notification it is neither accepted nor rejected yet
|
|
22
|
-
* Used so that the call is navigated to when app is open from being killed
|
|
23
|
-
* Note: it should be subscribed only when a user has connected to the websocket of Stream
|
|
24
|
-
*/
|
|
25
|
-
export const pushAndroidBackgroundDeliveredIncomingCallCId$ = new BehaviorSubject(undefined);
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* This rxjs subject is used to store the call cid of the accepted incoming call from push notification
|
|
29
|
-
* Note: it should be subscribed only when a user has connected to the websocket of Stream
|
|
30
|
-
*/
|
|
31
|
-
export const pushRejectedIncomingCallCId$ = new BehaviorSubject(undefined);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* This rxjs subject is used to store the call cid of the incoming call from ios voip pushkit notification
|
|
35
|
-
*/
|
|
36
|
-
export const voipPushNotificationCallCId$ = new BehaviorSubject(undefined);
|
|
37
|
-
|
|
38
|
-
/** The pair of cid of a call and its corresponding uuid created in the native side */
|
|
39
|
-
|
|
40
|
-
/*
|
|
41
|
-
* This rxjs subject should only used to store the CallkeepMap
|
|
42
|
-
* for the incoming call when on foreground
|
|
43
|
-
* or in other words, when we get didDisplayIncomingCall from callkeep lib
|
|
44
|
-
*/
|
|
45
|
-
export const voipCallkeepCallOnForegroundMap$ = new BehaviorSubject(undefined);
|
|
46
|
-
|
|
47
|
-
/*
|
|
48
|
-
* This rxjs subject should only used to store the CallkeepMap when it was accepted in the native dialer
|
|
49
|
-
*/
|
|
50
|
-
export const voipCallkeepAcceptedCallOnNativeDialerMap$ = new BehaviorSubject(undefined);
|
|
51
7
|
//# sourceMappingURL=rxSubjects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BehaviorSubject","pushNonRingingCallData$","undefined"
|
|
1
|
+
{"version":3,"names":["BehaviorSubject","pushNonRingingCallData$","undefined"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/rxSubjects.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,MAAM;AAGtC;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,IAAID,eAAe,CAExDE,SAAS,CAAC","ignoreList":[]}
|
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
import { CallingState, videoLoggerSystem } from '@stream-io/video-client';
|
|
2
2
|
import { onNewCallNotification } from '../../internal/newNotificationCallbacks';
|
|
3
3
|
import { pushUnsubscriptionCallbacks } from './constants';
|
|
4
|
+
import { AppState } from 'react-native';
|
|
5
|
+
const logger = videoLoggerSystem.getLogger('callingx');
|
|
4
6
|
/**
|
|
5
7
|
* This function is used to check if the call should be ended based on the push notification
|
|
6
8
|
* Useful for callkeep management to end the call if necessary (with reportEndCallWithUUID)
|
|
7
9
|
*/
|
|
8
10
|
export const shouldCallBeEnded = (callFromPush, created_by_id, receiver_id) => {
|
|
9
|
-
/* callkeep reasons for ending a call
|
|
10
|
-
FAILED: 1,
|
|
11
|
-
REMOTE_ENDED: 2,
|
|
12
|
-
UNANSWERED: 3,
|
|
13
|
-
ANSWERED_ELSEWHERE: 4,
|
|
14
|
-
DECLINED_ELSEWHERE: 5,
|
|
15
|
-
MISSED: 6
|
|
16
|
-
*/
|
|
17
11
|
const callSession = callFromPush.state.session;
|
|
18
12
|
const rejected_by = callSession?.rejected_by;
|
|
19
13
|
const accepted_by = callSession?.accepted_by;
|
|
20
14
|
let mustEndCall = false;
|
|
21
|
-
let
|
|
15
|
+
let endCallReason = 'unknown';
|
|
22
16
|
if (created_by_id && rejected_by) {
|
|
23
17
|
if (rejected_by[created_by_id]) {
|
|
24
|
-
// call was cancelled by the caller
|
|
18
|
+
// call was cancelled by the caller before the receiver could answer
|
|
25
19
|
mustEndCall = true;
|
|
26
|
-
|
|
20
|
+
endCallReason = 'canceled';
|
|
27
21
|
}
|
|
28
22
|
} else if (receiver_id && rejected_by) {
|
|
29
23
|
if (rejected_by[receiver_id]) {
|
|
30
24
|
// call was rejected by the receiver in some other device
|
|
31
25
|
mustEndCall = true;
|
|
32
|
-
|
|
26
|
+
endCallReason = 'rejected';
|
|
33
27
|
}
|
|
34
28
|
} else if (receiver_id && accepted_by) {
|
|
35
29
|
if (accepted_by[receiver_id]) {
|
|
36
30
|
// call was accepted by the receiver in some other device
|
|
37
31
|
mustEndCall = true;
|
|
38
|
-
|
|
32
|
+
endCallReason = 'answeredElsewhere';
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
|
-
videoLoggerSystem.getLogger('shouldCallBeEnded').debug(`callCid: ${callFromPush.cid} mustEndCall: ${mustEndCall}
|
|
35
|
+
videoLoggerSystem.getLogger('shouldCallBeEnded').debug(`callCid: ${callFromPush.cid} mustEndCall: ${mustEndCall} endCallReason: ${endCallReason}`);
|
|
42
36
|
return {
|
|
43
37
|
mustEndCall,
|
|
44
|
-
|
|
38
|
+
endCallReason
|
|
45
39
|
};
|
|
46
40
|
};
|
|
47
41
|
|
|
@@ -49,56 +43,63 @@ export const shouldCallBeEnded = (callFromPush, created_by_id, receiver_id) => {
|
|
|
49
43
|
1. we need to create a new client and connect the user to decline the call
|
|
50
44
|
2. this is because the app is in background state and we don't have a client to get the call and do an action
|
|
51
45
|
*/
|
|
52
|
-
export const processCallFromPushInBackground = async (pushConfig, call_cid, action) => {
|
|
46
|
+
export const processCallFromPushInBackground = async (pushConfig, call_cid, action, onIOSActionCanBeFulfilled) => {
|
|
53
47
|
let videoClient;
|
|
54
48
|
try {
|
|
55
49
|
videoClient = await pushConfig.createStreamVideoClient();
|
|
56
50
|
if (!videoClient) {
|
|
57
|
-
|
|
51
|
+
throw new Error('createStreamVideoClient returned null');
|
|
58
52
|
}
|
|
59
53
|
} catch (e) {
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
logger.error('processCallFromPushInBackground: failed to create video client', e);
|
|
55
|
+
onIOSActionCanBeFulfilled(true);
|
|
62
56
|
return;
|
|
63
57
|
}
|
|
64
|
-
await processCallFromPush(videoClient, call_cid, action, pushConfig);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* This function is used process the call from push notifications due to incoming call
|
|
69
|
-
* It does the following steps:
|
|
70
|
-
* 1. Get the call from the client if present or create a new call
|
|
71
|
-
* 2. Fetch the latest state of the call from the server if its not already in ringing state
|
|
72
|
-
* 3. Join or leave the call based on the user's action.
|
|
73
|
-
*/
|
|
74
|
-
export const processCallFromPush = async (client, call_cid, action, pushConfig) => {
|
|
75
58
|
let callFromPush;
|
|
76
59
|
try {
|
|
77
|
-
callFromPush = await
|
|
60
|
+
callFromPush = await videoClient.onRingingCall(call_cid);
|
|
78
61
|
} catch (e) {
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
logger.error('processCallFromPushInBackground: failed to fetch call from push notification', e);
|
|
63
|
+
onIOSActionCanBeFulfilled(true);
|
|
81
64
|
return;
|
|
82
65
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
if (action === 'accept') {
|
|
67
|
+
if (pushConfig.publishOptions) {
|
|
68
|
+
callFromPush.updatePublishOptions(pushConfig.publishOptions);
|
|
69
|
+
}
|
|
70
|
+
logger.debug(`joining call from push notification with callCid: ${callFromPush.cid}`);
|
|
71
|
+
const callingState = callFromPush.state.callingState;
|
|
72
|
+
if (callingState !== CallingState.RINGING && callingState !== CallingState.IDLE) {
|
|
73
|
+
logger.debug(`skipping join call as it is not in ringing or idle state from push notification. callCid: ${callFromPush.cid}`);
|
|
74
|
+
onIOSActionCanBeFulfilled(true);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
onIOSActionCanBeFulfilled(false);
|
|
90
79
|
await callFromPush.join();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
} catch (e) {
|
|
81
|
+
logger.warn('processCallFromPushInBackground: failed to join call from push notification', e);
|
|
82
|
+
}
|
|
83
|
+
} else if (action === 'decline') {
|
|
84
|
+
const alreadyLeft = callFromPush.state.callingState === CallingState.LEFT;
|
|
85
|
+
if (alreadyLeft) {
|
|
86
|
+
onIOSActionCanBeFulfilled(false);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const canReject = callFromPush.state.callingState === CallingState.RINGING || callFromPush.state.callingState === CallingState.IDLE;
|
|
90
|
+
const isCurrentUserMember = callFromPush.state.members.some(member => member.user_id === callFromPush.currentUserId);
|
|
91
|
+
const reject = canReject && isCurrentUserMember;
|
|
92
|
+
logger.debug(`declining call from push notification with callCid: ${callFromPush.cid} reject: ${reject}`);
|
|
93
|
+
try {
|
|
94
94
|
await callFromPush.leave({
|
|
95
|
-
reject
|
|
95
|
+
reject,
|
|
96
96
|
reason: 'decline'
|
|
97
97
|
});
|
|
98
|
+
onIOSActionCanBeFulfilled(false);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
logger.warn('processCallFromPushInBackground: failed to decline call from push notification', e);
|
|
101
|
+
onIOSActionCanBeFulfilled(true);
|
|
98
102
|
}
|
|
99
|
-
} catch (e) {
|
|
100
|
-
const logger = videoLoggerSystem.getLogger('processCallFromPush');
|
|
101
|
-
logger.warn(`failed to process ${action} call from push notification`, e);
|
|
102
103
|
}
|
|
103
104
|
};
|
|
104
105
|
|
|
@@ -122,8 +123,8 @@ export const processNonIncomingCallFromPush = async (client, call_cid, nonRingin
|
|
|
122
123
|
await callFromPush.get();
|
|
123
124
|
}
|
|
124
125
|
} catch (e) {
|
|
125
|
-
const
|
|
126
|
-
|
|
126
|
+
const nonRingingCallLogger = videoLoggerSystem.getLogger('processNonIncomingCallFromPush');
|
|
127
|
+
nonRingingCallLogger.error('failed to fetch call from push notification', e);
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
130
|
onNewCallNotification(callFromPush, nonRingingNotificationType);
|
|
@@ -148,4 +149,17 @@ export const clearPushWSEventSubscriptions = call_cid => {
|
|
|
148
149
|
export const canAddPushWSSubscriptionsRef = {
|
|
149
150
|
current: true
|
|
150
151
|
};
|
|
152
|
+
export const canListenToWS = () => canAddPushWSSubscriptionsRef.current && AppState.currentState !== 'active';
|
|
153
|
+
export const shouldCallBeClosed = (call, pushData) => {
|
|
154
|
+
const created_by_id = pushData?.created_by_id;
|
|
155
|
+
const receiver_id = pushData?.receiver_id;
|
|
156
|
+
const {
|
|
157
|
+
mustEndCall,
|
|
158
|
+
endCallReason
|
|
159
|
+
} = shouldCallBeEnded(call, created_by_id, receiver_id);
|
|
160
|
+
return {
|
|
161
|
+
mustEndCall,
|
|
162
|
+
endCallReason
|
|
163
|
+
};
|
|
164
|
+
};
|
|
151
165
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CallingState","videoLoggerSystem","onNewCallNotification","pushUnsubscriptionCallbacks","shouldCallBeEnded","callFromPush","created_by_id","receiver_id","callSession","state","session","rejected_by","accepted_by","mustEndCall","
|
|
1
|
+
{"version":3,"names":["CallingState","videoLoggerSystem","onNewCallNotification","pushUnsubscriptionCallbacks","AppState","logger","getLogger","shouldCallBeEnded","callFromPush","created_by_id","receiver_id","callSession","state","session","rejected_by","accepted_by","mustEndCall","endCallReason","debug","cid","processCallFromPushInBackground","pushConfig","call_cid","action","onIOSActionCanBeFulfilled","videoClient","createStreamVideoClient","Error","e","error","onRingingCall","publishOptions","updatePublishOptions","callingState","RINGING","IDLE","join","warn","alreadyLeft","LEFT","canReject","isCurrentUserMember","members","some","member","user_id","currentUserId","reject","leave","reason","processNonIncomingCallFromPush","client","nonRingingNotificationType","_callFromPush","calls","find","c","callType","callId","split","call","get","nonRingingCallLogger","clearPushWSEventSubscriptions","unsubscriptionCallbacks","forEach","cb","delete","canAddPushWSSubscriptionsRef","current","canListenToWS","currentState","shouldCallBeClosed","pushData"],"sourceRoot":"../../../../../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AAMhE,aAAa,GAAGgE,QAAQ,EAAEhE,aAAuB;EACvD,MAAMC,WAAW,GAAG+D,QAAQ,EAAE/D,WAAqB;EAEnD,MAAM;IAAEM,WAAW;IAAEC;EAAc,CAAC,GAAGV,iBAAiB,CACtDqD,IAAI,EACJnD,aAAa,EACbC,WACF,CAAC;EACD,OAAO;IAAEM,WAAW;IAAEC;EAAc,CAAC;AACvC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","pushNonRingingCallData$","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","videoLoggerSystem","setPushLogoutCallback","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","logger","getLogger","trace","next","undefined","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","trigger","request","payload","stream","JSON","stringify","oniOSNotifeeEvent","OS","detail","notifeeLib","EventType","PRESS","notification","data","result","debug","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","warn","push_provider_name","addDevice","then","catch","isExpo","expoNotificationsLib","getDevicePushTokenAsync","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,iBAAiB,QAAQ,yBAAyB;AAC9E,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SAASC,aAAa,QAAQ,kBAAkB;AAKhD,IAAIC,YAAY,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,M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ingCallData$","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","videoLoggerSystem","setPushLogoutCallback","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","logger","getLogger","trace","next","undefined","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","trigger","request","payload","stream","JSON","stringify","oniOSNotifeeEvent","OS","detail","notifeeLib","EventType","PRESS","notification","data","result","debug","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","warn","push_provider_name","addDevice","then","catch","isExpo","expoNotificationsLib","getDevicePushTokenAsync","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,iBAAiB,QAAQ,yBAAyB;AAC9E,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/B,MAAMG,MAAM,GAAGZ,iBAAiB,CAACa,SAAS,CACxC,4CACF,CAAC;IACDD,MAAM,CAACE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AAK;MAC7DQ,MAAM,CAACyB,KAAK,CACV,wEAAwE,EACxEjC,KACF,CAAC;MACDgD,cAAc,CAAChD,KAAK,CAAC;IACvB,CAAC,CAAC;IACF6C,sBAAsB,CAAC,MAAM;MAC3BrC,MAAM,CAACyB,KAAK,CAAC,wDAAwD,CAAC;MACtEG,sBAAsB,CAAC+B,mBAAmB,CAAC,UAAU,CAAC;IACxD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
let callingx;
|
|
2
|
+
try {
|
|
3
|
+
callingx = require('@stream-io/react-native-callingx').CallingxModule;
|
|
4
|
+
} catch {}
|
|
5
|
+
export function getCallingxLib() {
|
|
6
|
+
if (!callingx) {
|
|
7
|
+
throw Error('react-native-callingx library is not installed.');
|
|
8
|
+
}
|
|
9
|
+
return callingx;
|
|
10
|
+
}
|
|
11
|
+
export function getCallingxLibIfAvailable() {
|
|
12
|
+
return callingx ?? undefined;
|
|
13
|
+
}
|
|
14
|
+
export function extractCallingExpOptions(config) {
|
|
15
|
+
const {
|
|
16
|
+
push: pushConfig,
|
|
17
|
+
foregroundService: foregroundServiceConfig
|
|
18
|
+
} = config;
|
|
19
|
+
const callingExpOptions = {};
|
|
20
|
+
if (pushConfig?.ios) {
|
|
21
|
+
const iosOptions = {};
|
|
22
|
+
if (pushConfig.ios.supportsVideo !== undefined) {
|
|
23
|
+
iosOptions.supportsVideo = pushConfig.ios.supportsVideo;
|
|
24
|
+
}
|
|
25
|
+
if (pushConfig.ios.sound !== undefined) {
|
|
26
|
+
iosOptions.sound = pushConfig.ios.sound;
|
|
27
|
+
}
|
|
28
|
+
if (pushConfig.ios.imageName !== undefined) {
|
|
29
|
+
iosOptions.imageName = pushConfig.ios.imageName;
|
|
30
|
+
}
|
|
31
|
+
if (pushConfig.ios.callsHistory !== undefined) {
|
|
32
|
+
iosOptions.callsHistory = pushConfig.ios.callsHistory;
|
|
33
|
+
}
|
|
34
|
+
if (pushConfig.ios.displayCallTimeout !== undefined) {
|
|
35
|
+
iosOptions.displayCallTimeout = pushConfig.ios.displayCallTimeout;
|
|
36
|
+
}
|
|
37
|
+
if (Object.keys(iosOptions).length > 0) {
|
|
38
|
+
callingExpOptions.ios = iosOptions;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const androidOptions = {};
|
|
42
|
+
if (pushConfig?.android) {
|
|
43
|
+
if (pushConfig.android.incomingChannel) {
|
|
44
|
+
androidOptions.incomingChannel = pushConfig.android.incomingChannel;
|
|
45
|
+
}
|
|
46
|
+
if (pushConfig.android.titleTransformer) {
|
|
47
|
+
androidOptions.titleTransformer = pushConfig.android.titleTransformer;
|
|
48
|
+
}
|
|
49
|
+
if (pushConfig.android.subtitleTransformer) {
|
|
50
|
+
androidOptions.subtitleTransformer = pushConfig.android.subtitleTransformer;
|
|
51
|
+
}
|
|
52
|
+
if (pushConfig.android.notificationTexts) {
|
|
53
|
+
androidOptions.notificationTexts = pushConfig.android.notificationTexts;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (foregroundServiceConfig.android.channel) {
|
|
57
|
+
androidOptions.ongoingChannel = foregroundServiceConfig.android.channel;
|
|
58
|
+
}
|
|
59
|
+
if (Object.keys(androidOptions).length > 0) {
|
|
60
|
+
callingExpOptions.android = androidOptions;
|
|
61
|
+
}
|
|
62
|
+
if (pushConfig?.shouldRejectCallWhenBusy !== undefined) {
|
|
63
|
+
callingExpOptions.shouldRejectCallWhenBusy = pushConfig.shouldRejectCallWhenBusy;
|
|
64
|
+
}
|
|
65
|
+
if (pushConfig?.enableOngoingCalls !== undefined) {
|
|
66
|
+
callingExpOptions.enableOngoingCalls = pushConfig?.enableOngoingCalls;
|
|
67
|
+
}
|
|
68
|
+
return callingExpOptions;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=callingx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["callingx","require","CallingxModule","getCallingxLib","Error","getCallingxLibIfAvailable","undefined","extractCallingExpOptions","config","push","pushConfig","foregroundService","foregroundServiceConfig","callingExpOptions","ios","iosOptions","supportsVideo","sound","imageName","callsHistory","displayCallTimeout","Object","keys","length","androidOptions","android","incomingChannel","titleTransformer","subtitleTransformer","notificationTexts","channel","ongoingChannel","shouldRejectCallWhenBusy","enableOngoingCalls"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/callingx.ts"],"mappings":"AAUA,IAAIA,QAAoC;AAExC,IAAI;EACFA,QAAQ,GAAGC,OAAO,CAAC,kCAAkC,CAAC,CAACC,cAAc;AACvE,CAAC,CAAC,MAAM,CAAC;AAET,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,IAAI,CAACH,QAAQ,EAAE;IACb,MAAMI,KAAK,CAAC,iDAAiD,CAAC;EAChE;EACA,OAAOJ,QAAQ;AACjB;AAEA,OAAO,SAASK,yBAAyBA,CAAA,EAAG;EAC1C,OAAOL,QAAQ,IAAIM,SAAS;AAC9B;AAEA,OAAO,SAASC,wBAAwBA,CACtCC,MAAyB,EACN;EACnB,MAAM;IAAEC,IAAI,EAAEC,UAAU;IAAEC,iBAAiB,EAAEC;EAAwB,CAAC,GACpEJ,MAAM;EACR,MAAMK,iBAAoC,GAAG,CAAC,CAAC;EAE/C,IAAIH,UAAU,EAAEI,GAAG,EAAE;IACnB,MAAMC,UAAoC,GAAG,CAAC,CAAC;IAC/C,IAAIL,UAAU,CAACI,GAAG,CAACE,aAAa,KAAKV,SAAS,EAAE;MAC9CS,UAAU,CAACC,aAAa,GAAGN,UAAU,CAACI,GAAG,CAACE,aAAa;IACzD;IACA,IAAIN,UAAU,CAACI,GAAG,CAACG,KAAK,KAAKX,SAAS,EAAE;MACtCS,UAAU,CAACE,KAAK,GAAGP,UAAU,CAACI,GAAG,CAACG,KAAK;IACzC;IACA,IAAIP,UAAU,CAACI,GAAG,CAACI,SAAS,KAAKZ,SAAS,EAAE;MAC1CS,UAAU,CAACG,SAAS,GAAGR,UAAU,CAAC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AACY,OAAO,GAAGD,cAAc;EAC5C;EAEA,IAAId,UAAU,EAAEsB,wBAAwB,KAAK1B,SAAS,EAAE;IACtDO,iBAAiB,CAACmB,wBAAwB,GACxCtB,UAAU,CAACsB,wBAAwB;EACvC;EAEA,IAAItB,UAAU,EAAEuB,kBAAkB,KAAK3B,SAAS,EAAE;IAChDO,iBAAiB,CAACoB,kBAAkB,GAAGvB,UAAU,EAAEuB,kBAAkB;EACvE;EAEA,OAAOpB,iBAAiB;AAC1B","ignoreList":[]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from './expoNotifications';
|
|
2
2
|
export * from './firebaseMessaging';
|
|
3
3
|
export * from './iosPushNotification';
|
|
4
|
-
export * from './voipPushNotification';
|
|
5
|
-
export * from './callkeep';
|
|
6
4
|
export * from './notifee';
|
|
5
|
+
export * from './callingx';
|
|
7
6
|
|
|
8
7
|
/*
|
|
9
8
|
NOTE: must keep each libs in different files
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/push/libs/index.ts"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/push/libs/index.ts"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,WAAW;AACzB,cAAc,YAAY;;AAE1B;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { PermissionsAndroid } from 'react-native';
|
|
2
1
|
import { lib } from './lib';
|
|
3
|
-
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
4
2
|
var AndroidForegroundServiceType = /*#__PURE__*/function (AndroidForegroundServiceType) {
|
|
5
3
|
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CAMERA"] = 64] = "FOREGROUND_SERVICE_TYPE_CAMERA";
|
|
6
4
|
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE"] = 16] = "FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE";
|
|
@@ -27,24 +25,8 @@ export function getNotifeeLibThrowIfNotInstalledForPush() {
|
|
|
27
25
|
return lib;
|
|
28
26
|
}
|
|
29
27
|
export function getNotifeeLibNoThrowForKeepCallAlive() {
|
|
30
|
-
if (!lib) {
|
|
31
|
-
const logger = videoLoggerSystem.getLogger('getNotifeeLibNoThrow');
|
|
32
|
-
logger.info(`${'@notifee/react-native library not installed. It is required to keep call alive in the background for Android. '}${INSTALLATION_INSTRUCTION}`);
|
|
33
|
-
}
|
|
34
28
|
return lib;
|
|
35
29
|
}
|
|
36
|
-
export async function getKeepCallAliveForegroundServiceTypes() {
|
|
37
|
-
const types = [AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK];
|
|
38
|
-
const hasCameraPermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.CAMERA);
|
|
39
|
-
if (hasCameraPermission) {
|
|
40
|
-
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_CAMERA);
|
|
41
|
-
}
|
|
42
|
-
const hasMicrophonePermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
|
|
43
|
-
if (hasMicrophonePermission) {
|
|
44
|
-
types.push(AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_MICROPHONE);
|
|
45
|
-
}
|
|
46
|
-
return types;
|
|
47
|
-
}
|
|
48
30
|
export function getIncomingCallForegroundServiceTypes() {
|
|
49
31
|
const types = [AndroidForegroundServiceType.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE];
|
|
50
32
|
return types;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["lib","AndroidForegroundServiceType","INSTALLATION_INSTRUCTION","getNotifeeLibThrowIfNotInstalledForPush","Error","getNotifeeLibNoThrowForKeepCallAlive","getIncomingCallForegroundServiceTypes","types","FOREGROUND_SERVICE_TYPE_SHORT_SERVICE"],"sourceRoot":"../../../../../../src","sources":["utils/push/libs/notifee/index.ts"],"mappings":"AAAA,SAASA,GAAG,QAAmB,OAAO;AAAC,IAIlCC,4BAA4B,0BAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA,EAA5BA,4BAA4B;AAkBjC,MAAMC,wBAAwB,GAC5B,6FAA6F;AAE/F,OAAO,SAASC,uCAAuCA,CAAA,EAAG;EACxD,IAAI,CAACH,GAAG,EAAE;IACR,MAAMI,KAAK,CACT,8FAA8F,GAC5FF,wBACJ,CAAC;EACH;EACA,OAAOF,GAAG;AACZ;AAEA,OAAO,SAASK,oCAAoCA,CAAA,EAAG;EACrD,OAAOL,GAAG;AACZ;AAEA,OAAO,SAASM,qCAAqCA,CAAA,EAAG;EACtD,MAAMC,KAAqC,GAAG,CAC5CN,4BAA4B,CAACO,qCAAqC,CACnE;EACD,OAAOD,KAAK;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
2
|
+
import { clearPushWSEventSubscriptions, processCallFromPushInBackground } from './internal/utils';
|
|
3
|
+
import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
|
|
4
|
+
import { resolvePendingAudioSession } from '../internal/callingx/audioSessionPromise';
|
|
5
|
+
import { getCallingxLib } from './libs/callingx';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
const logger = videoLoggerSystem.getLogger('callingx');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Sets up callingx event listeners for handling call actions from the native calling UI.
|
|
11
|
+
*/
|
|
12
|
+
export function setupCallingExpEvents(pushConfig) {
|
|
13
|
+
const hasPushProvider = Platform.OS === 'android' && pushConfig.android?.pushProviderName || Platform.OS === 'ios' && pushConfig.ios?.pushProviderName;
|
|
14
|
+
if (!hasPushProvider) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const callingx = getCallingxLib();
|
|
18
|
+
const {
|
|
19
|
+
remove: removeAnswerCall
|
|
20
|
+
} = callingx.addEventListener('answerCall', params => {
|
|
21
|
+
onAcceptCall(pushConfig)(params);
|
|
22
|
+
});
|
|
23
|
+
const {
|
|
24
|
+
remove: removeEndCall
|
|
25
|
+
} = callingx.addEventListener('endCall', params => {
|
|
26
|
+
onEndCall(pushConfig)(params);
|
|
27
|
+
});
|
|
28
|
+
const {
|
|
29
|
+
remove: removeDidActivateAudioSession
|
|
30
|
+
} = callingx.addEventListener('didActivateAudioSession', onDidActivateAudioSession);
|
|
31
|
+
const {
|
|
32
|
+
remove: removeDidDeactivateAudioSession
|
|
33
|
+
} = callingx.addEventListener('didDeactivateAudioSession', onDidDeactivateAudioSession);
|
|
34
|
+
|
|
35
|
+
//NOTE: until getInitialEvents invocation, events are delayed and won't be sent to event listeners, this is a way to make sure none of required events are missed
|
|
36
|
+
//in most cases there will be no delayed answers or ends, but if so we don't want to miss any of them
|
|
37
|
+
const events = callingx.getInitialEvents();
|
|
38
|
+
events.forEach(event => {
|
|
39
|
+
const {
|
|
40
|
+
eventName,
|
|
41
|
+
params
|
|
42
|
+
} = event;
|
|
43
|
+
if (eventName === 'answerCall') {
|
|
44
|
+
logger.debug(`answerCall delayed event callId: ${params?.callId}`);
|
|
45
|
+
onAcceptCall(pushConfig)(params);
|
|
46
|
+
} else if (eventName === 'endCall') {
|
|
47
|
+
logger.debug(`endCall delayed event callId: ${params?.callId}`);
|
|
48
|
+
onEndCall(pushConfig)(params);
|
|
49
|
+
} else if (eventName === 'didActivateAudioSession') {
|
|
50
|
+
onDidActivateAudioSession();
|
|
51
|
+
} else if (eventName === 'didDeactivateAudioSession') {
|
|
52
|
+
onDidDeactivateAudioSession();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
setPushLogoutCallback(async () => {
|
|
56
|
+
removeAnswerCall();
|
|
57
|
+
removeEndCall();
|
|
58
|
+
removeDidActivateAudioSession();
|
|
59
|
+
removeDidDeactivateAudioSession();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const onDidActivateAudioSession = () => {
|
|
63
|
+
logger.debug('callingExpDidActivateAudioSession');
|
|
64
|
+
resolvePendingAudioSession();
|
|
65
|
+
};
|
|
66
|
+
const onDidDeactivateAudioSession = () => {
|
|
67
|
+
logger.debug('callingExpDidDeactivateAudioSession');
|
|
68
|
+
};
|
|
69
|
+
const onAcceptCall = pushConfig => ({
|
|
70
|
+
callId: call_cid,
|
|
71
|
+
source
|
|
72
|
+
}) => {
|
|
73
|
+
logger.debug(`onAcceptCall event call_cid: ${call_cid} source: ${source}`);
|
|
74
|
+
if (source === 'app' || !call_cid) {
|
|
75
|
+
// App-initiated actions are fulfilled on the native side immediately — nothing to do here
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const callingx = getCallingxLib();
|
|
79
|
+
clearPushWSEventSubscriptions(call_cid);
|
|
80
|
+
processCallFromPushInBackground(pushConfig, call_cid, 'accept', didFail => {
|
|
81
|
+
callingx.fulfillAnswerCallAction(call_cid, didFail);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const onEndCall = pushConfig => ({
|
|
85
|
+
callId: call_cid,
|
|
86
|
+
source
|
|
87
|
+
}) => {
|
|
88
|
+
logger.debug(`onEndCall event call_cid: ${call_cid} source: ${source}`);
|
|
89
|
+
if (source === 'app' || !call_cid) {
|
|
90
|
+
// App-initiated actions are fulfilled on the native side immediately — nothing to do here
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const callingx = getCallingxLib();
|
|
94
|
+
clearPushWSEventSubscriptions(call_cid);
|
|
95
|
+
processCallFromPushInBackground(pushConfig, call_cid, 'decline', didFail => {
|
|
96
|
+
callingx.fulfillEndCallAction(call_cid, didFail);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=setupCallingExpEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["videoLoggerSystem","clearPushWSEventSubscriptions","processCallFromPushInBackground","setPushLogoutCallback","resolvePendingAudioSession","getCallingxLib","Platform","logger","getLogger","setupCallingExpEvents","pushConfig","hasPushProvider","OS","android","pushProviderName","ios","callingx","remove","removeAnswerCall","addEventListener","params","onAcceptCall","removeEndCall","onEndCall","removeDidActivateAudioSession","onDidActivateAudioSession","removeDidDeactivateAudioSession","onDidDeactivateAudioSession","events","getInitialEvents","forEach","event","eventName","debug","callId","call_cid","source","didFail","fulfillAnswerCallAction","fulfillEndCallAction"],"sourceRoot":"../../../../src","sources":["utils/push/setupCallingExpEvents.ts"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAyB;AAE3D,SACEC,6BAA6B,EAC7BC,+BAA+B,QAC1B,kBAAkB;AACzB,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,0BAA0B,QAAQ,0CAA0C;AACrF,SACEC,cAAc,QAGT,iBAAiB;AACxB,SAASC,QAAQ,QAAQ,cAAc;AAIvC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QAAQ,CAACsB,uBAAuB,CAACH,QAAQ,EAAEE,OAAO,CAAC;EACrD,CACF,CAAC;AACH,CAAC;AAEH,MAAMd,SAAS,GACZb,UAAsB,IACvB,CAAC;EAAEwB,MAAM,EAAEC,QAAQ;EAAEC;AAA+B,CAAC,KAAK;EACxD7B,MAAM,CAAC0B,KAAK,CAAC,6BAA6BE,QAAQ,YAAYC,MAAM,EAAE,CAAC;EAEvE,IAAIA,MAAM,KAAK,KAAK,IAAI,CAACD,QAAQ,EAAE;IACjC;IACA;EACF;EAEA,MAAMnB,QAAQ,GAAGX,cAAc,CAAC,CAAC;EACjCJ,6BAA6B,CAACkC,QAAQ,CAAC;EACvCjC,+BAA+B,CAC7BQ,UAAU,EACVyB,QAAQ,EACR,SAAS,EACRE,OAAO,IAAK;IACXrB,QAAQ,CAACuB,oBAAoB,CAACJ,QAAQ,EAAEE,OAAO,CAAC;EAClD,CACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { getVoipPushNotificationLib } from './libs';
|
|
1
|
+
// import { getVoipPushNotificationLib } from './libs';
|
|
2
|
+
|
|
2
3
|
import { Platform } from 'react-native';
|
|
3
4
|
import { onVoipNotificationReceived } from './internal/ios';
|
|
4
5
|
import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
|
|
5
6
|
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
7
|
+
import { getCallingxLib } from './libs';
|
|
6
8
|
export function setupIosVoipPushEvents(pushConfig) {
|
|
7
9
|
if (Platform.OS !== 'ios' || !pushConfig.ios?.pushProviderName) {
|
|
8
10
|
return;
|
|
@@ -13,14 +15,13 @@ export function setupIosVoipPushEvents(pushConfig) {
|
|
|
13
15
|
logger.debug('ios pushProviderName is not defined, so skipping the setupIosVoipPushEvents');
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onVoipNotificationReceived(notification, pushConfig);
|
|
18
|
+
const callingx = getCallingxLib();
|
|
19
|
+
const voipNotificationReceivedListener = callingx.addEventListener('voipNotificationReceived', params => {
|
|
20
|
+
onVoipNotificationReceived(params, pushConfig);
|
|
20
21
|
});
|
|
21
22
|
setPushLogoutCallback(async () => {
|
|
22
23
|
videoLoggerSystem.getLogger('setPushLogoutCallback').debug('notification event listener removed');
|
|
23
|
-
|
|
24
|
+
voipNotificationReceivedListener.remove();
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
//# sourceMappingURL=setupIosVoipPushEvents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Platform","onVoipNotificationReceived","setPushLogoutCallback","videoLoggerSystem","getCallingxLib","setupIosVoipPushEvents","pushConfig","OS","ios","pushProviderName","logger","getLogger","debug","callingx","voipNotificationReceivedListener","addEventListener","params","remove"],"sourceRoot":"../../../../src","sources":["utils/push/setupIosVoipPushEvents.ts"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,0BAA0B,QAAQ,gBAAgB;AAC3D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,cAAc,QAAQ,QAAQ;AAEvC,OAAO,SAASC,sBAAsBA,CACpCC,UAAkD,EAClD;EACA,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAI,CAACD,UAAU,CAACE,GAAG,EAAEC,gBAAgB,EAAE;IAC9D;EACF;EACA,MAAMC,MAAM,GAAGP,iBAAiB,CAACQ,SAAS,CAAC,wBAAwB,CAAC;EACpE,IAAI,CAACL,UAAU,CAACE,GAAG,CAACC,gBAAgB,EAAE;IACpC;IACAC,MAAM,CAACE,KAAK,CACV,6EACF,CAAC;IACD;EACF;EAEA,MAAMC,QAAQ,GAAGT,cAAc,CAAC,CAAC;EACjC,MAAMU,gCAAgC,GAAGD,QAAQ,CAACE,gBAAgB,CAChE,0BAA0B,EACzBC,MAAM,IAAK;IACVf,0BAA0B,CAACe,MAAM,EAAEV,UAAU,CAAC;EAChD,CACF,CAAC;EAEDJ,qBAAqB,CAAC,YAAY;IAChCC,iBAAiB,CACdQ,SAAS,CAAC,uBAAuB,CAAC,CAClCC,KAAK,CAAC,qCAAqC,CAAC;IAC/CE,gCAAgC,CAACG,MAAM,CAAC,CAAC;EAC3C,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/dist/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '1.30.
|
|
1
|
+
export const version = '1.30.1-beta.1';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"names":["version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YAKjC,CAAC"}
|