@stream-io/video-react-native-sdk 1.2.14 → 1.3.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 (127) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/commonjs/hooks/push/useIosCallKeepEventsSetupEffect.js +43 -6
  3. package/dist/commonjs/hooks/push/useIosCallKeepEventsSetupEffect.js.map +1 -1
  4. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +1 -1
  5. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +2 -2
  6. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +2 -7
  7. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -1
  8. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js +3 -3
  9. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +1 -0
  10. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  11. package/dist/commonjs/providers/StreamCall.js +1 -1
  12. package/dist/commonjs/utils/StreamVideoRN/index.js +5 -6
  13. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  14. package/dist/commonjs/utils/index.js +12 -0
  15. package/dist/commonjs/utils/index.js.map +1 -1
  16. package/dist/commonjs/utils/push/android.js +23 -79
  17. package/dist/commonjs/utils/push/android.js.map +1 -1
  18. package/dist/commonjs/utils/push/index.js +39 -0
  19. package/dist/commonjs/utils/push/index.js.map +1 -0
  20. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -0
  21. package/dist/commonjs/utils/push/internal/utils.js +157 -0
  22. package/dist/commonjs/utils/push/internal/utils.js.map +1 -0
  23. package/dist/commonjs/utils/push/ios.js +43 -84
  24. package/dist/commonjs/utils/push/ios.js.map +1 -1
  25. package/dist/commonjs/utils/push/libs/expoNotifications.js.map +1 -1
  26. package/dist/commonjs/utils/push/libs/index.js +0 -11
  27. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  28. package/dist/commonjs/utils/push/libs/iosPushNotification.js.map +1 -1
  29. package/dist/commonjs/utils/push/utils.js +29 -150
  30. package/dist/commonjs/utils/push/utils.js.map +1 -1
  31. package/dist/commonjs/version.js +1 -1
  32. package/dist/commonjs/version.js.map +1 -1
  33. package/dist/module/hooks/push/useIosCallKeepEventsSetupEffect.js +41 -4
  34. package/dist/module/hooks/push/useIosCallKeepEventsSetupEffect.js.map +1 -1
  35. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +1 -1
  36. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -1
  37. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +2 -2
  38. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  39. package/dist/module/hooks/push/useProcessPushCallEffect.js +2 -7
  40. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -1
  41. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js +3 -3
  42. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -1
  43. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +1 -0
  44. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  45. package/dist/module/providers/StreamCall.js +1 -1
  46. package/dist/module/providers/StreamCall.js.map +1 -1
  47. package/dist/module/utils/StreamVideoRN/index.js +5 -6
  48. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  49. package/dist/module/utils/index.js +1 -0
  50. package/dist/module/utils/index.js.map +1 -1
  51. package/dist/module/utils/push/android.js +20 -79
  52. package/dist/module/utils/push/android.js.map +1 -1
  53. package/dist/module/utils/push/index.js +4 -0
  54. package/dist/module/utils/push/index.js.map +1 -0
  55. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -0
  56. package/dist/module/utils/push/internal/utils.js +146 -0
  57. package/dist/module/utils/push/internal/utils.js.map +1 -0
  58. package/dist/module/utils/push/ios.js +40 -81
  59. package/dist/module/utils/push/ios.js.map +1 -1
  60. package/dist/module/utils/push/libs/expoNotifications.js.map +1 -1
  61. package/dist/module/utils/push/libs/index.js +0 -1
  62. package/dist/module/utils/push/libs/index.js.map +1 -1
  63. package/dist/module/utils/push/libs/iosPushNotification.js.map +1 -1
  64. package/dist/module/utils/push/utils.js +25 -144
  65. package/dist/module/utils/push/utils.js.map +1 -1
  66. package/dist/module/version.js +1 -1
  67. package/dist/module/version.js.map +1 -1
  68. package/dist/typescript/hooks/push/useIosCallKeepEventsSetupEffect.d.ts.map +1 -1
  69. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  70. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  71. package/dist/typescript/utils/StreamVideoRN/types.d.ts +6 -4
  72. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  73. package/dist/typescript/utils/index.d.ts +1 -0
  74. package/dist/typescript/utils/index.d.ts.map +1 -1
  75. package/dist/typescript/utils/push/android.d.ts +12 -2
  76. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  77. package/dist/typescript/utils/push/index.d.ts +4 -0
  78. package/dist/typescript/utils/push/index.d.ts.map +1 -0
  79. package/dist/typescript/utils/push/{rxSubjects.d.ts → internal/rxSubjects.d.ts} +1 -1
  80. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -0
  81. package/dist/typescript/utils/push/internal/utils.d.ts +43 -0
  82. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -0
  83. package/dist/typescript/utils/push/ios.d.ts +8 -3
  84. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  85. package/dist/typescript/utils/push/libs/expoNotifications.d.ts +2 -0
  86. package/dist/typescript/utils/push/libs/expoNotifications.d.ts.map +1 -1
  87. package/dist/typescript/utils/push/libs/index.d.ts +0 -1
  88. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  89. package/dist/typescript/utils/push/libs/iosPushNotification.d.ts +2 -0
  90. package/dist/typescript/utils/push/libs/iosPushNotification.d.ts.map +1 -1
  91. package/dist/typescript/utils/push/utils.d.ts +14 -42
  92. package/dist/typescript/utils/push/utils.d.ts.map +1 -1
  93. package/dist/typescript/version.d.ts +1 -1
  94. package/dist/typescript/version.d.ts.map +1 -1
  95. package/package.json +6 -11
  96. package/src/hooks/push/useIosCallKeepEventsSetupEffect.ts +62 -6
  97. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +1 -1
  98. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +2 -2
  99. package/src/hooks/push/useProcessPushCallEffect.ts +2 -7
  100. package/src/hooks/push/useProcessPushNonRingingCallEffect.ts +3 -3
  101. package/src/hooks/useAndroidKeepCallAliveEffect.ts +1 -0
  102. package/src/providers/StreamCall.tsx +1 -1
  103. package/src/utils/StreamVideoRN/index.ts +11 -6
  104. package/src/utils/StreamVideoRN/types.ts +6 -4
  105. package/src/utils/index.ts +1 -0
  106. package/src/utils/push/android.ts +28 -99
  107. package/src/utils/push/index.ts +3 -0
  108. package/src/utils/push/{rxSubjects.ts → internal/rxSubjects.ts} +1 -1
  109. package/src/utils/push/internal/utils.ts +178 -0
  110. package/src/utils/push/ios.ts +49 -115
  111. package/src/utils/push/libs/expoNotifications.ts +4 -0
  112. package/src/utils/push/libs/index.ts +0 -1
  113. package/src/utils/push/libs/iosPushNotification.ts +4 -0
  114. package/src/utils/push/utils.ts +44 -175
  115. package/src/version.ts +1 -1
  116. package/dist/commonjs/utils/push/libs/expoTaskManager.js +0 -17
  117. package/dist/commonjs/utils/push/libs/expoTaskManager.js.map +0 -1
  118. package/dist/commonjs/utils/push/rxSubjects.js.map +0 -1
  119. package/dist/module/utils/push/libs/expoTaskManager.js +0 -11
  120. package/dist/module/utils/push/libs/expoTaskManager.js.map +0 -1
  121. package/dist/module/utils/push/rxSubjects.js.map +0 -1
  122. package/dist/typescript/utils/push/libs/expoTaskManager.d.ts +0 -3
  123. package/dist/typescript/utils/push/libs/expoTaskManager.d.ts.map +0 -1
  124. package/dist/typescript/utils/push/rxSubjects.d.ts.map +0 -1
  125. package/src/utils/push/libs/expoTaskManager.ts +0 -16
  126. /package/dist/commonjs/utils/push/{rxSubjects.js → internal/rxSubjects.js} +0 -0
  127. /package/dist/module/utils/push/{rxSubjects.js → internal/rxSubjects.js} +0 -0
