@stream-io/video-react-native-sdk 1.29.0-beta.4 → 1.29.1-beta.0

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.
Files changed (79) hide show
  1. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +20 -5
  2. package/dist/commonjs/hooks/push/index.js +0 -2
  3. package/dist/commonjs/hooks/push/index.js.map +1 -1
  4. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +19 -19
  5. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -1
  6. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  7. package/dist/commonjs/utils/internal/{callingx.js → callingx/callingx.js} +21 -48
  8. package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -0
  9. package/dist/commonjs/utils/internal/registerSDKGlobals.js +1 -1
  10. package/dist/commonjs/utils/push/internal/ios.js +4 -5
  11. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  12. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -26
  13. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  14. package/dist/commonjs/utils/push/internal/utils.js +6 -6
  15. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  16. package/dist/commonjs/utils/push/setupCallingExpEvents.js +21 -10
  17. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -1
  18. package/dist/commonjs/version.js +1 -1
  19. package/dist/commonjs/version.js.map +1 -1
  20. package/dist/module/hooks/push/index.js +0 -2
  21. package/dist/module/hooks/push/index.js.map +1 -1
  22. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +19 -19
  23. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -1
  24. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  25. package/dist/module/utils/internal/{callingx.js → callingx/callingx.js} +21 -48
  26. package/dist/module/utils/internal/callingx/callingx.js.map +1 -0
  27. package/dist/module/utils/internal/registerSDKGlobals.js +1 -1
  28. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  29. package/dist/module/utils/push/internal/ios.js +4 -5
  30. package/dist/module/utils/push/internal/ios.js.map +1 -1
  31. package/dist/module/utils/push/internal/rxSubjects.js +0 -25
  32. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  33. package/dist/module/utils/push/internal/utils.js +6 -6
  34. package/dist/module/utils/push/internal/utils.js.map +1 -1
  35. package/dist/module/utils/push/setupCallingExpEvents.js +21 -10
  36. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -1
  37. package/dist/module/version.js +1 -1
  38. package/dist/module/version.js.map +1 -1
  39. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  40. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -1
  41. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +1 -0
  42. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -0
  43. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  44. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -21
  45. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  46. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  47. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +1 -1
  48. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -1
  49. package/dist/typescript/version.d.ts +1 -1
  50. package/dist/typescript/version.d.ts.map +1 -1
  51. package/ios/StreamVideoReactNative.m +4 -6
  52. package/package.json +4 -4
  53. package/src/hooks/push/index.ts +0 -2
  54. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +23 -23
  55. package/src/utils/internal/{callingx.ts → callingx/callingx.ts} +29 -75
  56. package/src/utils/internal/registerSDKGlobals.ts +1 -1
  57. package/src/utils/push/internal/ios.ts +4 -5
  58. package/src/utils/push/internal/rxSubjects.ts +0 -32
  59. package/src/utils/push/internal/utils.ts +14 -18
  60. package/src/utils/push/setupCallingExpEvents.ts +34 -21
  61. package/src/version.ts +1 -1
  62. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +0 -67
  63. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +0 -1
  64. package/dist/commonjs/utils/internal/audioSessionPromise.js.map +0 -1
  65. package/dist/commonjs/utils/internal/callingx.js.map +0 -1
  66. package/dist/module/hooks/push/useProcessPushCallEffect.js +0 -60
  67. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +0 -1
  68. package/dist/module/utils/internal/audioSessionPromise.js.map +0 -1
  69. package/dist/module/utils/internal/callingx.js.map +0 -1
  70. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +0 -8
  71. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +0 -1
  72. package/dist/typescript/utils/internal/audioSessionPromise.d.ts.map +0 -1
  73. package/dist/typescript/utils/internal/callingx.d.ts.map +0 -1
  74. package/src/hooks/push/useProcessPushCallEffect.ts +0 -108
  75. /package/dist/commonjs/utils/internal/{audioSessionPromise.js → callingx/audioSessionPromise.js} +0 -0
  76. /package/dist/module/utils/internal/{audioSessionPromise.js → callingx/audioSessionPromise.js} +0 -0
  77. /package/dist/typescript/utils/internal/{audioSessionPromise.d.ts → callingx/audioSessionPromise.d.ts} +0 -0
  78. /package/dist/typescript/utils/internal/{callingx.d.ts → callingx/callingx.d.ts} +0 -0
  79. /package/src/utils/internal/{audioSessionPromise.ts → callingx/audioSessionPromise.ts} +0 -0
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useProcessPushCallEffect = void 0;
7
- var _rxSubjects = require("../../utils/push/internal/rxSubjects");
8
- var _react = require("react");
9
- var _utils = require("../../utils");
10
- var _videoReactBindings = require("@stream-io/video-react-bindings");
11
- var _operators = require("rxjs/operators");
12
- var _utils2 = require("../../utils/push/internal/utils");
13
- var _videoClient = require("@stream-io/video-client");
14
- /**
15
- * This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
16
- * It either joins or leaves the call based on the user's action.
17
- * Note: this effect cannot work when push notifications are received when the app is in quit state or in other words when the client is not connected with a websocket.
18
- * So we essentially run this effect only when the client is connected with a websocket.
19
- */
20
- const useProcessPushCallEffect = () => {
21
- const client = (0, _videoReactBindings.useStreamVideoClient)();
22
- const connectedUserId = (0, _videoReactBindings.useConnectedUser)()?.id;
23
- // The Effect to join/reject call automatically when incoming call was received and processed from push notification
24
- (0, _react.useEffect)(() => {
25
- const pushConfig = _utils.StreamVideoRN.getConfig().push;
26
- if (!pushConfig || !client || !connectedUserId) {
27
- return;
28
- }
29
- _videoClient.videoLoggerSystem.getLogger('useProcessPushCallEffect').debug(`Adding subscriptions to process incoming call from push notification`);
30
-
31
- // if the user accepts the call from push notification we join the call
32
- const acceptedCallSubscription = createCallSubscription(_rxSubjects.pushAcceptedIncomingCallCId$, client, pushConfig, 'accept');
33
-
34
- // if the user rejects the call from push notification we leave the call
35
- const declinedCallSubscription = createCallSubscription(_rxSubjects.pushRejectedIncomingCallCId$, client, pushConfig, 'decline');
36
-
37
- // if the user taps the call from push notification we do nothing as the only thing is to get the call which adds it to the client
38
- const pressedCallSubscription = createCallSubscription(_rxSubjects.pushTappedIncomingCallCId$, client, pushConfig, 'pressed');
39
- const backgroundIncomingDeliveredCallSubscription = createCallSubscription(_rxSubjects.pushAndroidBackgroundDeliveredIncomingCallCId$, client, pushConfig, 'backgroundDelivered');
40
- return () => {
41
- acceptedCallSubscription.unsubscribe();
42
- declinedCallSubscription.unsubscribe();
43
- pressedCallSubscription.unsubscribe();
44
- backgroundIncomingDeliveredCallSubscription.unsubscribe();
45
- };
46
- }, [client, connectedUserId]);
47
- };
48
-
49
- /**
50
- * A type guard to check if the cid is not undefined
51
- */
52
- exports.useProcessPushCallEffect = useProcessPushCallEffect;
53
- function cidIsNotUndefined(cid) {
54
- return cid !== undefined;
55
- }
56
-
57
- /**
58
- * The common logic to create a subscription for the given call cid and action
59
- */
60
- const createCallSubscription = (behaviourSubjectWithCallCid, client, pushConfig, action) => {
61
- return behaviourSubjectWithCallCid.pipe((0, _operators.distinctUntilChanged)(), (0, _operators.filter)(cidIsNotUndefined)).subscribe(async callCId => {
62
- _videoClient.videoLoggerSystem.getLogger('useProcessPushCallEffect').debug(`Processing call from push notification with action: ${action} and callCId: ${callCId}`);
63
- await (0, _utils2.processCallFromPush)(client, callCId, action, pushConfig);
64
- behaviourSubjectWithCallCid.next(undefined); // remove the current call id to avoid processing again
65
- });
66
- };
67
- //# sourceMappingURL=useProcessPushCallEffect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_rxSubjects","require","_react","_utils","_videoReactBindings","_operators","_utils2","_videoClient","useProcessPushCallEffect","client","useStreamVideoClient","connectedUserId","useConnectedUser","id","useEffect","pushConfig","StreamVideoRN","getConfig","push","videoLoggerSystem","getLogger","debug","acceptedCallSubscription","createCallSubscription","pushAcceptedIncomingCallCId$","declinedCallSubscription","pushRejectedIncomingCallCId$","pressedCallSubscription","pushTappedIncomingCallCId$","backgroundIncomingDeliveredCallSubscription","pushAndroidBackgroundDeliveredIncomingCallCId$","unsubscribe","exports","cidIsNotUndefined","cid","undefined","behaviourSubjectWithCallCid","action","pipe","distinctUntilChanged","filter","subscribe","callCId","processCallFromPush","next"],"sourceRoot":"../../../../src","sources":["hooks/push/useProcessPushCallEffect.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,wBAAwB,GAAGA,CAAA,KAAM;EAC5C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7Ba,2BAAgE,EAChE3B,MAAyB,EACzBM,UAAkD,EAClDsB,MAAgE,KAC7D;EACH,OAAOD,2BAA2B,CAC/BE,IAAI,CAAC,IAAAC,+BAAoB,EAAC,CAAC,EAAE,IAAAC,iBAAM,EAACP,iBAAiB,CAAC,CAAC,CACvDQ,SAAS,CAAC,MAAOC,OAAO,IAAK;IAC5BvB,8BAAiB,CACdC,SAAS,CAAC,0BAA0B,CAAC,CACrCC,KAAK,CACJ,uDAAuDgB,MAAM,iBAAiBK,OAAO,EACvF,CAAC;IACH,MAAM,IAAAC,2BAAmB,EAAClC,MAAM,EAAEiC,OAAO,EAAEL,MAAM,EAAEtB,UAAU,CAAC;IAC9DqB,2BAA2B,CAACQ,IAAI,CAACT,SAAS,CAAC,CAAC,CAAC;EAC/C,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["pendingResolve","pendingTimeout","isAudioSessionAlreadyActivated","AUDIO_SESSION_TIMEOUT_MS","waitForAudioSessionActivation","Promise","resolve","setTimeout","resolvePendingAudioSession","clearTimeout"],"sourceRoot":"../../../../src","sources":["utils/internal/audioSessionPromise.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAEA,IAAIA,cAAmC,GAAG,IAAI;AAC9C,IAAIC,cAAoD,GAAG,IAAI;AAC/D;AACA;AACA;AACA;AACA,IAAIC,8BAA8B,GAAG,KAAK;AAE1C,MAAMC,wBAAwB,GAAG,IAAI;;AAErC;AACA;AACA;AACA;AACA;AACO,SAASC,6BAA6BA,CAAA,EAAkB;EAC7D,IAAIF,8BAA8B,EAAE;IAClCA,8BAA8B,GAAG,KAAK;IACtC,OAAOG,OAAO,CAACC,OAAO,CAAC,CAAC;EAC1B;EAEA,OAAO,IAAID,OAAO,CAAEC,OAAO,IAAK;IAC9BN,cAAc,GAAGM,OAAO;IACxBL,cAAc,GAAGM,UAAU,CAAC,MAAM;MAChC;MACAC,0BAA0B,CAAC,CAAC;IAC9B,CAAC,EAAEL,wBAAwB,CAAC;EAC9B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACO,SAASK,0BAA0BA,CAAA,EAAS;EACjD,IAAIP,cAAc,EAAE;IAClBQ,YAAY,CAACR,cAAc,CAAC;IAC5BA,cAAc,GAAG,IAAI;EACvB;EAEA,IAAID,cAAc,EAAE;IAClBA,cAAc,CAAC,CAAC;IAChBA,cAAc,GAAG,IAAI;IACrBE,8BAA8B,GAAG,KAAK;EACxC,CAAC,MAAM;IACLA,8BAA8B,GAAG,IAAI;EACvC;AACF","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","_callingx","_videoClient","_audioSessionPromise","CallingxModule","getCallingxLibIfAvailable","getCallDisplayName","callMembers","participants","currentUserId","names","length","filter","member","user","id","map","name","undefined","participant","userId","Boolean","find","sort","join","startCallingxCall","call","isSetup","isOutcomingCall","ringing","isCreatedByMe","isIncomingCall","callDisplayName","state","members","isCallRegistered","cid","isOngoingCallsEnabled","startCall","settings","video","enabled","Platform","OS","waitForAudioSessionActivation","setCurrentCallActive","error","videoLoggerSystem","getLogger","displayIncomingCall","waitForDisplayIncomingCall","answerIncomingCall","endCallingxCall","endCallWithReason","callId","timeoutMs","Promise","resolve","reject","timeoutId","subscription","cleanup","clearTimeout","remove","addEventListener","params","debug","setTimeout","Error"],"sourceRoot":"../../../../src","sources":["utils/internal/callingx.ts"],"mappings":";;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,oBAAA,GAAAH,OAAA;AAZA;AACA;AACA;AACA;;AAWA,MAAMI,cAAc,GAAG,IAAAC,mCAAyB,EAAC,CAAC;;AAElD;AACA;AACA;AACO,SAASC,kBAAkBA,CAChCC,WAAyC,EACzCC,YAAkD,EAClDC,aAAiC,EACjC;EACA,IAAI,CAACF,WAAW,IAAI,CAACC,YAAY,IA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cAAc,CAAC4D,gBAAgB,CAC5C,wBAAwB,EACxB,MAAOC,MAAM,IAAK;MAChBlB,8BAAiB,CACdC,SAAS,CAAC,4BAA4B,CAAC,CACvCkB,KAAK,CAAC,wBAAwB,EAAED,MAAM,CAAC;MAC1CJ,OAAO,CAAC,CAAC;MAET,IAAI;QACF,MAAMzD,cAAc,CAAC+C,kBAAkB,CAACG,MAAM,CAAC;QAC/CG,OAAO,CAAC,CAAC;MACX,CAAC,CAAC,OAAOX,KAAK,EAAE;QACdY,MAAM,CAACZ,KAAK,CAAC;MACf;IACF,CACF,CAAC;IAEDa,SAAS,GAAGQ,UAAU,CAAC,MAAM;MAC3BN,OAAO,CAAC,CAAC;MACTH,MAAM,CACJ,IAAIU,KAAK,CACP,oDAAoDb,SAAS,IAC/D,CACF,CAAC;IACH,CAAC,EAAEA,SAAS,CAAC;EACf,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1,60 +0,0 @@
1
- import { pushAcceptedIncomingCallCId$, pushAndroidBackgroundDeliveredIncomingCallCId$, pushRejectedIncomingCallCId$, pushTappedIncomingCallCId$ } from '../../utils/push/internal/rxSubjects';
2
- import { useEffect } from 'react';
3
- import { StreamVideoRN } from '../../utils';
4
- import { useConnectedUser, useStreamVideoClient } from '@stream-io/video-react-bindings';
5
- import { distinctUntilChanged, filter } from 'rxjs/operators';
6
- import { processCallFromPush } from '../../utils/push/internal/utils';
7
- import { videoLoggerSystem } from '@stream-io/video-client';
8
- /**
9
- * This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
10
- * It either joins or leaves the call based on the user's action.
11
- * Note: this effect cannot work when push notifications are received when the app is in quit state or in other words when the client is not connected with a websocket.
12
- * So we essentially run this effect only when the client is connected with a websocket.
13
- */
14
- export const useProcessPushCallEffect = () => {
15
- const client = useStreamVideoClient();
16
- const connectedUserId = useConnectedUser()?.id;
17
- // The Effect to join/reject call automatically when incoming call was received and processed from push notification
18
- useEffect(() => {
19
- const pushConfig = StreamVideoRN.getConfig().push;
20
- if (!pushConfig || !client || !connectedUserId) {
21
- return;
22
- }
23
- videoLoggerSystem.getLogger('useProcessPushCallEffect').debug(`Adding subscriptions to process incoming call from push notification`);
24
-
25
- // if the user accepts the call from push notification we join the call
26
- const acceptedCallSubscription = createCallSubscription(pushAcceptedIncomingCallCId$, client, pushConfig, 'accept');
27
-
28
- // if the user rejects the call from push notification we leave the call
29
- const declinedCallSubscription = createCallSubscription(pushRejectedIncomingCallCId$, client, pushConfig, 'decline');
30
-
31
- // if the user taps the call from push notification we do nothing as the only thing is to get the call which adds it to the client
32
- const pressedCallSubscription = createCallSubscription(pushTappedIncomingCallCId$, client, pushConfig, 'pressed');
33
- const backgroundIncomingDeliveredCallSubscription = createCallSubscription(pushAndroidBackgroundDeliveredIncomingCallCId$, client, pushConfig, 'backgroundDelivered');
34
- return () => {
35
- acceptedCallSubscription.unsubscribe();
36
- declinedCallSubscription.unsubscribe();
37
- pressedCallSubscription.unsubscribe();
38
- backgroundIncomingDeliveredCallSubscription.unsubscribe();
39
- };
40
- }, [client, connectedUserId]);
41
- };
42
-
43
- /**
44
- * A type guard to check if the cid is not undefined
45
- */
46
- function cidIsNotUndefined(cid) {
47
- return cid !== undefined;
48
- }
49
-
50
- /**
51
- * The common logic to create a subscription for the given call cid and action
52
- */
53
- const createCallSubscription = (behaviourSubjectWithCallCid, client, pushConfig, action) => {
54
- return behaviourSubjectWithCallCid.pipe(distinctUntilChanged(), filter(cidIsNotUndefined)).subscribe(async callCId => {
55
- videoLoggerSystem.getLogger('useProcessPushCallEffect').debug(`Processing call from push notification with action: ${action} and callCId: ${callCId}`);
56
- await processCallFromPush(client, callCId, action, pushConfig);
57
- behaviourSubjectWithCallCid.next(undefined); // remove the current call id to avoid processing again
58
- });
59
- };
60
- //# sourceMappingURL=useProcessPushCallEffect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["pushAcceptedIncomingCallCId$","pushAndroidBackgroundDeliveredIncomingCallCId$","pushRejectedIncomingCallCId$","pushTappedIncomingCallCId$","useEffect","StreamVideoRN","useConnectedUser","useStreamVideoClient","distinctUntilChanged","filter","processCallFromPush","videoLoggerSystem","useProcessPushCallEffect","client","connectedUserId","id","pushConfig","getConfig","push","getLogger","debug","acceptedCallSubscription","createCallSubscription","declinedCallSubscription","pressedCallSubscription","backgroundIncomingDeliveredCallSubscription","unsubscribe","cidIsNotUndefined","cid","undefined","behaviourSubjectWithCallCid","action","pipe","subscribe","callCId","next"],"sourceRoot":"../../../../src","sources":["hooks/push/useProcessPushCallEffect.ts"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,8CAA8C,EAC9CC,4BAA4B,EAC5BC,0BAA0B,QACrB,sCAAsC;AAC7C,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SACEC,gBAAgB,EAChBC,oBAAoB,QACf,iCAAiC;AAExC,SAASC,oBAAoB,EAAEC,MAAM,QAAQ,gBAAgB;AAC7D,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAA4BC,iBAAiB,QAAQ,yBAAyB;AAG9E;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGA,CAAA,KAAM;EAC5C,MAAMC,MAAM,GAAGN,oBAAoB,CAAC,CAAC;EACrC,MAAMO,eAAe,GAAGR,gBAAgB,CAAC,CAAC,EAAES,EAAE;EAC9C;EACAX,SAAS,CAAC,MAAM;IACd,MAAMY,UAAU,GAAGX,aAAa,CAACY,SAAS,CAAC,CAAC,CAACC,IAAI;IACjD,IAAI,CAACF,UAAU,IAAI,CAACH,MAAM,IAAI,CAACC,eAAe,EAAE;MAC9C;IACF;IAEAH,iBAAiB,CACdQ,SAAS,CAAC,0BAA0B,CAAC,CACrCC,KAAK,CACJ,sEACF,CAAC;;IAEH;IACA,MAAMC,wBAAwB,GAAGC,sBAAsB,CACrDtB,4BAA4B,EAC5Ba,MAAM,EACNG,UAAU,EACV,QACF,CAAC;;IAED;IACA,MAA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ingTimeout","isAudioSessionAlreadyActivated","AUDIO_SESSION_TIMEOUT_MS","waitForAudioSessionActivation","Promise","resolve","setTimeout","resolvePendingAudioSession","clearTimeout"],"sourceRoot":"../../../../src","sources":["utils/internal/audioSessionPromise.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,IAAIA,cAAmC,GAAG,IAAI;AAC9C,IAAIC,cAAoD,GAAG,IAAI;AAC/D;AACA;AACA;AACA;AACA,IAAIC,8BAA8B,GAAG,KAAK;AAE1C,MAAMC,wBAAwB,GAAG,IAAI;;AAErC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,6BAA6BA,CAAA,EAAkB;EAC7D,IAAIF,8BAA8B,EAAE;IAClCA,8BAA8B,GAAG,KAAK;IACtC,OAAOG,OAAO,CAACC,OAAO,CAAC,CAAC;EAC1B;EAEA,OAAO,IAAID,OAAO,CAAEC,OAAO,IAAK;IAC9BN,cAAc,GAAGM,OAAO;IACxBL,cAAc,GAAGM,UAAU,CAAC,MAAM;MAChC;MACAC,0BAA0B,CAAC,CAAC;IAC9B,CAAC,EAAEL,wBAAwB,CAAC;EAC9B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,0BAA0BA,CAAA,EAAS;EACjD,IAAIP,cAAc,EAAE;IAClBQ,YAAY,CAACR,cAAc,CAAC;IAC5BA,cAAc,GAAG,IAAI;EACvB;EAEA,IAAID,cAAc,EAAE;IAClBA,cAAc,CAAC,CAAC;IAChBA,cAAc,GAAG,IAAI;IACrBE,8BAA8B,GAAG,KAAK;EACxC,CAAC,MAAM;IACLA,8BAA8B,GAAG,IAAI;EACvC;AACF","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["Platform","getCallingxLibIfAvailable","videoLoggerSystem","waitForAudioSessionActivation","CallingxModule","getCallDisplayName","callMembers","participants","currentUserId","names","length","filter","member","user","id","map","name","undefined","participant","userId","Boolean","find","sort","join","startCallingxCall","call","isSetup","isOutcomingCall","ringing","isCreatedByMe","isIncomingCall","callDisplayName","state","members","isCallRegistered","cid","isOngoingCallsEnabled","startCall","settings","video","enabled","OS","setCurrentCallActive","error","getLogger","displayIncomingCall","waitForDisplayIncomingCall","answerIncomingCall","endCallingxCall","endCallWithReason","callId","timeoutMs","Promise","resolve","reject","timeoutId","subscription","cleanup","clearTimeout","remove","addEventListener","params","debug","setTimeout","Error"],"sourceRoot":"../../../../src","sources":["utils/internal/callingx.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,yBAAyB,QAAQ,uBAAuB;AACjE,SAIEC,iBAAiB,QACZ,yBAAyB;AAChC,SAASC,6BAA6B,QAAQ,uBAAuB;AAErE,MAAMC,cAAc,GAAGH,yBAAyB,CAAC,CAAC;;AAElD;AACA;AACA;AACA,OAAO,SAASI,kBAAkBA,CAChCC,WAAyC,EACzCC,YAAkD,EAClDC,aAAiC,EACjC;EACA,IAAI,CAACF,WAAW,IAAI,CAACC,YAAY,IAAI,CAACC,aAAa,EAAE;IACnD,OAAO,MAAM;EACf;EAEA,IAAIC,KAAe,GAAG,EAAE;EAExB,IAAIH,WAAW,CAACI,MAAM,GAAG,CAAC,EAAE;IAC1B;IACAD,KAAK,GAAGH,WAAW,CAChBK,MAAM,CAAEC,MAAM,IAAKA,MAAM,CAACC,IAAI,CAACC,EAAE,KAAKN,aAAa,CAAC,CACpDO,GAAG,CAAEH,MAAM,IAAKA,MAAM,CAACC,IAAI,CAACG,IAAI,CAAC,CACjCL,MAAM,CAAEK,IAAI,IAAqBA,IAAI,KAAKC,SAAS,CAAC;EACzD,CAAC,MAAM,IAAIV,YAAY,CAACG,MAAM,GAAG,CAAC,EAAE;IAClC;IACAD,KAAK,GAAGF,YAAY,CACjBI,MAAM,CAAEO,WAAW,IAAKA,WAAW,CAACC,MAAM,KAAKX,aAAa,CAAC,CAC7DO,GAAG,CAAEG,WAAW,IAAKA,WAAW,CAACF,IAAI,CAAC,CACtCL,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0 @@
1
- /**
2
- * This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
3
- * It either joins or leaves the call based on the user's action.
4
- * Note: this effect cannot work when push notifications are received when the app is in quit state or in other words when the client is not connected with a websocket.
5
- * So we essentially run this effect only when the client is connected with a websocket.
6
- */
7
- export declare const useProcessPushCallEffect: () => void;
8
- //# sourceMappingURL=useProcessPushCallEffect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProcessPushCallEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useProcessPushCallEffect.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,YAsDpC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioSessionPromise.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/audioSessionPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC,CAa7D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAajD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/callingx.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,IAAI,EACJ,cAAc,EACd,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAKjC;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,cAAc,EAAE,GAAG,SAAS,EACzC,YAAY,EAAE,sBAAsB,EAAE,GAAG,SAAS,EAClD,aAAa,EAAE,MAAM,GAAG,SAAS,UA+BlC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,iBAgEjD;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,iBAgB/C"}
@@ -1,108 +0,0 @@
1
- import {
2
- pushAcceptedIncomingCallCId$,
3
- pushAndroidBackgroundDeliveredIncomingCallCId$,
4
- pushRejectedIncomingCallCId$,
5
- pushTappedIncomingCallCId$,
6
- } from '../../utils/push/internal/rxSubjects';
7
- import { useEffect } from 'react';
8
- import { StreamVideoRN } from '../../utils';
9
- import {
10
- useConnectedUser,
11
- useStreamVideoClient,
12
- } from '@stream-io/video-react-bindings';
13
- import { BehaviorSubject } from 'rxjs';
14
- import { distinctUntilChanged, filter } from 'rxjs/operators';
15
- import { processCallFromPush } from '../../utils/push/internal/utils';
16
- import { StreamVideoClient, videoLoggerSystem } from '@stream-io/video-client';
17
- import type { StreamVideoConfig } from '../../utils/StreamVideoRN/types';
18
-
19
- /**
20
- * This hook is used to process the incoming call data via push notifications using the relevant rxjs subjects
21
- * It either joins or leaves the call based on the user's action.
22
- * Note: this effect cannot work when push notifications are received when the app is in quit state or in other words when the client is not connected with a websocket.
23
- * So we essentially run this effect only when the client is connected with a websocket.
24
- */
25
- export const useProcessPushCallEffect = () => {
26
- const client = useStreamVideoClient();
27
- const connectedUserId = useConnectedUser()?.id;
28
- // The Effect to join/reject call automatically when incoming call was received and processed from push notification
29
- useEffect(() => {
30
- const pushConfig = StreamVideoRN.getConfig().push;
31
- if (!pushConfig || !client || !connectedUserId) {
32
- return;
33
- }
34
-
35
- videoLoggerSystem
36
- .getLogger('useProcessPushCallEffect')
37
- .debug(
38
- `Adding subscriptions to process incoming call from push notification`,
39
- );
40
-
41
- // if the user accepts the call from push notification we join the call
42
- const acceptedCallSubscription = createCallSubscription(
43
- pushAcceptedIncomingCallCId$,
44
- client,
45
- pushConfig,
46
- 'accept',
47
- );
48
-
49
- // if the user rejects the call from push notification we leave the call
50
- const declinedCallSubscription = createCallSubscription(
51
- pushRejectedIncomingCallCId$,
52
- client,
53
- pushConfig,
54
- 'decline',
55
- );
56
-
57
- // if the user taps the call from push notification we do nothing as the only thing is to get the call which adds it to the client
58
- const pressedCallSubscription = createCallSubscription(
59
- pushTappedIncomingCallCId$,
60
- client,
61
- pushConfig,
62
- 'pressed',
63
- );
64
-
65
- const backgroundIncomingDeliveredCallSubscription = createCallSubscription(
66
- pushAndroidBackgroundDeliveredIncomingCallCId$,
67
- client,
68
- pushConfig,
69
- 'backgroundDelivered',
70
- );
71
-
72
- return () => {
73
- acceptedCallSubscription.unsubscribe();
74
- declinedCallSubscription.unsubscribe();
75
- pressedCallSubscription.unsubscribe();
76
- backgroundIncomingDeliveredCallSubscription.unsubscribe();
77
- };
78
- }, [client, connectedUserId]);
79
- };
80
-
81
- /**
82
- * A type guard to check if the cid is not undefined
83
- */
84
- function cidIsNotUndefined(cid: string | undefined): cid is string {
85
- return cid !== undefined;
86
- }
87
-
88
- /**
89
- * The common logic to create a subscription for the given call cid and action
90
- */
91
- const createCallSubscription = (
92
- behaviourSubjectWithCallCid: BehaviorSubject<string | undefined>,
93
- client: StreamVideoClient,
94
- pushConfig: NonNullable<StreamVideoConfig['push']>,
95
- action: 'accept' | 'decline' | 'pressed' | 'backgroundDelivered',
96
- ) => {
97
- return behaviourSubjectWithCallCid
98
- .pipe(distinctUntilChanged(), filter(cidIsNotUndefined))
99
- .subscribe(async (callCId) => {
100
- videoLoggerSystem
101
- .getLogger('useProcessPushCallEffect')
102
- .debug(
103
- `Processing call from push notification with action: ${action} and callCId: ${callCId}`,
104
- );
105
- await processCallFromPush(client, callCId, action, pushConfig);
106
- behaviourSubjectWithCallCid.next(undefined); // remove the current call id to avoid processing again
107
- });
108
- };