@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
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { CallingState, videoLoggerSystem } from '@stream-io/video-client';
|
|
2
2
|
import { AppState, Platform } from 'react-native';
|
|
3
|
-
import { getExpoNotificationsLib, getExpoNotificationsLibNoThrow, getFirebaseMessagingLib, getFirebaseMessagingLibNoThrow,
|
|
4
|
-
import {
|
|
3
|
+
import { getExpoNotificationsLib, getExpoNotificationsLibNoThrow, getFirebaseMessagingLib, getFirebaseMessagingLibNoThrow, getNotifeeLibThrowIfNotInstalledForPush } from './libs';
|
|
4
|
+
import { pushNonRingingCallData$ } from './internal/rxSubjects';
|
|
5
5
|
import { pushUnsubscriptionCallbacks } from './internal/constants';
|
|
6
|
-
import {
|
|
6
|
+
import { canListenToWS, shouldCallBeClosed } from './internal/utils';
|
|
7
7
|
import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
|
|
8
|
-
import { getAndroidDefaultRingtoneUrl } from '../getAndroidDefaultRingtoneUrl';
|
|
9
8
|
import { StreamVideoRN } from '../StreamVideoRN';
|
|
10
|
-
|
|
11
|
-
const DECLINE_CALL_ACTION_ID = 'decline';
|
|
9
|
+
import { getCallingxLib } from './libs/callingx';
|
|
12
10
|
let lastFirebaseToken = {
|
|
13
11
|
token: '',
|
|
14
12
|
userId: ''
|
|
@@ -63,8 +61,7 @@ export async function initAndroidPushToken(client, pushConfig, setUnsubscribeLis
|
|
|
63
61
|
await setDeviceToken(token);
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
const messaging = pushConfig.isExpo && !pushConfig.android.incomingCallChannel ? getFirebaseMessagingLibNoThrow(true) : getFirebaseMessagingLib();
|
|
64
|
+
const messaging = pushConfig.isExpo ? getFirebaseMessagingLibNoThrow(true) : getFirebaseMessagingLib();
|
|
68
65
|
if (messaging) {
|
|
69
66
|
logger.debug(`setting firebase token listeners`);
|
|
70
67
|
const unsubscribe = messaging().onTokenRefresh(refreshedToken => setDeviceToken(refreshedToken));
|
|
@@ -78,8 +75,8 @@ export async function initAndroidPushToken(client, pushConfig, setUnsubscribeLis
|
|
|
78
75
|
* Creates notification from the push message data.
|
|
79
76
|
* For Ringing and Non-Ringing calls.
|
|
80
77
|
*/
|
|
78
|
+
|
|
81
79
|
export const firebaseDataHandler = async data => {
|
|
82
|
-
if (Platform.OS !== 'android') return;
|
|
83
80
|
/* Example data from firebase
|
|
84
81
|
"message": {
|
|
85
82
|
"data": {
|
|
@@ -95,174 +92,155 @@ export const firebaseDataHandler = async data => {
|
|
|
95
92
|
// other stuff
|
|
96
93
|
}
|
|
97
94
|
*/
|
|
95
|
+
if (Platform.OS !== 'android') return;
|
|
96
|
+
const logger = videoLoggerSystem.getLogger('firebaseDataHandler');
|
|
98
97
|
const pushConfig = StreamVideoRN.getConfig().push;
|
|
99
98
|
if (!pushConfig || !data || data.sender !== 'stream.video') {
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
|
-
const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
|
|
103
|
-
const notifee = notifeeLib.default;
|
|
104
|
-
const settings = await notifee.getNotificationSettings();
|
|
105
|
-
if (settings.authorizationStatus !== 1) {
|
|
106
|
-
const logger = videoLoggerSystem.getLogger('firebaseDataHandler');
|
|
107
|
-
logger.debug(`Notification permission not granted, unable to post ${data.type} notifications`);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
101
|
if (data.type === 'call.ring') {
|
|
111
102
|
const call_cid = data.call_cid;
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
} = shouldCallBeEnded(callToCheck, created_by_id, receiver_id);
|
|
120
|
-
return mustEndCall;
|
|
121
|
-
};
|
|
122
|
-
const canListenToWS = () => canAddPushWSSubscriptionsRef.current && AppState.currentState !== 'active';
|
|
103
|
+
const callingx = getCallingxLib();
|
|
104
|
+
const client = await pushConfig.createStreamVideoClient();
|
|
105
|
+
if (!client) {
|
|
106
|
+
logger.debug(`video client not found, skipping the call.ring notification`);
|
|
107
|
+
await callingx.stopService();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
123
110
|
const asForegroundService = canListenToWS();
|
|
124
111
|
if (asForegroundService) {
|
|
125
112
|
// Listen to call events from WS through fg service
|
|
126
113
|
// note: this will replace the current empty fg service runner
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
114
|
+
//we need to start service (e.g. by calling display incoming call) and than launch bg task, consider making those steps independent
|
|
115
|
+
await callingx.startBackgroundTask((_, stopTask) => {
|
|
116
|
+
return new Promise(resolve => {
|
|
117
|
+
const finishBackgroundTask = () => {
|
|
118
|
+
callingx.log(`Finishing background task for callCid: ${call_cid}`, 'debug');
|
|
119
|
+
resolve(undefined);
|
|
120
|
+
stopTask();
|
|
121
|
+
};
|
|
122
|
+
(async () => {
|
|
123
|
+
try {
|
|
124
|
+
const _client = await pushConfig.createStreamVideoClient();
|
|
125
|
+
if (!_client) {
|
|
126
|
+
logger.debug(`Closing fg service as there is no client to create from push config`);
|
|
127
|
+
finishBackgroundTask();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const callFromPush = await _client.onRingingCall(call_cid);
|
|
131
|
+
const {
|
|
132
|
+
mustEndCall,
|
|
133
|
+
endCallReason
|
|
134
|
+
} = shouldCallBeClosed(callFromPush, data);
|
|
135
|
+
if (mustEndCall) {
|
|
136
|
+
logger.debug(`Closing fg service callCid: ${call_cid} endCallReason: ${endCallReason}`);
|
|
137
|
+
callingx.log(`Ending call with callCid: ${call_cid} endCallReason: ${endCallReason}`, 'debug');
|
|
138
|
+
callingx.endCallWithReason(call_cid, endCallReason);
|
|
139
|
+
resolve(undefined);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const unsubscribeFunctions = [];
|
|
143
|
+
// check if service needs to be closed if accept/decline event was done on another device
|
|
144
|
+
const unsubscribe = callFromPush.on('all', event => {
|
|
145
|
+
const _canListenToWS = canListenToWS();
|
|
146
|
+
if (!_canListenToWS) {
|
|
147
|
+
logger.debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, {
|
|
148
|
+
event
|
|
149
|
+
});
|
|
150
|
+
unsubscribeFunctions.forEach(fn => fn());
|
|
151
|
+
finishBackgroundTask();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const {
|
|
155
|
+
mustEndCall: mustEndCallFromEvent,
|
|
156
|
+
endCallReason: endCallReasonFromEvent
|
|
157
|
+
} = shouldCallBeClosed(callFromPush, data);
|
|
158
|
+
if (mustEndCallFromEvent) {
|
|
159
|
+
logger.debug(`Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed`, {
|
|
160
|
+
event
|
|
161
|
+
});
|
|
162
|
+
unsubscribeFunctions.forEach(fn => fn());
|
|
163
|
+
callingx.endCallWithReason(call_cid, endCallReasonFromEvent);
|
|
164
|
+
resolve(undefined);
|
|
165
|
+
}
|
|
149
166
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
167
|
+
|
|
168
|
+
// check if service needs to be closed if call was left
|
|
169
|
+
const stateSubscription = callFromPush.state.callingState$.subscribe(callingState => {
|
|
170
|
+
if (callingState === CallingState.IDLE || callingState === CallingState.LEFT) {
|
|
171
|
+
logger.debug(`Closing fg service from callingState callCid: ${call_cid} callingState: ${callingState}`);
|
|
172
|
+
unsubscribeFunctions.forEach(fn => fn());
|
|
173
|
+
callingx.log(`Ending call with callCid: ${call_cid} callingState: ${callingState}`, 'debug');
|
|
174
|
+
resolve(undefined);
|
|
175
|
+
}
|
|
158
176
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
const endCallSubscription = callingx.addEventListener('endCall', async ({
|
|
178
|
+
callId
|
|
179
|
+
}) => {
|
|
180
|
+
unsubscribeFunctions.forEach(fn => fn());
|
|
181
|
+
try {
|
|
182
|
+
await callFromPush.leave({
|
|
183
|
+
reject: true,
|
|
184
|
+
reason: 'decline'
|
|
185
|
+
});
|
|
186
|
+
} catch (error) {
|
|
187
|
+
logger.error(`Failed to leave call with callCid: ${call_cid} error: ${error}`);
|
|
188
|
+
} finally {
|
|
189
|
+
callingx.log(`Ending call with callCid: ${call_cid} callId: ${callId}`, 'debug');
|
|
190
|
+
resolve(undefined);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
//stop background task when app comes to foreground
|
|
195
|
+
const appStateSubscription = AppState.addEventListener('change', nextAppState => {
|
|
196
|
+
const _canListenToWS = canListenToWS();
|
|
197
|
+
callingx.log(`AppState changed to: ${nextAppState} for callCid: ${call_cid} canListenToWS: ${_canListenToWS}`, 'debug');
|
|
198
|
+
if (!_canListenToWS) {
|
|
199
|
+
unsubscribeFunctions.forEach(fn => fn());
|
|
200
|
+
finishBackgroundTask();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
unsubscribeFunctions.push(unsubscribe);
|
|
205
|
+
unsubscribeFunctions.push(() => stateSubscription.unsubscribe());
|
|
206
|
+
unsubscribeFunctions.push(() => endCallSubscription.remove());
|
|
207
|
+
unsubscribeFunctions.push(() => appStateSubscription.remove());
|
|
208
|
+
pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
|
|
209
|
+
pushUnsubscriptionCallbacks.set(call_cid, unsubscribeFunctions);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
callingx.log(`Failed to start background task with callCid: ${call_cid} error: ${error}`, 'error');
|
|
212
|
+
finishBackgroundTask();
|
|
169
213
|
}
|
|
170
|
-
});
|
|
171
|
-
unsubscribeFunctions.push(unsubscribe);
|
|
172
|
-
unsubscribeFunctions.push(() => subscription.unsubscribe());
|
|
173
|
-
pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
|
|
174
|
-
pushUnsubscriptionCallbacks.set(call_cid, unsubscribeFunctions);
|
|
214
|
+
})();
|
|
175
215
|
});
|
|
176
216
|
});
|
|
177
217
|
}
|
|
178
|
-
const incomingCallChannel = pushConfig.android.incomingCallChannel;
|
|
179
|
-
const incomingCallNotificationTextGetters = pushConfig.android.incomingCallNotificationTextGetters;
|
|
180
|
-
if (!incomingCallChannel || !incomingCallNotificationTextGetters) {
|
|
181
|
-
const logger = videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler');
|
|
182
|
-
logger.error("Can't show incoming call notification as either or both incomingCallChannel and incomingCallNotificationTextGetters were not provided");
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
/*
|
|
186
|
-
* Sound has to be set on channel level for android 8 and above and cant be updated later after creation!
|
|
187
|
-
* For android 7 and below, sound should be set on notification level
|
|
188
|
-
*/
|
|
189
|
-
// set default ringtone if not provided
|
|
190
|
-
if (!incomingCallChannel.sound) {
|
|
191
|
-
incomingCallChannel.sound = await getAndroidDefaultRingtoneUrl();
|
|
192
|
-
}
|
|
193
|
-
await notifee.createChannel(incomingCallChannel);
|
|
194
|
-
const {
|
|
195
|
-
getTitle,
|
|
196
|
-
getBody,
|
|
197
|
-
getAcceptButtonTitle,
|
|
198
|
-
getDeclineButtonTitle
|
|
199
|
-
} = incomingCallNotificationTextGetters;
|
|
200
|
-
const createdUserName = data.created_by_display_name;
|
|
201
|
-
const title = getTitle(createdUserName);
|
|
202
|
-
const body = getBody(createdUserName);
|
|
203
|
-
videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler').debug(`Displaying incoming call notification with callCid: ${call_cid} title: ${title} body: ${body} asForegroundService: ${asForegroundService}`);
|
|
204
|
-
const channelId = incomingCallChannel.id;
|
|
205
|
-
await notifee.displayNotification({
|
|
206
|
-
id: call_cid,
|
|
207
|
-
title: getTitle(createdUserName),
|
|
208
|
-
body: getBody(createdUserName),
|
|
209
|
-
data,
|
|
210
|
-
android: {
|
|
211
|
-
channelId,
|
|
212
|
-
smallIcon: pushConfig.android.smallIcon,
|
|
213
|
-
importance: 4,
|
|
214
|
-
// high importance
|
|
215
|
-
foregroundServiceTypes: getIncomingCallForegroundServiceTypes(),
|
|
216
|
-
asForegroundService,
|
|
217
|
-
ongoing: true,
|
|
218
|
-
sound: incomingCallChannel.sound,
|
|
219
|
-
vibrationPattern: incomingCallChannel.vibrationPattern,
|
|
220
|
-
loopSound: true,
|
|
221
|
-
pressAction: {
|
|
222
|
-
id: 'default',
|
|
223
|
-
launchActivity: 'default' // open the app when the notification is pressed
|
|
224
|
-
},
|
|
225
|
-
actions: [{
|
|
226
|
-
title: getDeclineButtonTitle?.() ?? 'Decline',
|
|
227
|
-
pressAction: {
|
|
228
|
-
id: DECLINE_CALL_ACTION_ID
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
title: getAcceptButtonTitle?.() ?? 'Accept',
|
|
232
|
-
pressAction: {
|
|
233
|
-
id: ACCEPT_CALL_ACTION_ID,
|
|
234
|
-
launchActivity: 'default' // open the app when the notification is pressed
|
|
235
|
-
}
|
|
236
|
-
}],
|
|
237
|
-
category: notifeeLib.AndroidCategory.CALL,
|
|
238
|
-
fullScreenAction: {
|
|
239
|
-
id: 'stream_ringing_incoming_call'
|
|
240
|
-
},
|
|
241
|
-
timeoutAfter: 60000 // 60 seconds, after which the notification will be dismissed automatically
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
218
|
if (asForegroundService) {
|
|
245
219
|
// no need to check if call has be closed as that will be handled by the fg service
|
|
246
220
|
return;
|
|
247
221
|
}
|
|
248
|
-
|
|
249
|
-
// check if call needs to be closed if accept/decline event was done
|
|
250
|
-
// before the notification was shown
|
|
251
|
-
const client = await pushConfig.createStreamVideoClient();
|
|
252
|
-
if (!client) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
222
|
const callFromPush = await client.onRingingCall(call_cid);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
223
|
+
const {
|
|
224
|
+
mustEndCall,
|
|
225
|
+
endCallReason
|
|
226
|
+
} = shouldCallBeClosed(callFromPush, data);
|
|
227
|
+
if (mustEndCall) {
|
|
228
|
+
logger.debug(`Removing incoming call notification immediately with callCid: ${call_cid} as it should be closed`);
|
|
229
|
+
callingx.endCallWithReason(call_cid, endCallReason);
|
|
259
230
|
}
|
|
260
231
|
} else {
|
|
232
|
+
const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
|
|
233
|
+
const notifee = notifeeLib.default;
|
|
234
|
+
const settings = await notifee.getNotificationSettings();
|
|
235
|
+
if (settings.authorizationStatus !== 1) {
|
|
236
|
+
logger.debug(`Notification permission not granted, unable to post ${data.type} notifications`);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
261
240
|
// the other types are call.live_started and call.notification
|
|
262
241
|
const callChannel = pushConfig.android.callChannel;
|
|
263
242
|
const callNotificationTextGetters = pushConfig.android.callNotificationTextGetters;
|
|
264
243
|
if (!callChannel || !callNotificationTextGetters) {
|
|
265
|
-
const logger = videoLoggerSystem.getLogger('firebaseMessagingOnMessageHandler');
|
|
266
244
|
logger.debug("Can't show call notification as either or both callChannel and callNotificationTextGetters is not provided");
|
|
267
245
|
return;
|
|
268
246
|
}
|
|
@@ -277,10 +255,10 @@ export const firebaseDataHandler = async data => {
|
|
|
277
255
|
const type = data.type;
|
|
278
256
|
const title = getTitle(type, createdUserName);
|
|
279
257
|
const body = getBody(type, createdUserName);
|
|
280
|
-
|
|
258
|
+
logger.debug(`Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`);
|
|
281
259
|
await notifee.displayNotification({
|
|
282
|
-
title
|
|
283
|
-
body
|
|
260
|
+
title,
|
|
261
|
+
body,
|
|
284
262
|
data,
|
|
285
263
|
android: {
|
|
286
264
|
sound: callChannel.sound,
|
|
@@ -304,8 +282,7 @@ export const firebaseDataHandler = async data => {
|
|
|
304
282
|
}
|
|
305
283
|
};
|
|
306
284
|
export const onAndroidNotifeeEvent = async ({
|
|
307
|
-
event
|
|
308
|
-
isBackground
|
|
285
|
+
event
|
|
309
286
|
}) => {
|
|
310
287
|
if (Platform.OS !== 'android') return;
|
|
311
288
|
const {
|
|
@@ -313,8 +290,7 @@ export const onAndroidNotifeeEvent = async ({
|
|
|
313
290
|
detail
|
|
314
291
|
} = event;
|
|
315
292
|
const {
|
|
316
|
-
notification
|
|
317
|
-
pressAction
|
|
293
|
+
notification
|
|
318
294
|
} = detail;
|
|
319
295
|
const notificationId = notification?.id;
|
|
320
296
|
const data = notification?.data;
|
|
@@ -325,53 +301,10 @@ export const onAndroidNotifeeEvent = async ({
|
|
|
325
301
|
|
|
326
302
|
// we can safely cast to string because the data is from "stream.video"
|
|
327
303
|
const call_cid = data.call_cid;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const notifee = notifeeLib.default;
|
|
333
|
-
// Check if we need to decline the call
|
|
334
|
-
const didPressDecline = type === notifeeLib.EventType.ACTION_PRESS && pressAction?.id === DECLINE_CALL_ACTION_ID;
|
|
335
|
-
const didDismiss = type === notifeeLib.EventType.DISMISSED;
|
|
336
|
-
const mustDecline = didPressDecline || didDismiss;
|
|
337
|
-
// Check if we need to accept the call
|
|
338
|
-
const mustAccept = type === notifeeLib.EventType.ACTION_PRESS && pressAction?.id === ACCEPT_CALL_ACTION_ID;
|
|
339
|
-
if (mustAccept || mustDecline || type === notifeeLib.EventType.ACTION_PRESS) {
|
|
340
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`clearPushWSEventSubscriptions for callCId: ${call_cid} mustAccept: ${mustAccept} mustDecline: ${mustDecline}`);
|
|
341
|
-
clearPushWSEventSubscriptions(call_cid);
|
|
342
|
-
notifee.stopForegroundService();
|
|
343
|
-
}
|
|
344
|
-
if (mustAccept) {
|
|
345
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushAcceptedIncomingCallCId$ added with callCId: ${call_cid}`);
|
|
346
|
-
pushAcceptedIncomingCallCId$.next(call_cid);
|
|
347
|
-
// NOTE: accept will be handled by the app with rxjs observers as the app will go to foreground always
|
|
348
|
-
} else if (mustDecline) {
|
|
349
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushRejectedIncomingCallCId$ added with callCId: ${call_cid}`);
|
|
350
|
-
pushRejectedIncomingCallCId$.next(call_cid);
|
|
351
|
-
if (hasObservers) {
|
|
352
|
-
// if we had observers we can return here as the observers will handle the call as the app is in the foreground state
|
|
353
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`Skipped processCallFromPushInBackground for Declining call with callCId: ${call_cid} as the app is in the foreground state`);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`start processCallFromPushInBackground - Declining call with callCId: ${call_cid}`);
|
|
357
|
-
await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
|
|
358
|
-
} else {
|
|
359
|
-
if (type === notifeeLib.EventType.PRESS) {
|
|
360
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushTappedIncomingCallCId$ added with callCId: ${call_cid}`);
|
|
361
|
-
pushTappedIncomingCallCId$.next(call_cid);
|
|
362
|
-
// pressed state will be handled by the app with rxjs observers as the app will go to foreground always
|
|
363
|
-
} else if (isBackground && type === notifeeLib.EventType.DELIVERED) {
|
|
364
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`pushAndroidBackgroundDeliveredIncomingCallCId$ added with callCId: ${call_cid}`);
|
|
365
|
-
pushAndroidBackgroundDeliveredIncomingCallCId$.next(call_cid);
|
|
366
|
-
// background delivered state will be handled by the app with rxjs observers as processing needs to happen only when app is opened
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
} else {
|
|
370
|
-
const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
|
|
371
|
-
if (type === notifeeLib.EventType.PRESS) {
|
|
372
|
-
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`onTapNonRingingCallNotification with callCId: ${call_cid}`);
|
|
373
|
-
pushConfig.onTapNonRingingCallNotification?.(call_cid, data.type);
|
|
374
|
-
}
|
|
304
|
+
const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
|
|
305
|
+
if (type === notifeeLib.EventType.PRESS) {
|
|
306
|
+
videoLoggerSystem.getLogger('onAndroidNotifeeEvent').debug(`onTapNonRingingCallNotification with callCId: ${call_cid}`);
|
|
307
|
+
pushConfig.onTapNonRingingCallNotification?.(call_cid, data.type);
|
|
375
308
|
}
|
|
376
309
|
};
|
|
377
310
|
//# sourceMappingURL=android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CallingState","videoLoggerSystem","AppState","Platform","getExpoNotificationsLib","getExpoNotificationsLibNoThrow","getFirebaseMessagingLib","getFirebaseMessagingLibNoThrow","getIncomingCallForegroundServiceTypes","getNotifeeLibThrowIfNotInstalledForPush","pushAcceptedIncomingCallCId$","pushAndroidBackgroundDeliveredIncomingCallCId$","pushNonRingingCallData$","pushRejectedIncomingCallCId$","pushTappedIncomingCallCId$","pushUnsubscriptionCallbacks","canAddPushWSSubscriptionsRef","clearPushWSEventSubscriptions","processCallFromPushInBackground","shouldCallBeEnded","setPushLogoutCallback","getAndroidDefaultRingtoneUrl","StreamVideoRN","ACCEPT_CALL_ACTION_ID","DECLINE_CALL_ACTION_ID","lastFirebaseToken","token","userId","initAndroidPushToken","client","pushConfig","setUnsubscribeListener","OS","android","pushProviderName","logger","getLogger","setDeviceToken","streamClient","_user","id","anonymous","debug","removeDevice","err","warn","push_provider_name","addDevice","isExpo","expoNotificationsLib","onTapNonRingingCallNotification","subscription","addPushTokenListener","devicePushToken","data","remove","getDevicePushTokenAsync","messaging","incomingCallChannel","unsubscribe","onTokenRefresh","refreshedToken","getToken","firebaseDataHandler","getConfig","push","sender","notifeeLib","notifee","default","settings","getNotificationSettings","authorizationStatus","type","call_cid","created_by_id","receiver_id","video_client","createStreamVideoClient","onRingingCall","shouldCallBeClosed","callToCheck","mustEndCall","canListenToWS","current","currentState","asForegroundService","registerForegroundService","Promise","stopForegroundService","callFromPush","_shouldCallBeClosed","unsubscribeFunctions","on","event","_canListenToWS","forEach","fn","state","callingState$","subscribe","callingState","IDLE","LEFT","get","cb","set","incomingCallNotificationTextGetters","error","sound","createChannel","getTitle","getBody","getAcceptButtonTitle","getDeclineButtonTitle","createdUserName","created_by_display_name","title","body","channelId","displayNotification","smallIcon","importance","foregroundServiceTypes","ongoing","vibrationPattern","loopSound","pressAction","launchActivity","actions","category","AndroidCategory","CALL","fullScreenAction","timeoutAfter","cancelDisplayedNotification","callChannel","callNotificationTextGetters","cid","next","onAndroidNotifeeEvent","isBackground","detail","notification","notificationId","hasObservers","observed","didPressDecline","EventType","ACTION_PRESS","didDismiss","DISMISSED","mustDecline","mustAccept","PRESS","DELIVERED"],"sourceRoot":"../../../../src","sources":["utils/push/android.ts"],"mappings":"AAAA,SAEEA,YAAY,EAEZC,iBAAiB,QACZ,yBAAyB;AAChC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAKjD,SAEEC,uBAAuB,EACvBC,8BAA8B,EAC9BC,uBAAuB,EACvBC,8BAA8B,EAC9BC,qCAAqC,EACrCC,uCAAuC,QAElC,QAAQ;AACf,SACEC,4BAA4B,EAC5BC,8CAA8C,EAC9CC,uBAAuB,EACvBC,4BAA4B,EAC5BC,0BAA0B,QACrB,uBAAuB;AAC9B,SAASC,2BAA2B,QAAQ,sBAAsB;AAClE,SACEC,4BAA4B,EAC5BC,6BAA6B,EAC7BC,+BAA+B,EAC/BC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,4BAA4B,QAAQ,iCAAiC;AAC9E,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,MAAMC,qBAAqB,GAAG,QAAQ;AACtC,MAAMC,sBAAsB,GAAG,SAAS;AAUxC,IAAIC,iBAAiB,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;;AAEjD;AACA,OAAO,eAAeC,oBAAoBA,CACxCC,MAAyB,EACzBC,UAAsB,EACtBC,sBAAyD,EACzD;EACA,IAAI5B,QAAQ,CAAC6B,EAAE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C6H,IAAI,CAACjE,QAAQ,CAAC;QACzC;MACF,CAAC,MAAM,IAAImE,YAAY,IAAIpE,IAAI,KAAKN,UAAU,CAACiF,SAAS,CAACO,SAAS,EAAE;QAClE1J,iBAAiB,CACdmC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CACJ,sEAAsEgC,QAAQ,EAChF,CAAC;QACH/D,8CAA8C,CAACgI,IAAI,CAACjE,QAAQ,CAAC;QAC7D;MACF;IACF;EACF,CAAC,MAAM;IACL,MAAMP,UAAU,GAAG1D,uCAAuC,CAAC,CAAC;IAC5D,IAAIgE,IAAI,KAAKN,UAAU,CAACiF,SAAS,CAACM,KAAK,EAAE;MACvCzJ,iBAAiB,CACdmC,SAAS,CAAC,uBAAuB,CAAC,CAClCM,KAAK,CAAC,iDAAiDgC,QAAQ,EAAE,CAAC;MACrE5C,UAAU,CAACoB,+BAA+B,GACxCwB,QAAQ,EACRpB,IAAI,CAACmB,IACP,CAAC;IACH;EACF;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CallingState","videoLoggerSystem","AppState","Platform","getExpoNotificationsLib","getExpoNotificationsLibNoThrow","getFirebaseMessagingLib","getFirebaseMessagingLibNoThrow","getNotifeeLibThrowIfNotInstalledForPush","pushNonRingingCallData$","pushUnsubscriptionCallbacks","canListenToWS","shouldCallBeClosed","setPushLogoutCallback","StreamVideoRN","getCallingxLib","lastFirebaseToken","token","userId","initAndroidPushToken","client","pushConfig","setUnsubscribeListener","OS","android","pushProviderName","logger","getLogger","setDeviceToken","streamClient","_user","id","anonymous","debug","removeDevice","err","warn","push_provider_name","addDevice","isExpo","expoNotificationsLib","onTapNonRingingCallNotification","subscription","addPushTokenListener","devicePushToken","data","remove","getDevicePushTokenAsync","messaging","unsubscribe","onTokenRefresh","refreshedToken","getToken","firebaseDataHandler","getConfig","push","sender","type","call_cid","callingx","createStreamVideoClient","stopService","asForegroundService","startBackgroundTask","_","stopTask","Promise","resolve","finishBackgroundTask","log","undefined","_client","callFromPush","onRingingCall","mustEndCall","endCallReason","endCallWithReason","unsubscribeFunctions","on","event","_canListenToWS","forEach","fn","mustEndCallFromEvent","endCallReasonFromEvent","stateSubscription","state","callingState$","subscribe","callingState","IDLE","LEFT","endCallSubscription","addEventListener","callId","leave","reject","reason","error","appStateSubscription","nextAppState","get","cb","set","notifeeLib","notifee","default","settings","getNotificationSettings","authorizationStatus","callChannel","callNotificationTextGetters","createChannel","channelId","getTitle","getBody","createdUserName","created_by_display_name","title","body","displayNotification","sound","smallIcon","vibrationPattern","importance","pressAction","launchActivity","timeoutAfter","cid","next","onAndroidNotifeeEvent","detail","notification","notificationId","EventType","PRESS"],"sourceRoot":"../../../../src","sources":["utils/push/android.ts"],"mappings":"AAAA,SACEA,YAAY,EAEZC,iBAAiB,QACZ,yBAAyB;AAChC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAKjD,SAEEC,uBAAuB,EACvBC,8BAA8B,EAC9BC,uBAAuB,EACvBC,8BAA8B,EAC9BC,uCAAuC,QAElC,QAAQ;AACf,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAASC,2BAA2B,QAAQ,sBAAsB;AAClE,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,kBAAkB;AACpE,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,iBAAiB;AAUhD,IAAIC,iBAAiB,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;;AAEjD;AACA,OAAO,eAAeC,oBAAoBA,CACxCC,MAAyB,EACzBC,UAAsB,EACtBC,sBAAyD,EACzD;EACA,IAAInB,QAAQ,CAACoB,EAAE,KAAK,SAAS,IAAI,CAACF,UAAU,CAACG,OAAO,CAACC,gBAAgB,EAAE;IACrE;EACF;EACA,MAAMC,MAAM,GAAGzB,iBAAiB,CAAC0B,SAAS,CAAC,sBAAsB,CAAC;E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AAC","ignoreList":[]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getCallKeepLib, getVoipPushNotificationLib } from '../libs';
|
|
3
|
-
import { voipPushNotificationCallCId$ } from './rxSubjects';
|
|
1
|
+
import { Platform } from 'react-native';
|
|
4
2
|
import { pushUnsubscriptionCallbacks } from './constants';
|
|
5
|
-
import {
|
|
3
|
+
import { canListenToWS, shouldCallBeClosed } from './utils';
|
|
6
4
|
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
5
|
+
import { getCallingxLib } from '../libs/callingx';
|
|
7
6
|
export const onVoipNotificationReceived = async (notification, pushConfig) => {
|
|
8
7
|
/* --- Example payload ---
|
|
9
8
|
{
|
|
@@ -27,6 +26,7 @@ export const onVoipNotificationReceived = async (notification, pushConfig) => {
|
|
|
27
26
|
"version": "v2"
|
|
28
27
|
}
|
|
29
28
|
} */
|
|
29
|
+
const logger = videoLoggerSystem.getLogger('callingx - onVoipNotificationReceived');
|
|
30
30
|
const sender = notification?.stream?.sender;
|
|
31
31
|
const type = notification?.stream?.type;
|
|
32
32
|
// do not process any other notifications other than stream.video or ringing
|
|
@@ -37,47 +37,31 @@ export const onVoipNotificationReceived = async (notification, pushConfig) => {
|
|
|
37
37
|
if (!call_cid || Platform.OS !== 'ios' || !pushConfig.ios.pushProviderName) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const callingx = getCallingxLib();
|
|
41
|
+
if (callingx.isCallTracked(call_cid)) {
|
|
42
|
+
//same call_cid is already tracked, so we skip the notification
|
|
43
|
+
logger.debug(`the same call_cid ${call_cid} is already tracked, skipping the call.ring notification`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
41
46
|
const client = await pushConfig.createStreamVideoClient();
|
|
42
47
|
if (!client) {
|
|
43
48
|
logger.debug('client not found, not processing call.ring voip push notification');
|
|
44
49
|
return;
|
|
45
50
|
}
|
|
46
|
-
const shouldRejectCallWhenBusy = client['rejectCallWhenBusy'] ?? false;
|
|
47
|
-
if (shouldRejectCallWhenBusy) {
|
|
48
|
-
// inform the iOS native module that we should reject call when busy
|
|
49
|
-
NativeModules.StreamVideoReactNative.setShouldRejectCallWhenBusy(shouldRejectCallWhenBusy);
|
|
50
|
-
}
|
|
51
51
|
const callFromPush = await client.onRingingCall(call_cid);
|
|
52
|
-
let uuid = '';
|
|
53
|
-
try {
|
|
54
|
-
uuid = await NativeModules?.StreamVideoReactNative?.getIncomingCallUUid(call_cid);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
logger.error('Error in getting call uuid from native module', error);
|
|
57
|
-
}
|
|
58
|
-
if (!uuid) {
|
|
59
|
-
logger.error(`Not processing call.ring push notification, as no uuid found for call_cid: ${call_cid}`);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const created_by_id = notification?.stream?.created_by_id;
|
|
63
|
-
const receiver_id = notification?.stream?.receiver_id;
|
|
64
52
|
function closeCallIfNecessary() {
|
|
65
53
|
const {
|
|
66
54
|
mustEndCall,
|
|
67
|
-
|
|
68
|
-
} =
|
|
55
|
+
endCallReason
|
|
56
|
+
} = shouldCallBeClosed(callFromPush, notification?.stream);
|
|
69
57
|
if (mustEndCall) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
callkeep.reportEndCallWithUUID(uuid, callkeepReason);
|
|
73
|
-
const voipPushNotification = getVoipPushNotificationLib();
|
|
74
|
-
voipPushNotification.onVoipNotificationCompleted(uuid);
|
|
58
|
+
logger.debug(`callingx.endCallWithReason for call_cid: ${call_cid} endCallReason: ${endCallReason}`);
|
|
59
|
+
callingx.endCallWithReason(call_cid, endCallReason);
|
|
75
60
|
return true;
|
|
76
61
|
}
|
|
77
62
|
return false;
|
|
78
63
|
}
|
|
79
64
|
const closed = closeCallIfNecessary();
|
|
80
|
-
const canListenToWS = () => canAddPushWSSubscriptionsRef.current && AppState.currentState !== 'active';
|
|
81
65
|
if (!closed && canListenToWS()) {
|
|
82
66
|
const unsubscribe = callFromPush.on('all', event => {
|
|
83
67
|
const _canListenToWS = canListenToWS();
|
|
@@ -95,9 +79,8 @@ export const onVoipNotificationReceived = async (notification, pushConfig) => {
|
|
|
95
79
|
pushUnsubscriptionCallbacks.get(call_cid)?.forEach(cb => cb());
|
|
96
80
|
pushUnsubscriptionCallbacks.set(call_cid, [unsubscribe]);
|
|
97
81
|
}
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
logger.debug(`call_cid:${call_cid}
|
|
101
|
-
voipPushNotificationCallCId$.next(call_cid);
|
|
82
|
+
|
|
83
|
+
// callingx event listeners (setupCallingExpEvents) will handle accept/reject
|
|
84
|
+
logger.debug(`call_cid:${call_cid} received and processed from call.ring push notification`);
|
|
102
85
|
};
|
|
103
86
|
//# sourceMappingURL=ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Platform","pushUnsubscriptionCallbacks","canListenToWS","shouldCallBeClosed","videoLoggerSystem","getCallingxLib","onVoipNotificationReceived","notification","pushConfig","logger","getLogger","sender","stream","type","call_cid","OS","ios","pushProviderName","callingx","isCallTracked","debug","client","createStreamVideoClient","callFromPush","onRingingCall","closeCallIfNecessary","mustEndCall","endCallReason","endCallWithReason","closed","unsubscribe","on","event","_canListenToWS","_closed","get","forEach","cb","set"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/ios.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,2BAA2B,QAAQ,aAAa;AACzD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,SAAS;AAE3D,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,OAAO,MAAMC,0BAA0B,GAAG,MAAAA,CACxCC,YAAiB,EACjBC,UAAkD,KAC/C;EACH;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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