@@ -0,0 +1,146 @@
1
+ import { RxUtils, getLogger } from '@stream-io/video-client';
2
+ import { onNewCallNotification } from '../../internal/newNotificationCallbacks';
3
+ import { pushUnsubscriptionCallbacks$ } from './rxSubjects';
4
+ /**
5
+ * This function is used to check if the call should be ended based on the push notification
6
+ * Useful for callkeep management to end the call if necessary (with reportEndCallWithUUID)
7
+ */
8
+ 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
+ const callSession = callFromPush.state.session;
18
+ const rejected_by = callSession?.rejected_by;
19
+ const accepted_by = callSession?.accepted_by;
20
+ let mustEndCall = false;
21
+ let callkeepReason = 0;
22
+ if (created_by_id && rejected_by) {
23
+ if (rejected_by[created_by_id]) {
24
+ // call was cancelled by the caller
25
+ mustEndCall = true;
26
+ callkeepReason = 2;
27
+ }
28
+ } else if (receiver_id && rejected_by) {
29
+ if (rejected_by[receiver_id]) {
30
+ // call was rejected by the receiver in some other device
31
+ mustEndCall = true;
32
+ callkeepReason = 5;
33
+ }
34
+ } else if (receiver_id && accepted_by) {
35
+ if (accepted_by[receiver_id]) {
36
+ // call was accepted by the receiver in some other device
37
+ mustEndCall = true;
38
+ callkeepReason = 4;
39
+ }
40
+ }
41
+ return {
42
+ mustEndCall,
43
+ callkeepReason
44
+ };
45
+ };
46
+
47
+ /* An action for the notification or callkeep and app does not have JS context setup yet, so we need to do two steps:
48
+ 1. we need to create a new client and connect the user to decline the call
49
+ 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
50
+ */
51
+ export const processCallFromPushInBackground = async (pushConfig, call_cid, action) => {
52
+ let videoClient;
53
+ try {
54
+ videoClient = await pushConfig.createStreamVideoClient();
55
+ if (!videoClient) {
56
+ return;
57
+ }
58
+ } catch (e) {
59
+ const logger = getLogger(['processCallFromPushInBackground']);
60
+ logger('error', 'failed to create video client', e);
61
+ return;
62
+ }
63
+ await processCallFromPush(videoClient, call_cid, action, pushConfig);
64
+ };
65
+
66
+ /**
67
+ * This function is used process the call from push notifications due to incoming call
68
+ * It does the following steps:
69
+ * 1. Get the call from the client if present or create a new call
70
+ * 2. Fetch the latest state of the call from the server if its not already in ringing state
71
+ * 3. Join or leave the call based on the user's action.
72
+ */
73
+ export const processCallFromPush = async (client, call_cid, action, pushConfig) => {
74
+ let callFromPush;
75
+ try {
76
+ callFromPush = await client.onRingingCall(call_cid);
77
+ } catch (e) {
78
+ const logger = getLogger(['processCallFromPush']);
79
+ logger('error', 'failed to fetch call from push notification', e);
80
+ return;
81
+ }
82
+ // note: when action was pressed or delivered, we dont need to do anything as the only thing is to do is to get the call which adds it to the client
83
+ try {
84
+ if (action === 'accept') {
85
+ if (pushConfig.publishOptions) {
86
+ callFromPush.updatePublishOptions(pushConfig.publishOptions);
87
+ }
88
+ await callFromPush.join();
89
+ } else if (action === 'decline') {
90
+ await callFromPush.leave({
91
+ reject: true
92
+ });
93
+ }
94
+ } catch (e) {
95
+ const logger = getLogger(['processCallFromPush']);
96
+ logger('error', `failed to process ${action} call from push notification`, e);
97
+ }
98
+ };
99
+
100
+ /**
101
+ * This function is used process the call from push notifications due to non ringing calls
102
+ * It does the following steps:
103
+ * 1. Get the call from the client if present or create a new call
104
+ * 2. Fetch the latest state of the call from the server
105
+ * 3. Call all the callbacks to inform the app about the call
106
+ */
107
+ export const processNonIncomingCallFromPush = async (client, call_cid, nonRingingNotificationType) => {
108
+ let callFromPush;
109
+ try {
110
+ const _callFromPush = client.state.calls.find(c => c.cid === call_cid);
111
+ if (_callFromPush) {
112
+ callFromPush = _callFromPush;
113
+ } else {
114
+ // if not it means that WS is not alive when receiving the push notifications and we need to fetch the call
115
+ const [callType, callId] = call_cid.split(':');
116
+ callFromPush = client.call(callType, callId);
117
+ await callFromPush.get();
118
+ }
119
+ } catch (e) {
120
+ const logger = getLogger(['processNonIncomingCallFromPush']);
121
+ logger('error', 'failed to fetch call from push notification', e);
122
+ return;
123
+ }
124
+ onNewCallNotification(callFromPush, nonRingingNotificationType);
125
+ };
126
+
127
+ /**
128
+ * This function is used to clear all the push related WS subscriptions
129
+ * note: events are subscribed in push for accept/decline through WS
130
+ */
131
+ export const clearPushWSEventSubscriptions = () => {
132
+ const unsubscriptionCallbacks = RxUtils.getCurrentValue(pushUnsubscriptionCallbacks$);
133
+ if (unsubscriptionCallbacks) {
134
+ unsubscriptionCallbacks.forEach(cb => cb());
135
+ }
136
+ pushUnsubscriptionCallbacks$.next(undefined);
137
+ };
138
+
139
+ /**
140
+ * This ref is used to check if the push WS subscriptions can be added
141
+ * It is used to avoid adding the push WS subscriptions when the client is connected to WS in the foreground
142
+ */
143
+ export const canAddPushWSSubscriptionsRef = {
144
+ current: true
145
+ };
146
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RxUtils","getLogger","onNewCallNotification","pushUnsubscriptionCallbacks$","shouldCallBeEnded","callFromPush","created_by_id","receiver_id","callSession","state","session","rejected_by","accepted_by","mustEndCall","callkeepReason","processCallFromPushInBackground","pushConfig","call_cid","action","videoClient","createStreamVideoClient","e","logger","processCallFromPush","client","onRingingCall","publishOptions","updatePublishOptions","join","leave","reject","processNonIncomingCallFromPush","nonRingingNotificationType","_callFromPush","calls","find","c","cid","callType","callId","split","call","get","clearPushWSEventSubscriptions","unsubscriptionCallbacks","getCurrentValue","forEach","cb","next","undefined","canAddPushWSSubscriptionsRef","current"],"sourceRoot":"../../../../../src","sources":["utils/push/internal/utils.ts"],"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platform } from 'react-native';
2
- import { pushAcceptedIncomingCallCId$, voipPushNotificationCallCId$, voipCallkeepCallOnForegroundMap$, voipCallkeepAcceptedCallOnNativeDialerMap$, pushNonRingingCallData$ } from './rxSubjects';
3
- import { clearPushWSEventSubscriptions, processCallFromPushInBackground } from './utils';
4
- import { getExpoNotificationsLib, getNotifeeLibThrowIfNotInstalledForPush, getPushNotificationIosLib } from './libs';
2
+ import { pushNonRingingCallData$ } from './internal/rxSubjects';
3
+ import { getExpoNotificationsLib, getPushNotificationIosLib } from './libs';
5
4
  import { getLogger } from '@stream-io/video-client';
6
5
  import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
6
+ import { EventType } from '@notifee/react-native';
7
+ import { StreamVideoRN } from '../StreamVideoRN';
7
8
  let lastApnToken = {
8
9
  token: '',
9
10
  userId: ''
@@ -22,75 +23,49 @@ function processNonRingingNotificationStreamPayload(streamPayload) {
22
23
  };
23
24
  }
24
25
  }
25
- export const iosCallkeepAcceptCall = (call_cid, callUUIDFromCallkeep) => {
26
- if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
27
- return;
28
- }
29
- clearPushWSEventSubscriptions();
30
- // to call end callkeep later if ended in app and not through callkeep
31
- voipCallkeepAcceptedCallOnNativeDialerMap$.next({
32
- uuid: callUUIDFromCallkeep,
33
- cid: call_cid
34
- });
35
- // to process the call in the app
36
- pushAcceptedIncomingCallCId$.next(call_cid);
37
- // no need to keep these references anymore
38
- voipCallkeepCallOnForegroundMap$.next(undefined);
39
- };
40
- export const iosCallkeepRejectCall = async (call_cid, callUUIDFromCallkeep, pushConfig) => {
41
- if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
42
- return;
43
- }
44
- clearPushWSEventSubscriptions();
45
- // no need to keep these references anymore
46
- voipCallkeepAcceptedCallOnNativeDialerMap$.next(undefined);
47
- voipCallkeepCallOnForegroundMap$.next(undefined);
48
- voipPushNotificationCallCId$.next(undefined);
49
- await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
50
- };
51
-
52
- /**
53
- * Helper function to determine if the answer/end call event from callkeep must be processed
54
- * Just checks if we have a valid call_cid and acts as a type guard for call_cid
55
- */
56
- const shouldProcessCallFromCallkeep = (call_cid, callUUIDFromCallkeep) => {
57
- if (!call_cid || !callUUIDFromCallkeep) {
58
- return false;
26
+ export const oniOSExpoNotificationEvent = event => {
27
+ const pushConfig = StreamVideoRN.getConfig().push;
28
+ if (pushConfig) {
29
+ if (event.request.trigger.type === 'push') {
30
+ const streamPayload = event.request.trigger.payload?.stream;
31
+ processNonRingingNotificationStreamPayload(streamPayload);
32
+ }
59
33
  }
60
- return true;
61
34
  };
62
- export const setupRemoteNotificationsHandleriOS = pushConfig => {
63
- if (Platform.OS !== 'ios') {
64
- return;
65
- }
66
- const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
67
- notifeeLib.default.onForegroundEvent(({
35
+ export const oniOSNotifeeEvent = ({
36
+ event
37
+ }) => {
38
+ if (Platform.OS !== 'ios') return;
39
+ const pushConfig = StreamVideoRN.getConfig().push;
40
+ const {
68
41
  type,
69
42
  detail
70
- }) => {
71
- if (type === notifeeLib.EventType.PRESS) {
72
- const streamPayload = detail.notification?.data?.stream;
73
- const result = processNonRingingNotificationStreamPayload(streamPayload);
74
- if (result) {
75
- pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
76
- }
43
+ } = event;
44
+ if (pushConfig && type === EventType.PRESS) {
45
+ const streamPayload = detail.notification?.data?.stream;
46
+ const result = processNonRingingNotificationStreamPayload(streamPayload);
47
+ if (result) {
48
+ pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
77
49
  }
78
- });
79
- if (pushConfig.isExpo) {
80
- const Notifications = getExpoNotificationsLib();
81
-
82
- // foreground handler (just to show the notifications on foreground)
83
- Notifications.setNotificationHandler({
84
- handleNotification: async () => {
85
- return {
86
- shouldShowAlert: true,
87
- shouldPlaySound: true,
88
- shouldSetBadge: false
89
- };
90
- }
91
- });
92
50
  }
93
51
  };
52
+ export function onPushNotificationiOSStreamVideoEvent(notification) {
53
+ const pushNotificationIosLib = getPushNotificationIosLib();
54
+ const data = notification.getData();
55
+ const streamPayload = data?.stream;
56
+ const isClicked = data.userInteraction === 1;
57
+ const pushConfig = StreamVideoRN.getConfig().push;
58
+ if (!streamPayload || !isClicked || !pushConfig) {
59
+ notification.finish(pushNotificationIosLib.FetchResult.NoData);
60
+ return;
61
+ }
62
+ // listen to foreground notifications
63
+ const result = processNonRingingNotificationStreamPayload(streamPayload);
64
+ if (result) {
65
+ pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
66
+ }
67
+ notification.finish(pushNotificationIosLib.FetchResult.NoData);
68
+ }
94
69
 
95
70
  /** Send token to stream */
96
71
  export async function initIosNonVoipToken(client, pushConfig, setUnsubscribeListener) {
@@ -129,32 +104,16 @@ export async function initIosNonVoipToken(client, pushConfig, setUnsubscribeList
129
104
  const subscription = expoNotificationsLib.addPushTokenListener(devicePushToken => {
130
105
  setDeviceToken(devicePushToken.data);
131
106
  });
132
- const subscriptionForReceive = expoNotificationsLib.addNotificationReceivedListener(event => {
133
- // listen to foreground notifications
134
- if (event.request.trigger.type === 'push') {
135
- const streamPayload = event.request.trigger.payload?.stream;
136
- processNonRingingNotificationStreamPayload(streamPayload);
137
- }
138
- });
139
107
  setUnsubscribeListener(() => {
140
108
  subscription.remove();
141
- subscriptionForReceive.remove();
142
109
  });
143
110
  } else {
144
111
  const pushNotificationIosLib = getPushNotificationIosLib();
145
112
  pushNotificationIosLib.addEventListener('register', token => {
146
113
  setDeviceToken(token);
147
114
  });
148
- pushNotificationIosLib.addEventListener('notification', notification => {
149
- const data = notification.getData();
150
- const streamPayload = data?.stream;
151
- // listen to foreground notifications
152
- processNonRingingNotificationStreamPayload(streamPayload);
153
- notification.finish(pushNotificationIosLib.FetchResult.NoData);
154
- });
155
115
  setUnsubscribeListener(() => {
156
116
  pushNotificationIosLib.removeEventListener('register');
157
- pushNotificationIosLib.removeEventListener('notification');
158
117
  });
159
118
  }
160
119
  }
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","pushAcceptedIncomingCallCId$","voipPushNotificationCallCId$","voipCallkeepCallOnForegroundMap$","voipCallkeepAcceptedCallOnNativeDialerMap$","pushNonRingingCallData$","clearPushWSEventSubscriptions","processCallFromPushInBackground","getExpoNotificationsLib","getNotifeeLibThrowIfNotInstalledForPush","getPushNotificationIosLib","getLogger","setPushLogoutCallback","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","next","iosCallkeepAcceptCall","callUUIDFromCallkeep","shouldProcessCallFromCallkeep","uuid","undefined","iosCallkeepRejectCall","pushConfig","setupRemoteNotificationsHandleriOS","OS","notifeeLib","default","onForegroundEvent","detail","EventType","PRESS","notification","data","stream","result","onTapNonRingingCallNotification","isExpo","Notifications","setNotificationHandler","handleNotification","shouldShowAlert","shouldPlaySound","shouldSetBadge","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","logger","push_provider_name","addDevice","expoNotificationsLib","getDevicePushTokenAsync","then","devicePushToken","subscription","addPushTokenListener","subscriptionForReceive","addNotificationReceivedListener","event","request","trigger","payload","remove","pushNotificationIosLib","addEventListener","getData","finish","FetchResult","NoData","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAKvC,SACEC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,gCAAgC,EAChCC,0CAA0C,EAC1CC,uBAAuB,QAClB,cAAc;AACrB,SACEC,6BAA6B,EAC7BC,+BAA+B,QAC1B,SAAS;AAChB,SACEC,uBAAuB,EACvBC,uCAAuC,EACvCC,yBAAyB,QACpB,QAAQ;AACf,SAA4BC,SAAS,QAAQ,yBAAyB;AACtE,SAASC,qBAAqB,QAAQ,gCAAgC;AAYtE,IAAIC,YAAY,GAAG;EAAEC,KAAK,EAAE,EAA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B,GAC1BN,oBAAoB,CAACO,+BAA+B,CAAEC,KAAK,IAAK;MAC9D;MACA,IAAIA,KAAK,CAACC,OAAO,CAACC,OAAO,CAACvD,IAAI,KAAK,MAAM,EAAE;QACzC,MAAMF,aAAa,GAAGuD,KAAK,CAACC,OAAO,CAACC,OAAO,CAACC,OAAO,EAC/CnC,MAAuB;QAC3BxB,0CAA0C,CAACC,aAAa,CAAC;MAC3D;IACF,CAAC,CAAC;IACJmC,sBAAsB,CAAC,MAAM;MAC3BgB,YAAY,CAACQ,MAAM,CAAC,CAAC;MACrBN,sBAAsB,CAACM,MAAM,CAAC,CAAC;IACjC,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,MAAMC,sBAAsB,GAAGnE,yBAAyB,CAAC,CAAC;IAC1DmE,sBAAsB,CAACC,gBAAgB,CAAC,UAAU,EAAGhE,KAAK,IAAK;MAC7DyC,cAAc,CAACzC,KAAK,CAAC;IACvB,CAAC,CAAC;IACF+D,sBAAsB,CAACC,gBAAgB,CAAC,cAAc,EAAGxC,YAAY,IAAK;MACxE,MAAMC,IAAI,GAAGD,YAAY,CAACyC,OAAO,CAAC,CAAC;MACnC,MAAM9D,aAAa,GAAGsB,IAAI,EAAEC,MAAuB;MACnD;MACAxB,0CAA0C,CAACC,aAAa,CAAC;MACzDqB,YAAY,CAAC0C,MAAM,CAACH,sBAAsB,CAACI,WAAW,CAACC,MAAM,CAAC;IAChE,CAAC,CAAC;IACF9B,sBAAsB,CAAC,MAAM;MAC3ByB,sBAAsB,CAACM,mBAAmB,CAAC,UAAU,CAAC;MACtDN,sBAAsB,CAACM,mBAAmB,CAAC,cAAc,CAAC;IAC5D,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Platform","pushNonRingingCallData$","getExpoNotificationsLib","getPushNotificationIosLib","getLogger","setPushLogoutCallback","EventType","StreamVideoRN","lastApnToken","token","userId","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","next","oniOSExpoNotificationEvent","event","pushConfig","getConfig","push","request","trigger","payload","stream","oniOSNotifeeEvent","OS","detail","PRESS","notification","data","result","onTapNonRingingCallNotification","onPushNotificationiOSStreamVideoEvent","pushNotificationIosLib","getData","isClicked","userInteraction","finish","FetchResult","NoData","initIosNonVoipToken","client","setUnsubscribeListener","ios","pushProviderName","setDeviceToken","streamClient","_user","id","removeDevice","err","logger","push_provider_name","addDevice","isExpo","expoNotificationsLib","getDevicePushTokenAsync","then","devicePushToken","subscription","addPushTokenListener","remove","addEventListener","removeEventListener"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAEEC,uBAAuB,EACvBC,yBAAyB,QAEpB,QAAQ;AACf,SAA4BC,SAAS,QAAQ,yBAAyB;AACtE,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,SAAS,QAAe,uBAAuB;AACxD,SAASC,aAAa,QAAQ,kBAAkB;AAKhD,IAAIC,YAAY,GAAG;EAAEC,KAAK,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAE5C,SAASC,0CAA0CA,CACjDC,aAAgC,EAChC;EACA,IACEA,aAAa,EAAEC,MAAM,KAAK,cAAc,IACxCD,aAAa,EAAEE,IAAI,KAAK,WAAW,EACnC;IACA,MAAMC,GAAG,GAAGH,aAAa,CAACI,QAAQ;IAClC,MAAMF,IAAI,GAAGF,aAAa,CAACE,IAAI;IAC/Bb,uBAAuB,CAACgB,IAAI,CAAC;MAAEF,GAAG;MAAED;IAAK,CAAC,CAAC;IAC3C,OAAO;MAAEC,GAAG;MAAED;IAAK,CAAC;EACtB;AACF;AAEA,OAAO,MAAMI,0BAA0B,GAAIC,KAAuB,IAAK;EACrE,MAAMC,UAAU,GAAGb,aAAa,CAACc,SAAS,CAAC,CAAC,CAACC,IAAI;EACjD,IAAIF,UAAU,EAAE;IACd,IAAID,KAAK,CA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Y,SAAS,CAAC/C,KAAK,EAAE,KAAK,EAAE8C,kBAAkB,CAAC;EAC1D,CAAC;EACD,IAAInC,UAAU,CAACqC,MAAM,EAAE;IACrB,MAAMC,oBAAoB,GAAGxD,uBAAuB,CAAC,CAAC;IACtDwD,oBAAoB,CAACC,uBAAuB,CAAC,CAAC,CAACC,IAAI,CAAEC,eAAe,IAAK;MACvEb,cAAc,CAACa,eAAe,CAAC7B,IAAI,CAAC;IACtC,CAAC,CAAC;IACF,MAAM8B,YAAY,GAAGJ,oBAAoB,CAACK,oBAAoB,CAC3DF,eAAe,IAAK;MACnBb,cAAc,CAACa,eAAe,CAAC7B,IAAI,CAAC;IACtC,CACF,CAAC;IACDa,sBAAsB,CAAC,MAAM;MAC3BiB,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,MAAM5B,sBAAsB,GAAGjC,yBAAyB,CAAC,CAAC;IAC1DiC,sBAAsB,CAAC6B,gBAAgB,CAAC,UAAU,EAAGxD,KAAK,IAAK;MAC7DuC,cAAc,CAACvC,KAAK,CAAC;IACvB,CAAC,CAAC;IACFoC,sBAAsB,CAAC,MAAM;MAC3BT,sBAAsB,CAAC8B,mBAAmB,CAAC,UAAU,CAAC;IACxD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["expoNotificationsLib","require","_e","getExpoNotificationsLib","Error"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/expoNotifications.ts"],"mappings":"AAEA,IAAIA,oBAAsD;AAE1D,IAAI;EACFA,oBAAoB,GAAGC,OAAO,CAAC,oBAAoB,CAAC;AACtD,CAAC,CAAC,OAAOC,EAAE,EAAE,CAAC;AAEd,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACxC,IAAI,CAACH,oBAAoB,EAAE;IACzB,MAAMI,KAAK,CACT,gJACF,CAAC;EACH;EACA,OAAOJ,oBAAoB;AAC7B","ignoreList":[]}
1
+ {"version":3,"names":["expoNotificationsLib","require","_e","getExpoNotificationsLib","Error"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/expoNotifications.ts"],"mappings":"AAMA,IAAIA,oBAAsD;AAE1D,IAAI;EACFA,oBAAoB,GAAGC,OAAO,CAAC,oBAAoB,CAAC;AACtD,CAAC,CAAC,OAAOC,EAAE,EAAE,CAAC;AAEd,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACxC,IAAI,CAACH,oBAAoB,EAAE;IACzB,MAAMI,KAAK,CACT,gJACF,CAAC;EACH;EACA,OAAOJ,oBAAoB;AAC7B","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  export * from './expoNotifications';
2
- export * from './expoTaskManager';
3
2
  export * from './firebaseMessaging';
4
3
  export * from './iosPushNotification';
5
4
  export * from './voipPushNotification';
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/push/libs/index.ts"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,WAAW;;AAEzB;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["utils/push/libs/index.ts"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,WAAW;;AAEzB;AACA;AACA;AACA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["pushNotificationIosLib","require","default","_e","getPushNotificationIosLib","Error"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/iosPushNotification.ts"],"mappings":"AAGA,IAAIA,sBAA0D;AAE9D,IAAI;EACFA,sBAAsB,GACpBC,OAAO,CAAC,+CAA+C,CAAC,CAACC,OAAO;AACpE,CAAC,CAAC,OAAOC,EAAE,EAAE,CAAC;AAEd,OAAO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,IAAI,CAACJ,sBAAsB,EAAE;IAC3B,MAAMK,KAAK,CACT,0NACF,CAAC;EACH;EACA,OAAOL,sBAAsB;AAC/B","ignoreList":[]}
1
+ {"version":3,"names":["pushNotificationIosLib","require","default","_e","getPushNotificationIosLib","Error"],"sourceRoot":"../../../../../src","sources":["utils/push/libs/iosPushNotification.ts"],"mappings":"AAGA,IAAIA,sBAA0D;AAM9D,IAAI;EACFA,sBAAsB,GACpBC,OAAO,CAAC,+CAA+C,CAAC,CAACC,OAAO;AACpE,CAAC,CAAC,OAAOC,EAAE,EAAE,CAAC;AAEd,OAAO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,IAAI,CAACJ,sBAAsB,EAAE;IAC3B,MAAMK,KAAK,CACT,0NACF,CAAC;EACH;EACA,OAAOL,sBAAsB;AAC/B","ignoreList":[]}
@@ -1,146 +1,27 @@
1
- import { getLogger, RxUtils } from '@stream-io/video-client';
2
- import { onNewCallNotification } from '../internal/newNotificationCallbacks';
3
- import { pushUnsubscriptionCallbacks$ } from './rxSubjects';
4
- /**
5
- * This function is used to check if the call should be ended based on the push notification
6
- * Useful for callkeep management to end the call if necessary (with reportEndCallWithUUID)
7
- */
8
- 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
- const callSession = callFromPush.state.session;
18
- const rejected_by = callSession?.rejected_by;
19
- const accepted_by = callSession?.accepted_by;
20
- let mustEndCall = false;
21
- let callkeepReason = 0;
22
- if (created_by_id && rejected_by) {
23
- if (rejected_by[created_by_id]) {
24
- // call was cancelled by the caller
25
- mustEndCall = true;
26
- callkeepReason = 2;
27
- }
28
- } else if (receiver_id && rejected_by) {
29
- if (rejected_by[receiver_id]) {
30
- // call was rejected by the receiver in some other device
31
- mustEndCall = true;
32
- callkeepReason = 5;
33
- }
34
- } else if (receiver_id && accepted_by) {
35
- if (accepted_by[receiver_id]) {
36
- // call was accepted by the receiver in some other device
37
- mustEndCall = true;
38
- callkeepReason = 4;
39
- }
1
+ export function isFirebaseStreamVideoMessage(message) {
2
+ return message.data?.sender === 'stream.video';
3
+ }
4
+ export function isNotifeeStreamVideoEvent(event) {
5
+ const {
6
+ detail
7
+ } = event;
8
+ const {
9
+ notification
10
+ } = detail;
11
+ return notification?.data?.sender === 'stream.video';
12
+ }
13
+ export function isExpoNotificationStreamVideoEvent(event) {
14
+ if (event.request.trigger.type === 'push') {
15
+ // iOS
16
+ const streamPayload = event.request.trigger.payload?.stream;
17
+ // Android
18
+ const remoteMessageData = event.request.trigger.remoteMessage?.data;
19
+ return streamPayload?.sender === 'stream.video' || remoteMessageData?.sender === 'stream.video';
40
20
  }
41
- return {
42
- mustEndCall,
43
- callkeepReason
44
- };
45
- };
46
-
47
- /* An action for the notification or callkeep and app does not have JS context setup yet, so we need to do two steps:
48
- 1. we need to create a new client and connect the user to decline the call
49
- 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
50
- */
51
- export const processCallFromPushInBackground = async (pushConfig, call_cid, action) => {
52
- let videoClient;
53
- try {
54
- videoClient = await pushConfig.createStreamVideoClient();
55
- if (!videoClient) {
56
- return;
57
- }
58
- } catch (e) {
59
- const logger = getLogger(['processCallFromPushInBackground']);
60
- logger('error', 'failed to create video client', e);
61
- return;
62
- }
63
- await processCallFromPush(videoClient, call_cid, action, pushConfig);
64
- };
65
-
66
- /**
67
- * This function is used process the call from push notifications due to incoming call
68
- * It does the following steps:
69
- * 1. Get the call from the client if present or create a new call
70
- * 2. Fetch the latest state of the call from the server if its not already in ringing state
71
- * 3. Join or leave the call based on the user's action.
72
- */
73
- export const processCallFromPush = async (client, call_cid, action, pushConfig) => {
74
- let callFromPush;
75
- try {
76
- callFromPush = await client.onRingingCall(call_cid);
77
- } catch (e) {
78
- const logger = getLogger(['processCallFromPush']);
79
- logger('error', 'failed to fetch call from push notification', e);
80
- return;
81
- }
82
- // note: when action was pressed or delivered, we dont need to do anything as the only thing is to do is to get the call which adds it to the client
83
- try {
84
- if (action === 'accept') {
85
- if (pushConfig.publishOptions) {
86
- callFromPush.updatePublishOptions(pushConfig.publishOptions);
87
- }
88
- await callFromPush.join();
89
- } else if (action === 'decline') {
90
- await callFromPush.leave({
91
- reject: true
92
- });
93
- }
94
- } catch (e) {
95
- const logger = getLogger(['processCallFromPush']);
96
- logger('error', `failed to process ${action} call from push notification`, e);
97
- }
98
- };
99
-
100
- /**
101
- * This function is used process the call from push notifications due to non ringing calls
102
- * It does the following steps:
103
- * 1. Get the call from the client if present or create a new call
104
- * 2. Fetch the latest state of the call from the server if its not already in ringing state
105
- * 3. Call all the callbacks to inform the app about the call
106
- */
107
- export const processNonIncomingCallFromPush = async (client, call_cid, nonRingingNotificationType) => {
108
- let callFromPush;
109
- try {
110
- const _callFromPush = client.state.calls.find(c => c.cid === call_cid);
111
- if (_callFromPush) {
112
- callFromPush = _callFromPush;
113
- } else {
114
- // if not it means that WS is not alive when receiving the push notifications and we need to fetch the call
115
- const [callType, callId] = call_cid.split(':');
116
- callFromPush = client.call(callType, callId);
117
- await callFromPush.get();
118
- }
119
- } catch (e) {
120
- const logger = getLogger(['processNonIncomingCallFromPush']);
121
- logger('error', 'failed to fetch call from push notification', e);
122
- return;
123
- }
124
- onNewCallNotification(callFromPush, nonRingingNotificationType);
125
- };
126
-
127
- /**
128
- * This function is used to clear all the push related WS subscriptions
129
- * note: events are subscribed in push for accept/decline through WS
130
- */
131
- export const clearPushWSEventSubscriptions = () => {
132
- const unsubscriptionCallbacks = RxUtils.getCurrentValue(pushUnsubscriptionCallbacks$);
133
- if (unsubscriptionCallbacks) {
134
- unsubscriptionCallbacks.forEach(cb => cb());
135
- }
136
- pushUnsubscriptionCallbacks$.next(undefined);
137
- };
138
-
139
- /**
140
- * This ref is used to check if the push WS subscriptions can be added
141
- * It is used to avoid adding the push WS subscriptions when the client is connected to WS in the foreground
142
- */
143
- export const canAddPushWSSubscriptionsRef = {
144
- current: true
145
- };
21
+ }
22
+ export function isPushNotificationiOSStreamVideoEvent(notification) {
23
+ const data = notification.getData();
24
+ const streamPayload = data?.stream;
25
+ return streamPayload?.sender === 'stream.video';
26
+ }
146
27
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getLogger","RxUtils","onNewCallNotification","pushUnsubscriptionCallbacks$","shouldCallBeEnded","callFromPush","created_by_id","receiver_id","callSession","state","session","rejected_by","accepted_by","mustEndCall","callkeepReason","processCallFromPushInBackground","pushConfig","call_cid","action","videoClient","createStreamVideoClient","e","logger","processCallFromPush","client","onRingingCall","publishOptions","updatePublishOptions","join","leave","reject","processNonIncomingCallFromPush","nonRingingNotificationType","_callFromPush","calls","find","c","cid","callType","callId","split","call","get","clearPushWSEventSubscriptions","unsubscriptionCallbacks","getCurrentValue","forEach","cb","next","undefined","canAddPushWSSubscriptionsRef","current"],"sourceRoot":"../../../../src","sources":["utils/push/utils.ts"],"mappings":"AAAA,SAEEA,SAAS,EACTC,OAAO,QAEF,yBAAyB;AAKhC,SAASC,qBAAqB,QAAQ,sCAAsC;AAC5E,SAASC,4BAA4B,QAAQ,cAAc;AAM3D;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAC/BC,YAAkB,EAClBC,aAAiC,EACjCC,WAA+B,KAC5B;EACH;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,WAAW,GAAGH,YAAY,CAACI,KAAK,CAACC,OAAO;EAC9C,MAAMC,WAAW,GAAGH,WAAW,EAAEG,WAAW;EAC5C,MAAMC,WAAW,GAAGJ,WAAW,EAAEI,WAAW;EAC5C,IAAIC,WAAW,GAAG,KAAK;EACvB,IAAIC,cAAc,GAAG,CAAC;EACtB,IAAIR,aAAa,IAAIK,WAAW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E,MAAMlC,YAAY,CAACqC,GAAG,CAAC,CAAC;IAC1B;EACF,CAAC,CAAC,OAAOrB,CAAC,EAAE;IACV,MAAMC,MAAM,GAAGtB,SAAS,CAAC,CAAC,gCAAgC,CAAC,CAAC;IAC5DsB,MAAM,CAAC,OAAO,EAAE,6CAA6C,EAAED,CAAC,CAAC;IACjE;EACF;EACAnB,qBAAqB,CAACG,YAAY,EAAE2B,0BAA0B,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMW,6BAA6B,GAAGA,CAAA,KAAM;EACjD,MAAMC,uBAAuB,GAAG3C,OAAO,CAAC4C,eAAe,CACrD1C,4BACF,CAAC;EACD,IAAIyC,uBAAuB,EAAE;IAC3BA,uBAAuB,CAACE,OAAO,CAAEC,EAAE,IAAKA,EAAE,CAAC,CAAC,CAAC;EAC/C;EACA5C,4BAA4B,CAAC6C,IAAI,CAACC,SAAS,CAAC;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA0D,GAAG;EACxEC,OAAO,EAAE;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isFirebaseStreamVideoMessage","message","data","sender","isNotifeeStreamVideoEvent","event","detail","notification","isExpoNotificationStreamVideoEvent","request","trigger","type","streamPayload","payload","stream","remoteMessageData","remoteMessage","isPushNotificationiOSStreamVideoEvent","getData"],"sourceRoot":"../../../../src","sources":["utils/push/utils.ts"],"mappings":"AAcA,OAAO,SAASA,4BAA4BA,CAC1CC,OAA6C,EAC7C;EACA,OAAOA,OAAO,CAACC,IAAI,EAAEC,MAAM,KAAK,cAAc;AAChD;AAEA,OAAO,SAASC,yBAAyBA,CAACC,KAAY,EAAE;EACtD,MAAM;IAAEC;EAAO,CAAC,GAAGD,KAAK;EACxB,MAAM;IAAEE;EAAa,CAAC,GAAGD,MAAM;EAC/B,OAAOC,YAAY,EAAEL,IAAI,EAAEC,MAAM,KAAK,cAAc;AACtD;AAEA,OAAO,SAASK,kCAAkCA,CAACH,KAAuB,EAAE;EAC1E,IAAIA,KAAK,CAACI,OAAO,CAACC,OAAO,CAACC,IAAI,KAAK,MAAM,EAAE;IACzC;IACA,MAAMC,aAAa,GAAGP,KAAK,CAACI,OAAO,CAACC,OAAO,CAACG,OAAO,EAC/CC,MAA2B;IAC/B;IACA,MAAMC,iBAAiB,GAAGV,KAAK,CAACI,OAAO,CAACC,OAAO,CAACM,aAAa,EAAEd,IAAI;IACnE,OACEU,aAAa,EAAET,MAAM,KAAK,cAAc,IACxCY,iBAAiB,EAAEZ,MAAM,KAAK,cAAc;EAEhD;AACF;AAEA,OAAO,SAASc,qCAAqCA,CACnDV,YAAqC,EACrC;EACA,MAAML,IAAI,GAAGK,YAAY,CAACW,OAAO,CAAC,CAAC;EACnC,MAAMN,aAAa,GAAGV,IAAI,EAAEY,MAA2B;EACvD,OAAOF,aAAa,EAAET,MAAM,KAAK,cAAc;AACjD","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export const version = '1.2.14';
1
+ export const version = '1.3.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,OAAO","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useIosCallKeepEventsSetupEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useIosCallKeepEventsSetupEffect.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,eAAO,MAAM,+BAA+B,YA8C3C,CAAC"}
1
+ {"version":3,"file":"useIosCallKeepEventsSetupEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useIosCallKeepEventsSetupEffect.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,eAAO,MAAM,+BAA+B,YA8C3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAndroidKeepCallAliveEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":"AA0DA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAgFzC,CAAC"}
1
+ {"version":3,"file":"useAndroidKeepCallAliveEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAndroidKeepCallAliveEffect.ts"],"names":[],"mappings":"AA2DA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAgFzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAiC,EAC/B,2BAA2B,EAC5B,MAAM,sCAAsC,CAAC;AAa9C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,MAAM,CAA+B;IAEpD;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAO1E,MAAM,CAAC,gCAAgC,CACrC,aAAa,EAAE,OAAO,CACpB,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CACzE;IAWH;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAYvE,MAAM,CAAC,SAAS;IAIhB;;;OAGG;IACH,MAAM,CAAC,YAAY;IASnB;;;;OAIG;IACH,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,2BAA2B;CAYxC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAiC,EAC/B,2BAA2B,EAC5B,MAAM,sCAAsC,CAAC;AAa9C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,MAAM,CAA+B;IAEpD;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAO1E,MAAM,CAAC,gCAAgC,CACrC,aAAa,EAAE,OAAO,CACpB,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CACzE;IAWH;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAmBvE,MAAM,CAAC,SAAS;IAIhB;;;OAGG;IACH,MAAM,CAAC,YAAY;IASnB;;;;OAIG;IACH,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,2BAA2B;CAYxC"}
@@ -102,10 +102,12 @@ export type StreamVideoConfig = {
102
102
  * }
103
103
  */
104
104
  createStreamVideoClient: () => Promise<StreamVideoClient | undefined>;
105
- /** The callback that is called when a call is accepted, used for navigation */
106
- navigateAcceptCall: () => void;
107
- /** The callback that is called when a push notification is tapped but user did not press accept or decline, used for navigation */
108
- navigateToIncomingCall: () => void;
105
+ /** @deprecated This method will be removed in the future. Please watch for incoming and outgoing calls in the root component of your app.
106
+ Please see https://getstream.io/video/docs/react-native/advanced/ringing-calls/#watch-for-incoming-and-outgoing-calls for more information */
107
+ navigateAcceptCall?: () => void;
108
+ /** @deprecated This method will be removed in the future. Please watch for incoming and outgoing calls in the root component of your app.
109
+ Please see https://getstream.io/video/docs/react-native/advanced/ringing-calls/#watch-for-incoming-and-outgoing-calls for more information */
110
+ navigateToIncomingCall?: () => void;
109
111
  /** Callback that is called when a non ringing push notification was tapped */
110
112
  onTapNonRingingCallNotification?: (call_cid: string, type: NonRingingPushEvent) => void;
111
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;WAIG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,GAAG,EAAE;YACH;;;;eAIG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;SAC3B,CAAC;QACF,OAAO,EAAE;YACP;;;;eAIG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B;;;;;;;;;eASG;YACH,WAAW,CAAC,EAAE,cAAc,CAAC;YAC7B;;;;;;;;;eASG;YACH,mBAAmB,CAAC,EAAE,cAAc,CAAC;YACrC;;;;;;;eAOG;YACH,mCAAmC,CAAC,EAAE;gBACpC,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;gBAC9C,OAAO,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;aAC9C,CAAC;YACF;;;;;;;;;;;;;eAaG;YACH,2BAA2B,CAAC,EAAE;gBAC5B,QAAQ,EAAE,CACR,IAAI,EAAE,mBAAmB,EACzB,eAAe,EAAE,MAAM,KACpB,MAAM,CAAC;gBACZ,OAAO,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;aACzE,CAAC;SACH,CAAC;QACF;;;;;;;;;;;;;;;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