@stream-io/video-react-native-sdk 0.1.2 → 0.1.4

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 (111) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/commonjs/components/Call/CallControls/HangupCallButton.js +4 -6
  3. package/dist/commonjs/components/Call/CallControls/HangupCallButton.js.map +1 -1
  4. package/dist/commonjs/hooks/push/index.js +4 -0
  5. package/dist/commonjs/hooks/push/index.js.map +1 -1
  6. package/dist/commonjs/hooks/push/useInitAndroidTokenAndRest.js +8 -2
  7. package/dist/commonjs/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
  8. package/dist/commonjs/hooks/push/useIosInitRemoteNotifications.js +34 -0
  9. package/dist/commonjs/hooks/push/useIosInitRemoteNotifications.js.map +1 -0
  10. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +50 -4
  11. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  12. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js +50 -0
  13. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -0
  14. package/dist/commonjs/utils/StreamVideoRN/index.js +33 -0
  15. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  16. package/dist/commonjs/utils/internal/newNotificationCallbacks.js +18 -0
  17. package/dist/commonjs/utils/internal/newNotificationCallbacks.js.map +1 -0
  18. package/dist/commonjs/utils/internal/pushLogoutCallback.js +18 -0
  19. package/dist/commonjs/utils/internal/pushLogoutCallback.js.map +1 -0
  20. package/dist/commonjs/utils/push/android.js +182 -68
  21. package/dist/commonjs/utils/push/android.js.map +1 -1
  22. package/dist/commonjs/utils/push/ios.js +107 -1
  23. package/dist/commonjs/utils/push/ios.js.map +1 -1
  24. package/dist/commonjs/utils/push/libs.js +34 -1
  25. package/dist/commonjs/utils/push/libs.js.map +1 -1
  26. package/dist/commonjs/utils/push/rxSubjects.js +8 -1
  27. package/dist/commonjs/utils/push/rxSubjects.js.map +1 -1
  28. package/dist/commonjs/utils/push/utils.js +29 -1
  29. package/dist/commonjs/utils/push/utils.js.map +1 -1
  30. package/dist/commonjs/version.js +1 -1
  31. package/dist/module/components/Call/CallControls/HangupCallButton.js +3 -4
  32. package/dist/module/components/Call/CallControls/HangupCallButton.js.map +1 -1
  33. package/dist/module/hooks/push/index.js +4 -0
  34. package/dist/module/hooks/push/index.js.map +1 -1
  35. package/dist/module/hooks/push/useInitAndroidTokenAndRest.js +8 -2
  36. package/dist/module/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
  37. package/dist/module/hooks/push/useIosInitRemoteNotifications.js +28 -0
  38. package/dist/module/hooks/push/useIosInitRemoteNotifications.js.map +1 -0
  39. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +49 -4
  40. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  41. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js +44 -0
  42. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -0
  43. package/dist/module/utils/StreamVideoRN/index.js +32 -0
  44. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  45. package/dist/module/utils/internal/newNotificationCallbacks.js +10 -0
  46. package/dist/module/utils/internal/newNotificationCallbacks.js.map +1 -0
  47. package/dist/module/utils/internal/pushLogoutCallback.js +10 -0
  48. package/dist/module/utils/internal/pushLogoutCallback.js.map +1 -0
  49. package/dist/module/utils/push/android.js +184 -70
  50. package/dist/module/utils/push/android.js.map +1 -1
  51. package/dist/module/utils/push/ios.js +103 -1
  52. package/dist/module/utils/push/ios.js.map +1 -1
  53. package/dist/module/utils/push/libs.js +31 -1
  54. package/dist/module/utils/push/libs.js.map +1 -1
  55. package/dist/module/utils/push/rxSubjects.js +5 -0
  56. package/dist/module/utils/push/rxSubjects.js.map +1 -1
  57. package/dist/module/utils/push/utils.js +27 -0
  58. package/dist/module/utils/push/utils.js.map +1 -1
  59. package/dist/module/version.js +1 -1
  60. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  61. package/dist/typescript/hooks/push/useInitAndroidTokenAndRest.d.ts +1 -1
  62. package/dist/typescript/hooks/push/useInitAndroidTokenAndRest.d.ts.map +1 -1
  63. package/dist/typescript/hooks/push/useIosInitRemoteNotifications.d.ts +5 -0
  64. package/dist/typescript/hooks/push/useIosInitRemoteNotifications.d.ts.map +1 -0
  65. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  66. package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts +7 -0
  67. package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts.map +1 -0
  68. package/dist/typescript/utils/StreamVideoRN/index.d.ts +12 -0
  69. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  70. package/dist/typescript/utils/StreamVideoRN/types.d.ts +40 -6
  71. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  72. package/dist/typescript/utils/internal/newNotificationCallbacks.d.ts +10 -0
  73. package/dist/typescript/utils/internal/newNotificationCallbacks.d.ts.map +1 -0
  74. package/dist/typescript/utils/internal/pushLogoutCallback.d.ts +8 -0
  75. package/dist/typescript/utils/internal/pushLogoutCallback.d.ts.map +1 -0
  76. package/dist/typescript/utils/push/android.d.ts +1 -1
  77. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  78. package/dist/typescript/utils/push/ios.d.ts +4 -0
  79. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  80. package/dist/typescript/utils/push/libs.d.ts +6 -0
  81. package/dist/typescript/utils/push/libs.d.ts.map +1 -1
  82. package/dist/typescript/utils/push/rxSubjects.d.ts +9 -0
  83. package/dist/typescript/utils/push/rxSubjects.d.ts.map +1 -1
  84. package/dist/typescript/utils/push/utils.d.ts +9 -1
  85. package/dist/typescript/utils/push/utils.d.ts.map +1 -1
  86. package/dist/typescript/version.d.ts +1 -1
  87. package/expo-config-plugin/dist/index.d.ts +3 -2
  88. package/expo-config-plugin/dist/index.js +9 -5
  89. package/expo-config-plugin/dist/withPushAppDelegate.d.ts +4 -0
  90. package/expo-config-plugin/dist/withPushAppDelegate.js +119 -0
  91. package/expo-config-plugin/dist/withiOSInfoPlist.d.ts +2 -1
  92. package/expo-config-plugin/dist/withiOSInfoPlist.js +6 -1
  93. package/package.json +19 -3
  94. package/src/components/Call/CallControls/HangupCallButton.tsx +4 -4
  95. package/src/hooks/push/index.ts +4 -0
  96. package/src/hooks/push/useInitAndroidTokenAndRest.ts +8 -2
  97. package/src/hooks/push/useIosInitRemoteNotifications.ts +29 -0
  98. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +50 -3
  99. package/src/hooks/push/useProcessPushNonRingingCallEffect.ts +44 -0
  100. package/src/utils/StreamVideoRN/index.ts +36 -0
  101. package/src/utils/StreamVideoRN/types.ts +47 -6
  102. package/src/utils/internal/newNotificationCallbacks.ts +29 -0
  103. package/src/utils/internal/pushLogoutCallback.ts +17 -0
  104. package/src/utils/push/android.ts +203 -74
  105. package/src/utils/push/ios.ts +120 -1
  106. package/src/utils/push/libs.ts +48 -2
  107. package/src/utils/push/rxSubjects.ts +9 -0
  108. package/src/utils/push/utils.ts +35 -1
  109. package/src/version.ts +1 -1
  110. /package/expo-config-plugin/dist/{withAppDelegate.d.ts → withStreamVideoReactNativeSDKAppDelegate.d.ts} +0 -0
  111. /package/expo-config-plugin/dist/{withAppDelegate.js → withStreamVideoReactNativeSDKAppDelegate.js} +0 -0
@@ -1,8 +1,9 @@
1
1
  import notifee, { EventType } from '@notifee/react-native';
2
2
  import { Platform } from 'react-native';
3
- import { getFirebaseMessagingLib } from './libs';
4
- import { pushAcceptedIncomingCallCId$, pushRejectedIncomingCallCId$, pushTappedIncomingCallCId$ } from './rxSubjects';
3
+ import { getFirebaseMessagingLib, getExpoNotificationsLib, getExpoTaskManagerLib } from './libs';
4
+ import { pushAcceptedIncomingCallCId$, pushRejectedIncomingCallCId$, pushTappedIncomingCallCId$, pushNonRingingCallData$ } from './rxSubjects';
5
5
  import { processCallFromPushInBackground } from './utils';
6
+ import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
6
7
  const ACCEPT_CALL_ACTION_ID = 'accept';
7
8
  const DECLINE_CALL_ACTION_ID = 'decline';
8
9
  /** Setup Firebase push message handler **/
@@ -10,33 +11,96 @@ export function setupFirebaseHandlerAndroid(pushConfig) {
10
11
  if (Platform.OS !== 'android') {
11
12
  return;
12
13
  }
13
- const messaging = getFirebaseMessagingLib();
14
- messaging().setBackgroundMessageHandler(async msg => await firebaseMessagingOnMessageHandler(msg, pushConfig));
15
- // messaging().onMessage(firebaseMessagingOnMessageHandler); // this is to listen to foreground messages, which we dont need for now
14
+ if (pushConfig.isExpo) {
15
+ const Notifications = getExpoNotificationsLib();
16
+ const TaskManager = getExpoTaskManagerLib();
17
+ const BACKGROUND_NOTIFICATION_TASK = 'STREAM-VIDEO-SDK-INTERNAL-BACKGROUND-NOTIFICATION-TASK';
18
+ TaskManager.defineTask(BACKGROUND_NOTIFICATION_TASK, _ref => {
19
+ var _data$notification;
20
+ let {
21
+ data,
22
+ error
23
+ } = _ref;
24
+ if (error) {
25
+ return;
26
+ }
27
+ // @ts-ignore
28
+ const dataToProcess = (_data$notification = data.notification) === null || _data$notification === void 0 ? void 0 : _data$notification.data;
29
+ firebaseMessagingOnMessageHandler(dataToProcess, pushConfig);
30
+ });
31
+ // background handler
32
+ Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);
33
+ // foreground handler
34
+ Notifications.setNotificationHandler({
35
+ handleNotification: async notification => {
36
+ var _notification$request;
37
+ // @ts-ignore
38
+ const trigger = notification === null || notification === void 0 || (_notification$request = notification.request) === null || _notification$request === void 0 ? void 0 : _notification$request.trigger;
39
+ if (trigger.type === 'push') {
40
+ var _trigger$remoteMessag;
41
+ const data = trigger === null || trigger === void 0 || (_trigger$remoteMessag = trigger.remoteMessage) === null || _trigger$remoteMessag === void 0 ? void 0 : _trigger$remoteMessag.data;
42
+ if ((data === null || data === void 0 ? void 0 : data.sender) === 'stream.video') {
43
+ await firebaseMessagingOnMessageHandler(data, pushConfig);
44
+ return {
45
+ shouldShowAlert: false,
46
+ shouldPlaySound: false,
47
+ shouldSetBadge: false
48
+ };
49
+ }
50
+ }
51
+ return {
52
+ shouldShowAlert: true,
53
+ shouldPlaySound: false,
54
+ shouldSetBadge: false
55
+ };
56
+ }
57
+ });
58
+ } else {
59
+ const messaging = getFirebaseMessagingLib();
60
+ messaging().setBackgroundMessageHandler(async msg => await firebaseMessagingOnMessageHandler(msg.data, pushConfig));
61
+ messaging().onMessage(msg => firebaseMessagingOnMessageHandler(msg.data, pushConfig)); // this is to listen to foreground messages, which we dont need for now
62
+ }
63
+
16
64
  notifee.onBackgroundEvent(async event => {
17
- // NOTE: When app was opened from a quit state, we will never hit this when on accept event as app will open and the click event will go to foreground
18
65
  await onNotifeeEvent(event, pushConfig);
19
66
  });
20
67
  notifee.onForegroundEvent(event => {
21
- // NOTE: When app was opened from a quit state, we will never hit this when on accept event as app will open and go to foreground immediately
22
68
  onNotifeeEvent(event, pushConfig);
23
69
  });
24
70
  }
25
71
 
26
72
  /** Send token to stream, create notification channel, */
27
- export async function initAndroidPushToken(client, pushConfig) {
28
- if (Platform.OS !== 'android') {
73
+ export async function initAndroidPushToken(client, pushConfig, setUnsubscribeListener) {
74
+ if (Platform.OS !== 'android' || !pushConfig.android.pushProviderName) {
29
75
  return;
30
76
  }
31
- const messaging = getFirebaseMessagingLib();
32
- const token = await messaging().getToken();
33
- const push_provider_name = pushConfig.android.pushProviderName;
34
- await client.addDevice(token, 'firebase', push_provider_name);
35
- }
36
- const firebaseMessagingOnMessageHandler = async (message, pushConfig) => {
37
- if (Platform.OS !== 'android') {
38
- return;
77
+ const setDeviceToken = async token => {
78
+ setPushLogoutCallback(() => {
79
+ client.removeDevice(token).catch(err => {
80
+ console.warn('Failed to remove voip token from stream', err);
81
+ });
82
+ });
83
+ const push_provider_name = pushConfig.android.pushProviderName;
84
+ await client.addDevice(token, 'firebase', push_provider_name);
85
+ };
86
+ if (pushConfig.isExpo) {
87
+ const expoNotificationsLib = getExpoNotificationsLib();
88
+ const subscription = expoNotificationsLib.addPushTokenListener(devicePushToken => {
89
+ setDeviceToken(devicePushToken.data);
90
+ });
91
+ setUnsubscribeListener(() => subscription.remove());
92
+ const devicePushToken = await expoNotificationsLib.getDevicePushTokenAsync();
93
+ const token = devicePushToken.data;
94
+ await setDeviceToken(token);
95
+ } else {
96
+ const messaging = getFirebaseMessagingLib();
97
+ const unsubscribe = messaging().onTokenRefresh(refreshedToken => setDeviceToken(refreshedToken));
98
+ setUnsubscribeListener(unsubscribe);
99
+ const token = await messaging().getToken();
100
+ await setDeviceToken(token);
39
101
  }
102
+ }
103
+ const firebaseMessagingOnMessageHandler = async (data, pushConfig) => {
40
104
  /* Example data from firebase
41
105
  "message": {
42
106
  "data": {
@@ -52,46 +116,89 @@ const firebaseMessagingOnMessageHandler = async (message, pushConfig) => {
52
116
  // other stuff
53
117
  }
54
118
  */
55
- const data = message.data;
56
119
  if (!data || data.sender !== 'stream.video') {
57
120
  return;
58
121
  }
59
- await notifee.createChannel(pushConfig.android.incomingCallChannel);
60
- const {
61
- getTitle,
62
- getBody
63
- } = pushConfig.android.incomingCallNotificationTextGetters;
64
- const channelId = pushConfig.android.incomingCallChannel.id;
65
- const createdUserName = data.created_by_display_name;
66
- await notifee.displayNotification({
67
- title: getTitle(createdUserName),
68
- body: getBody(createdUserName),
69
- data,
70
- android: {
71
- channelId,
72
- pressAction: {
73
- id: 'default',
74
- launchActivity: 'default' // open the app when the notification is pressed
75
- },
76
-
77
- actions: [{
78
- title: 'Decline',
79
- pressAction: {
80
- id: DECLINE_CALL_ACTION_ID
81
- }
82
- }, {
83
- title: 'Accept',
122
+ if (data.type === 'call.ring') {
123
+ const incomingCallChannel = pushConfig.android.incomingCallChannel;
124
+ const incomingCallNotificationTextGetters = pushConfig.android.incomingCallNotificationTextGetters;
125
+ if (!incomingCallChannel || !incomingCallNotificationTextGetters) {
126
+ console.debug("Can't show incoming call notification as either or both incomingCallChannel and was not provided");
127
+ return;
128
+ }
129
+ await notifee.createChannel(incomingCallChannel);
130
+ const {
131
+ getTitle,
132
+ getBody
133
+ } = incomingCallNotificationTextGetters;
134
+ const createdUserName = data.created_by_display_name;
135
+ const channelId = incomingCallChannel.id;
136
+ await notifee.displayNotification({
137
+ title: getTitle(createdUserName),
138
+ body: getBody(createdUserName),
139
+ data,
140
+ android: {
141
+ channelId,
84
142
  pressAction: {
85
- id: ACCEPT_CALL_ACTION_ID,
143
+ id: 'default',
86
144
  launchActivity: 'default' // open the app when the notification is pressed
87
- }
88
- }],
145
+ },
146
+
147
+ actions: [{
148
+ title: 'Decline',
149
+ pressAction: {
150
+ id: DECLINE_CALL_ACTION_ID
151
+ }
152
+ }, {
153
+ title: 'Accept',
154
+ pressAction: {
155
+ id: ACCEPT_CALL_ACTION_ID,
156
+ launchActivity: 'default' // open the app when the notification is pressed
157
+ }
158
+ }],
89
159
 
90
- timeoutAfter: 60000 // 60 seconds, after which the notification will be dismissed automatically
160
+ timeoutAfter: 60000 // 60 seconds, after which the notification will be dismissed automatically
161
+ }
162
+ });
163
+ } else {
164
+ // the other types are call.live_started and call.notification
165
+ const callChannel = pushConfig.android.callChannel;
166
+ const callNotificationTextGetters = pushConfig.android.callNotificationTextGetters;
167
+ if (!callChannel || !callNotificationTextGetters) {
168
+ console.debug("Can't show call notification as either or both callChannel and callNotificationTextGetters is not provided");
169
+ return;
91
170
  }
92
- });
93
- };
171
+ await notifee.createChannel(callChannel);
172
+ const channelId = callChannel.id;
173
+ const {
174
+ getTitle,
175
+ getBody
176
+ } = callNotificationTextGetters;
177
+ const createdUserName = data.created_by_display_name;
178
+ // we can safely cast to string because the data is from "stream.video"
179
+ const type = data.type;
180
+ await notifee.displayNotification({
181
+ title: getTitle(type, createdUserName),
182
+ body: getBody(type, createdUserName),
183
+ data,
184
+ android: {
185
+ channelId,
186
+ pressAction: {
187
+ id: 'default',
188
+ launchActivity: 'default' // open the app when the notification is pressed
189
+ },
190
+
191
+ timeoutAfter: 60000 // 60 seconds, after which the notification will be dismissed automatically
192
+ }
193
+ });
94
194
 
195
+ const cid = data.call_cid;
196
+ pushNonRingingCallData$.next({
197
+ cid,
198
+ type
199
+ });
200
+ }
201
+ };
95
202
  const onNotifeeEvent = async (event, pushConfig) => {
96
203
  const {
97
204
  type,
@@ -109,29 +216,36 @@ const onNotifeeEvent = async (event, pushConfig) => {
109
216
 
110
217
  // we can safely cast to string because the data is from "stream.video"
111
218
  const call_cid = data.call_cid;
219
+ if (data.type === 'call.ring') {
220
+ // check if we have observers for the call cid (this means the app is in the foreground state)
221
+ const hasObservers = pushAcceptedIncomingCallCId$.observed && pushRejectedIncomingCallCId$.observed;
112
222
 
113
- // check if we have observers for the call cid (this means the app is in the foreground state)
114
- const hasObservers = pushAcceptedIncomingCallCId$.observed && pushRejectedIncomingCallCId$.observed;
115
-
116
- // Check if we need to decline the call
117
- const didPressDecline = type === EventType.ACTION_PRESS && pressAction.id === DECLINE_CALL_ACTION_ID;
118
- const didDismiss = type === EventType.DISMISSED;
119
- const mustDecline = didPressDecline || didDismiss;
120
- // Check if we need to accept the call
121
- const mustAccept = type === EventType.ACTION_PRESS && pressAction.id === ACCEPT_CALL_ACTION_ID;
122
- if (mustAccept) {
123
- pushAcceptedIncomingCallCId$.next(call_cid);
124
- // NOTE: accept will be handled by the app with rxjs observers as the app will go to foreground always
125
- } else if (mustDecline) {
126
- pushRejectedIncomingCallCId$.next(call_cid);
127
- if (hasObservers) {
128
- // if we had observers we can return here as the observers will handle the call as the app is in the foreground state
129
- return;
223
+ // Check if we need to decline the call
224
+ const didPressDecline = type === EventType.ACTION_PRESS && pressAction.id === DECLINE_CALL_ACTION_ID;
225
+ const didDismiss = type === EventType.DISMISSED;
226
+ const mustDecline = didPressDecline || didDismiss;
227
+ // Check if we need to accept the call
228
+ const mustAccept = type === EventType.ACTION_PRESS && pressAction.id === ACCEPT_CALL_ACTION_ID;
229
+ if (mustAccept) {
230
+ pushAcceptedIncomingCallCId$.next(call_cid);
231
+ // NOTE: accept will be handled by the app with rxjs observers as the app will go to foreground always
232
+ } else if (mustDecline) {
233
+ pushRejectedIncomingCallCId$.next(call_cid);
234
+ if (hasObservers) {
235
+ // if we had observers we can return here as the observers will handle the call as the app is in the foreground state
236
+ return;
237
+ }
238
+ await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
239
+ } else if (type === EventType.PRESS) {
240
+ pushTappedIncomingCallCId$.next(call_cid);
241
+ // pressed state will be handled by the app with rxjs observers as the app will go to foreground always
242
+ }
243
+ } else {
244
+ if (type === EventType.PRESS) {
245
+ var _pushConfig$onTapNonR;
246
+ pushTappedIncomingCallCId$.next(call_cid);
247
+ (_pushConfig$onTapNonR = pushConfig.onTapNonRingingCallNotification) === null || _pushConfig$onTapNonR === void 0 || _pushConfig$onTapNonR.call(pushConfig, call_cid, data.type);
130
248
  }
131
- await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
132
- } else if (type === EventType.PRESS) {
133
- pushTappedIncomingCallCId$.next(call_cid);
134
- // pressed state will be handled by the app with rxjs observers as the app will go to foreground always
135
249
  }
136
250
  };
137
251
  //# sourceMappingURL=android.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["notifee","EventType","Platform","getFirebaseMessagingLib","pushAcceptedIncomingCallCId$","pushRejectedIncomingCallCId$","pushTappedIncomingCallCId$","processCallFromPushInBackground","ACCEPT_CALL_ACTION_ID","DECLINE_CALL_ACTION_ID","setupFirebaseHandlerAndroid","pushConfig","OS","messaging","setBackgroundMessageHandler","msg","firebaseMessagingOnMessageHandler","onBackgroundEvent","event","onNotifeeEvent","onForegroundEvent","initAndroidPushToken","client","token","getToken","push_provider_name","android","pushProviderName","addDevice","message","data","sender","createChannel","incomingCallChannel","getTitle","getBody","incomingCallNotificationTextGetters","channelId","id","createdUserName","created_by_display_name","displayNotification","title","body","pressAction","launchActivity","actions","timeoutAfter","type","detail","notification","notificationId","call_cid","hasObservers","observed","didPressDecline","ACTION_PRESS","didDismiss","DISMISSED","mustDecline","mustAccept","next","PRESS"],"sourceRoot":"../../../../src","sources":["utils/push/android.ts"],"mappings":"AAAA,OAAOA,OAAO,IAAIC,SAAS,QAAe,uBAAuB;AAGjE,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,uBAAuB,QAAQ,QAAQ;AAChD,SACEC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,0BAA0B,QACrB,cAAc;AACrB,SAASC,+BAA+B,QAAQ,SAAS;AAEzD,MAAMC,qBAAqB,GAAG,QAAQ;AACtC,MAAMC,sBAAsB,GAAG,SAAS;AAIxC;AACA,OAAO,SAASC,2BAA2BA,CAACC,UAAsB,EAAE;EAClE,IAAIT,QAAQ,CAACU,EAAE,KAAK,SAAS,EAAE;IAC7B;EACF;EACA,MAAMC,SAAS,GAAGV,uBAAuB,CAAC,CAAC;EAC3CU,SAAS,CAAC,CAAC,CAACC,2BAA2B,CACrC,MAAOC,GAAG,IAAK,MAAMC,iCAAiC,CAACD,GAAG,EAAEJ,UAAU,CACxE,CAAC;EACD;EACAX,OAAO,CAACiB,iBAAiB,CAAC,MAAOC,KAAK,IAAK;IACzC;IACA,MAAMC,cAAc,CAACD,KAAK,EAAEP,UAAU,CAAC;EACzC,CAAC,CAAC;EACFX,OAAO,CAACoB,iBAAiB,CAAEF,KAAK,IAAK;IACnC;IACAC,cAAc,CAACD,KAAK,EAAEP,UAAU,CAAC;EACnC,CAAC,CAAC;AACJ;;AAEA;AACA,OAAO,eAAeU,oBAAoBA,CACxCC,MAAyB,EACzBX,UAAsB,EACtB;EACA,IAAIT,QAAQ,CAACU,EAAE,KAAK,SAAS,EAAE;IAC7B;EACF;EACA,MAAMC,SAAS,GAAGV,uBAAuB,CAAC,CAAC;EAC3C,MAAMoB,KAAK,GAAG,MAAMV,SAAS,CAAC,CAAC,CAACW,QAAQ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MAChB;MACA;IACF;IACA,MAAM9C,+BAA+B,CAACI,UAAU,EAAEyC,QAAQ,EAAE,SAAS,CAAC;EACxE,CAAC,MAAM,IAAIJ,IAAI,KAAK/C,SAAS,CAAC6D,KAAK,EAAE;IACnCxD,0BAA0B,CAACuD,IAAI,CAACT,QAAQ,CAAC;IACzC;EACF;AACF,CAAC"}
1
+ {"version":3,"names":["notifee","EventType","Platform","getFirebaseMessagingLib","getExpoNotificationsLib","getExpoTaskManagerLib","pushAcceptedIncomingCallCId$","pushRejectedIncomingCallCId$","pushTappedIncomingCallCId$","pushNonRingingCallData$","processCallFromPushInBackground","setPushLogoutCallback","ACCEPT_CALL_ACTION_ID","DECLINE_CALL_ACTION_ID","setupFirebaseHandlerAndroid","pushConfig","OS","isExpo","Notifications","TaskManager","BACKGROUND_NOTIFICATION_TASK","defineTask","_ref","_data$notification","data","error","dataToProcess","notification","firebaseMessagingOnMessageHandler","registerTaskAsync","setNotificationHandler","handleNotification","_notification$request","trigger","request","type","_trigger$remoteMessag","remoteMessage","sender","shouldShowAlert","shouldPlaySound","shouldSetBadge","messaging","setBackgroundMessageHandler","msg","onMessage","onBackgroundEvent","event","onNotifeeEvent","onForegroundEvent","initAndroidPushToken","client","setUnsubscribeListener","android","pushProviderName","setDeviceToken","token","removeDevice","catch","err","console","warn","push_provider_name","addDevice","expoNotificationsLib","subscription","addPushTokenListener","devicePushToken","remove","getDevicePushTokenAsync","unsubscribe","onTokenRefresh","refreshedToken","getToken","incomingCallChannel","incomingCallNotificationTextGetters","debug","createChannel","getTitle","getBody","createdUserName","created_by_display_name","channelId","id","displayNotification","title","body","pressAction","launchActivity","actions","timeoutAfter","callChannel","callNotificationTextGetters","cid","call_cid","next","detail","notificationId","hasObservers","observed","didPressDecline","ACTION_PRESS","didDismiss","DISMISSED","mustDecline","mustAccept","PRESS","_pushConfig$onTapNonR","onTapNonRingingCallNotification","call"],"sourceRoot":"../../../../src","sources":["utils/push/android.ts"],"mappings":"AAAA,OAAOA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I3D,IAAI,KAAKlC,SAAS,CAACyG,KAAK,EAAE;MACnClG,0BAA0B,CAACuF,IAAI,CAACD,QAAQ,CAAC;MACzC;IACF;EACF,CAAC,MAAM;IACL,IAAI3D,IAAI,KAAKlC,SAAS,CAACyG,KAAK,EAAE;MAAA,IAAAC,qBAAA;MAC5BnG,0BAA0B,CAACuF,IAAI,CAACD,QAAQ,CAAC;MACzC,CAAAa,qBAAA,GAAA5F,UAAU,CAAC6F,+BAA+B,cAAAD,qBAAA,eAA1CA,qBAAA,CAAAE,IAAA,CAAA9F,UAAU,EACR+E,QAAQ,EACRtE,IAAI,CAACW,IACP,CAAC;IACH;EACF;AACF,CAAC"}
@@ -1,5 +1,23 @@
1
- import { pushAcceptedIncomingCallCId$, voipPushNotificationCallCId$, voipCallkeepCallOnForegroundMap$, voipCallkeepAcceptedCallOnNativeDialerMap$ } from './rxSubjects';
1
+ import { Platform } from 'react-native';
2
+ import { pushAcceptedIncomingCallCId$, voipPushNotificationCallCId$, voipCallkeepCallOnForegroundMap$, voipCallkeepAcceptedCallOnNativeDialerMap$, pushNonRingingCallData$ } from './rxSubjects';
2
3
  import { processCallFromPushInBackground } from './utils';
4
+ import { getExpoNotificationsLib, getPushNotificationIosLib } from './libs';
5
+ import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
6
+ import notifee, { EventType } from '@notifee/react-native';
7
+ function processNonRingingNotificationStreamPayload(streamPayload) {
8
+ if ((streamPayload === null || streamPayload === void 0 ? void 0 : streamPayload.sender) === 'stream.video' && (streamPayload === null || streamPayload === void 0 ? void 0 : streamPayload.type) !== 'call.ring') {
9
+ const cid = streamPayload.call_cid;
10
+ const type = streamPayload.type;
11
+ pushNonRingingCallData$.next({
12
+ cid,
13
+ type
14
+ });
15
+ return {
16
+ cid,
17
+ type
18
+ };
19
+ }
20
+ }
3
21
  export const iosCallkeepAcceptCall = (call_cid, callUUIDFromCallkeep) => {
4
22
  if (!shouldProcessCallFromCallkeep(call_cid, callUUIDFromCallkeep)) {
5
23
  return;
@@ -35,4 +53,88 @@ const shouldProcessCallFromCallkeep = (call_cid, callUUIDFromCallkeep) => {
35
53
  }
36
54
  return true;
37
55
  };
56
+ export const setupRemoteNotificationsHandleriOS = pushConfig => {
57
+ if (Platform.OS !== 'ios') {
58
+ return;
59
+ }
60
+ notifee.onForegroundEvent(_ref => {
61
+ let {
62
+ type,
63
+ detail
64
+ } = _ref;
65
+ if (type === EventType.PRESS) {
66
+ var _detail$notification;
67
+ const streamPayload = (_detail$notification = detail.notification) === null || _detail$notification === void 0 || (_detail$notification = _detail$notification.data) === null || _detail$notification === void 0 ? void 0 : _detail$notification.stream;
68
+ const result = processNonRingingNotificationStreamPayload(streamPayload);
69
+ if (result) {
70
+ var _pushConfig$onTapNonR;
71
+ (_pushConfig$onTapNonR = pushConfig.onTapNonRingingCallNotification) === null || _pushConfig$onTapNonR === void 0 || _pushConfig$onTapNonR.call(pushConfig, result.cid, result.type);
72
+ }
73
+ }
74
+ });
75
+ if (pushConfig.isExpo) {
76
+ const Notifications = getExpoNotificationsLib();
77
+
78
+ // foreground handler (just to show the notifications on foreground)
79
+ Notifications.setNotificationHandler({
80
+ handleNotification: async () => {
81
+ return {
82
+ shouldShowAlert: true,
83
+ shouldPlaySound: true,
84
+ shouldSetBadge: false
85
+ };
86
+ }
87
+ });
88
+ }
89
+ };
90
+
91
+ /** Send token to stream */
92
+ export async function initIosNonVoipToken(client, pushConfig, setUnsubscribeListener) {
93
+ if (Platform.OS !== 'ios' || !pushConfig.android.pushProviderName) {
94
+ return;
95
+ }
96
+ const setDeviceToken = async token => {
97
+ setPushLogoutCallback(() => {
98
+ client.removeDevice(token).catch(err => {
99
+ console.warn('Failed to remove voip token from stream', err);
100
+ });
101
+ });
102
+ const push_provider_name = pushConfig.ios.pushProviderName;
103
+ await client.addDevice(token, 'apn', push_provider_name);
104
+ };
105
+ if (pushConfig.isExpo) {
106
+ const expoNotificationsLib = getExpoNotificationsLib();
107
+ const subscription = expoNotificationsLib.addPushTokenListener(devicePushToken => {
108
+ setDeviceToken(devicePushToken.data);
109
+ });
110
+ const subscriptionForReceive = expoNotificationsLib.addNotificationReceivedListener(event => {
111
+ // listen to foreground notifications
112
+ if (event.request.trigger.type === 'push') {
113
+ var _event$request$trigge;
114
+ const streamPayload = (_event$request$trigge = event.request.trigger.payload) === null || _event$request$trigge === void 0 ? void 0 : _event$request$trigge.stream;
115
+ processNonRingingNotificationStreamPayload(streamPayload);
116
+ }
117
+ });
118
+ setUnsubscribeListener(() => {
119
+ subscription.remove();
120
+ subscriptionForReceive.remove();
121
+ });
122
+ } else {
123
+ const pushNotificationIosLib = getPushNotificationIosLib();
124
+ pushNotificationIosLib.addEventListener('register', token => {
125
+ setDeviceToken(token);
126
+ });
127
+ pushNotificationIosLib.addEventListener('notification', notification => {
128
+ const data = notification.getData();
129
+ const streamPayload = data === null || data === void 0 ? void 0 : data.stream;
130
+ // listen to foreground notifications
131
+ processNonRingingNotificationStreamPayload(streamPayload);
132
+ notification.finish(pushNotificationIosLib.FetchResult.NoData);
133
+ });
134
+ setUnsubscribeListener(() => {
135
+ pushNotificationIosLib.removeEventListener('register');
136
+ pushNotificationIosLib.removeEventListener('notification');
137
+ });
138
+ }
139
+ }
38
140
  //# sourceMappingURL=ios.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pushAcceptedIncomingCallCId$","voipPushNotificationCallCId$","voipCallkeepCallOnForegroundMap$","voipCallkeepAcceptedCallOnNativeDialerMap$","processCallFromPushInBackground","iosCallkeepAcceptCall","call_cid","callUUIDFromCallkeep","shouldProcessCallFromCallkeep","next","uuid","cid","undefined","iosCallkeepRejectCall","pushConfig"],"sourceRoot":"../../../../src","sources":["utils/push/ios.ts"],"mappings":"AACA,SACEA,4BAA4B,EAC5BC,4BAA4B,EAC5BC,gCAAgC,EAChCC,0CAA0C,QACrC,cAAc;AACrB,SAASC,+BAA+B,QAAQ,SAAS;AAIzD,OAAO,MAAMC,qBAAqB,GAAGA,CACnCC,QAA4B,EAC5BC,oBAA4B,KACzB;EACH,IAAI,CAACC,6BAA6B,CAACF,QAAQ,EAAEC,oBAAoB,CAAC,EAAE;IAClE;EACF;EACA;EACAJ,0CAA0C,CAACM,IAAI,CAAC;IAC9CC,IAAI,EAAEH,oBAAoB;IAC1BI,GAAG,EAAEL;EACP,CAAC,CAAC;EACF;EACAN,4BAA4B,CAACS,IAAI,CAACH,QAAQ,CAAC;EAC3C;EACAJ,gCAAgC,CAACO,IAAI,CAACG,SAAS,CAAC;AAClD,CAAC;AAED,OAAO,MAAMC,qBAAqB,GAAG,MAAAA,CACnCP,QAA4B,EAC5BC,oBAA4B,EAC5BO,UAAsB,KACnB;EACH,IAAI,CAACN,6BAA6B,CAACF,QAAQ,EAAEC,oBAAoB,CAAC,EAAE;IAClE;EACF;EACA;EACAJ,0CAA0C,CAACM,IAAI,CAACG,SAAS,CAAC;EAC1DV,gCAAgC,CAACO,IAAI,CAACG,SAAS,CAAC;EAChDX,4BAA4B,CAACQ,IAAI,CAACG,SAAS,CAAC;EAC5C,MAAMR,+BAA+B,CAACU,UAAU,EAAER,QAAQ,EAAE,SAAS,CAAC;AACxE,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,6BAA6B,GAAGA,CACpCF,QAA4B,EAC5BC,oBAA4B,KACL;EACvB,IAAI,CAACD,QAAQ,IAAI,CAACC,oBAAoB,EAAE;IACtC,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb,CAAC"}
1
+ {"version":3,"names":["Platform","pushAcceptedIncomingCallCId$","voipPushNotificationCallCId$","voipCallkeepCallOnForegroundMap$","voipCallkeepAcceptedCallOnNativeDialerMap$","pushNonRingingCallData$","processCallFromPushInBackground","getExpoNotificationsLib","getPushNotificationIosLib","setPushLogoutCallback","notifee","EventType","processNonRingingNotificationStreamPayload","streamPayload","sender","type","cid","call_cid","next","iosCallkeepAcceptCall","callUUIDFromCallkeep","shouldProcessCallFromCallkeep","uuid","undefined","iosCallkeepRejectCall","pushConfig","setupRemoteNotificationsHandleriOS","OS","onForegroundEvent","_ref","detail","PRESS","_detail$notification","notification","data","stream","result","_pushConfig$onTapNonR","onTapNonRingingCallNotification","call","isExpo","Notifications","setNotificationHandler","handleNotification","shouldShowAlert","shouldPlaySound","shouldSetBadge","initIosNonVoipToken","client","setUnsubscribeListener","android","pushProviderName","setDeviceToken","token","removeDevice","catch","err","console","warn","push_provider_name","ios","addDevice","expoNotificationsLib","subscription","addPushTokenListener","devicePushToken","subscriptionForReceive","addNotificationReceivedListener","event","request","trigger","_event$request$trigge","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,SAASC,+BAA+B,QAAQ,SAAS;AACzD,SAASC,uBAAuB,EAAEC,yBAAyB,QAAQ,QAAQ;AAE3E,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,OAAOC,OAAO,IAAIC,SAAS,QAAQ,uBAAuB;AAY1D,SAASC,0CAA0CA,CACjDC,aAA4B,EAC5B;EACA,IACE,CAAAA,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEC,MAAM,MAAK,cAAc,IACxC,CAAAD,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEE,IAAI,MAAK,WAAW,EACnC;IACA,MAAMC,GAAG,GAAGH,aAAa,CAACI,QAAQ;IAClC,MAAMF,IAAI,GAAGF,aAAa,CAACE,IAAI;IAC/BV,uBAAuB,CAACa,IAAI,CAAC;MAAEF,GAAG;MAAED;IAAK,CAAC,CAAC;IAC3C,OAAO;MAAEC,GAAG;MAAED;IAAK,CAAC;EACtB;AACF;AAEA,OAAO,MAAMI,qBAAqB,GAAGA,CACnCF,QAA4B,EAC5BG,oBAA4B,KACzB;EACH,I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AM,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"}
@@ -1,6 +1,9 @@
1
1
  let callkeep;
2
2
  let messaging;
3
3
  let voipPushNotification;
4
+ let expoNotificationsLib;
5
+ let expoTaskManagerLib;
6
+ let pushNotificationIosLib;
4
7
  try {
5
8
  callkeep = require('react-native-callkeep').default;
6
9
  } catch (e) {}
@@ -10,6 +13,33 @@ try {
10
13
  try {
11
14
  voipPushNotification = require('react-native-voip-push-notification').default;
12
15
  } catch (e) {}
16
+ try {
17
+ expoNotificationsLib = require('expo-notifications');
18
+ } catch (e) {}
19
+ try {
20
+ expoTaskManagerLib = require('expo-task-manager');
21
+ } catch (e) {}
22
+ try {
23
+ pushNotificationIosLib = require('@react-native-community/push-notification-ios').default;
24
+ } catch (e) {}
25
+ export function getExpoNotificationsLib() {
26
+ if (!expoNotificationsLib) {
27
+ throw Error('expo-notifications library is not installed. Please see https://docs.expo.dev/versions/latest/sdk/notifications/ for installation instructions');
28
+ }
29
+ return expoNotificationsLib;
30
+ }
31
+ export function getExpoTaskManagerLib() {
32
+ if (!expoTaskManagerLib) {
33
+ throw Error('expo-task-manager library is not installed. Please see https://docs.expo.dev/versions/latest/sdk/task-manager/ for installation instructions');
34
+ }
35
+ return expoTaskManagerLib;
36
+ }
37
+ export function getPushNotificationIosLib() {
38
+ if (!pushNotificationIosLib) {
39
+ throw Error('@react-native-community/push-notification-ios library is not installed. Please install it using "yarn add @react-native-community/push-notification-ios" or "npm i @react-native-community/push-notification-ios --save"');
40
+ }
41
+ return pushNotificationIosLib;
42
+ }
13
43
  export function getCallKeepLib() {
14
44
  if (!callkeep) {
15
45
  throw Error('react-native-callkeep library is not installed. Please see https://github.com/react-native-webrtc/react-native-callkeep#Installation for installation instructions');
@@ -24,7 +54,7 @@ export function getFirebaseMessagingLib() {
24
54
  }
25
55
  export function getVoipPushNotificationLib() {
26
56
  if (!voipPushNotification) {
27
- throw Error("react-native-voip-push-notification library is not installed. Please install it using 'yarn add react-native-voip-push-notification' or 'npm install react-native-voip-push-notification'");
57
+ throw Error("react-native-voip-push-notification library is not installed. Please install it using 'yarn add react-native-voip-push-notification' or 'npm i react-native-voip-push-notification --save'");
28
58
  }
29
59
  return voipPushNotification;
30
60
  }
@@ -1 +1 @@
1
- {"version":3,"names":["callkeep","messaging","voipPushNotification","require","default","e","getCallKeepLib","Error","getFirebaseMessagingLib","getVoipPushNotificationLib"],"sourceRoot":"../../../../src","sources":["utils/push/libs.ts"],"mappings":"AAQA,IAAIA,QAAoC;AACxC,IAAIC,SAA4C;AAChD,IAAIC,oBAA0D;AAE9D,IAAI;EACFF,QAAQ,GAAGG,OAAO,CAAC,uBAAuB,CAAC,CAACC,OAAO;AACrD,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,IAAI;EACFJ,SAAS,GAAGE,OAAO,CAAC,kCAAkC,CAAC,CAACC,OAAO;AACjE,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,IAAI;EACFH,oBAAoB,GAAGC,OAAO,CAAC,qCAAqC,CAAC,CAACC,OAAO;AAC/E,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,IAAI,CAACN,QAAQ,EAAE;IACb,MAAMO,KAAK,CACT,oKACF,CAAC;EACH;EACA,OAAOP,QAAQ;AACjB;AAEA,OAAO,SAASQ,uBAAuBA,CAAA,EAAG;EACxC,IAAI,CAACP,SAAS,EAAE;IACd,MAAMM,KAAK,CACT,6IACF,CAAC;EACH;EACA,OAAON,SAAS;AAClB;AAEA,OAAO,SAASQ,0BAA0BA,CAAA,EAAG;EAC3C,IAAI,CAACP,oBAAoB,EAAE;IACzB,MAAMK,KAAK,CACT,2LACF,CAAC;EACH;EACA,OAAOL,oBAAoB;AAC7B"}
1
+ {"version":3,"names":["callkeep","messaging","voipPushNotification","expoNotificationsLib","expoTaskManagerLib","pushNotificationIosLib","require","default","e","getExpoNotificationsLib","Error","getExpoTaskManagerLib","getPushNotificationIosLib","getCallKeepLib","getFirebaseMessagingLib","getVoipPushNotificationLib"],"sourceRoot":"../../../../src","sources":["utils/push/libs.ts"],"mappings":"AAWA,IAAIA,QAAoC;AACxC,IAAIC,SAA4C;AAChD,IAAIC,oBAA0D;AAC9D,IAAIC,oBAAsD;AAC1D,IAAIC,kBAAkD;AACtD,IAAIC,sBAA0D;AAE9D,IAAI;EACFL,QAAQ,GAAGM,OAAO,CAAC,uBAAuB,CAAC,CAACC,OAAO;AACrD,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,IAAI;EACFP,SAAS,GAAGK,OAAO,CAAC,kCAAkC,CAAC,CAACC,OAAO;AACjE,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,IAAI;EACFN,oBAAoB,GAAGI,OAAO,CAAC,qCAAqC,CAAC,CAACC,OAAO;AAC/E,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,IAAI;EACFL,oBAAoB,GAAGG,OAAO,CAAC,oBAAoB,CAAC;AACtD,CAAC,CAAC,OAAOE,CAAC,EAAE,CAAC;AAEb,IAAI;EACFJ,kBAAkB,GAAGE,OAAO,CAAC,mBAAmB,CAAC;AACnD,CAAC,CAAC,OAAOE,CAAC,EAAE,CAAC;AAEb,IAAI;EACFH,sBAAsB,GACpBC,OAAO,CAAC,+CAA+C,CAAC,CAACC,OAAO;AACpE,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;AAEb,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACxC,IAAI,CAACN,oBAAoB,EAAE;IACzB,MAAMO,KAAK,CACT,gJACF,CAAC;EACH;EACA,OAAOP,oBAAoB;AAC7B;AAEA,OAAO,SAASQ,qBAAqBA,CAAA,EAAG;EACtC,IAAI,CAACP,kBAAkB,EAAE;IACvB,MAAMM,KAAK,CACT,8IACF,CAAC;EACH;EACA,OAAON,kBAAkB;AAC3B;AAEA,OAAO,SAASQ,yBAAyBA,CAAA,EAAG;EAC1C,IAAI,CAACP,sBAAsB,EAAE;IAC3B,MAAMK,KAAK,CACT,0NACF,CAAC;EACH;EACA,OAAOL,sBAAsB;AAC/B;AAEA,OAAO,SAASQ,cAAcA,CAAA,EAAG;EAC/B,IAAI,CAACb,QAAQ,EAAE;IACb,MAAMU,KAAK,CACT,oKACF,CAAC;EACH;EACA,OAAOV,QAAQ;AACjB;AAEA,OAAO,SAASc,uBAAuBA,CAAA,EAAG;EACxC,IAAI,CAACb,SAAS,EAAE;IACd,MAAMS,KAAK,CACT,6IACF,CAAC;EACH;EACA,OAAOT,SAAS;AAClB;AAEA,OAAO,SAASc,0BAA0BA,CAAA,EAAG;EAC3C,IAAI,CAACb,oBAAoB,EAAE;IACzB,MAAMQ,KAAK,CACT,4LACF,CAAC;EACH;EACA,OAAOR,oBAAoB;AAC7B"}
@@ -1,4 +1,9 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
+ /**
3
+ * This rxjs subject is used to store the call cid of the accepted incoming call from push notification
4
+ * Note: it is should be subscribed only when a user has connected to the websocket of Stream
5
+ */
6
+ export const pushNonRingingCallData$ = new BehaviorSubject(undefined);
2
7
 
3
8
  /**
4
9
  * This rxjs subject is used to store the call cid of the accepted incoming call from push notification
@@ -1 +1 @@
1
- {"version":3,"names":["BehaviorSubject","pushAcceptedIncomingCallCId$","undefined","pushTappedIncomingCallCId$","pushRejectedIncomingCallCId$","voipPushNotificationCallCId$","voipCallkeepCallOnForegroundMap$","voipCallkeepAcceptedCallOnNativeDialerMap$"],"sourceRoot":"../../../../src","sources":["utils/push/rxSubjects.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,MAAM;;AAEtC;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GAAG,IAAID,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAG,IAAIH,eAAe,CAE3DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAME,4BAA4B,GAAG,IAAIJ,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA,OAAO,MAAMG,4BAA4B,GAAG,IAAIL,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,gCAAgC,GAAG,IAAIN,eAAe,CAEjEE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA,OAAO,MAAMK,0CAA0C,GAAG,IAAIP,eAAe,CAE3EE,SAAS,CAAC"}
1
+ {"version":3,"names":["BehaviorSubject","pushNonRingingCallData$","undefined","pushAcceptedIncomingCallCId$","pushTappedIncomingCallCId$","pushRejectedIncomingCallCId$","voipPushNotificationCallCId$","voipCallkeepCallOnForegroundMap$","voipCallkeepAcceptedCallOnNativeDialerMap$"],"sourceRoot":"../../../../src","sources":["utils/push/rxSubjects.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,MAAM;AAGtC;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,IAAID,eAAe,CAExDE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GAAG,IAAIH,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAME,0BAA0B,GAAG,IAAIJ,eAAe,CAE3DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMG,4BAA4B,GAAG,IAAIL,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA,OAAO,MAAMI,4BAA4B,GAAG,IAAIN,eAAe,CAE7DE,SAAS,CAAC;;AAEZ;;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,gCAAgC,GAAG,IAAIP,eAAe,CAEjEE,SAAS,CAAC;;AAEZ;AACA;AACA;AACA,OAAO,MAAMM,0CAA0C,GAAG,IAAIR,eAAe,CAE3EE,SAAS,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { onNewCallNotification } from '../internal/newNotificationCallbacks';
1
2
  /* An action for the notification or callkeep and app does not have JS context setup yet, so we need to do two steps:
2
3
  1. we need to create a new client and connect the user to decline the call
3
4
  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
@@ -44,4 +45,30 @@ export const processCallFromPush = async (client, call_cid, action) => {
44
45
  console.log('failed to process call from push notification', e, action);
45
46
  }
46
47
  };
48
+
49
+ /**
50
+ * This function is used process the call from push notifications due to non ringing calls
51
+ * It does the following steps:
52
+ * 1. Get the call from the client if present or create a new call
53
+ * 2. Fetch the latest state of the call from the server if its not already in ringing state
54
+ * 3. Call all the callbacks to inform the app about the call
55
+ */
56
+ export const processNonIncomingCallFromPush = async (client, call_cid, nonRingingNotificationType) => {
57
+ let callFromPush;
58
+ try {
59
+ const _callFromPush = client.state.calls.find(c => c.cid === call_cid);
60
+ if (_callFromPush) {
61
+ callFromPush = _callFromPush;
62
+ } else {
63
+ // if not it means that WS is not alive when receiving the push notifications and we need to fetch the call
64
+ const [callType, callId] = call_cid.split(':');
65
+ callFromPush = client.call(callType, callId);
66
+ await callFromPush.get();
67
+ }
68
+ } catch (e) {
69
+ console.log('failed to fetch call from push notification', e);
70
+ return;
71
+ }
72
+ onNewCallNotification(callFromPush, nonRingingNotificationType);
73
+ };
47
74
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["processCallFromPushInBackground","pushConfig","call_cid","action","videoClient","createStreamVideoClient","e","console","log","processCallFromPush","client","callFromPush","onRingingCall","join","leave","reject"],"sourceRoot":"../../../../src","sources":["utils/push/utils.ts"],"mappings":"AAKA;AACA;AACA;AACA;AACA,OAAO,MAAMA,+BAA+B,GAAG,MAAAA,CAC7CC,UAAsB,EACtBC,QAAgB,EAChBC,MAAiD,KAC9C;EACH,IAAIC,WAA0C;EAE9C,IAAI;IACFA,WAAW,GAAG,MAAMH,UAAU,CAACI,uBAAuB,CAAC,CAAC;IACxD,IAAI,CAACD,WAAW,EAAE;MAChB;IACF;EACF,CAAC,CAAC,OAAOE,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,gDAAgD,EAAEF,CAAC,CAAC;IAChE;EACF;EACA,MAAMG,mBAAmB,CAACL,WAAW,EAAEF,QAAQ,EAAEC,MAAM,CAAC;AAC1D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,mBAAmB,GAAG,MAAAA,CACjCC,MAAyB,EACzBR,QAAgB,EAChBC,MAAwC,KACrC;EACH,IAAIQ,YAAkB;EACtB,IAAI;IACFA,YAAY,GAAG,MAAMD,MAAM,CAACE,aAAa,CAACV,QAAQ,CAAC;EACrD,CAAC,CAAC,OAAOI,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,6CAA6C,EAAEF,CAAC,CAAC;IAC7D;EACF;EACA;EACA,IAAI;IACF,IAAIH,MAAM,KAAK,QAAQ,EAAE;MACvB,MAAMQ,YAAY,CAACE,IAAI,CAAC,CAAC;IAC3B,CAAC,MAAM,IAAIV,MAAM,KAAK,SAAS,EAAE;MAC/B,MAAMQ,YAAY,CAACG,KAAK,CAAC;QAAEC,MAAM,EAAE;MAAK,CAAC,CAAC;IAC5C;EACF,CAAC,CAAC,OAAOT,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,+CAA+C,EAAEF,CAAC,EAAEH,MAAM,CAAC;EACzE;AACF,CAAC"}
1
+ {"version":3,"names":["onNewCallNotification","processCallFromPushInBackground","pushConfig","call_cid","action","videoClient","createStreamVideoClient","e","console","log","processCallFromPush","client","callFromPush","onRingingCall","join","leave","reject","processNonIncomingCallFromPush","nonRingingNotificationType","_callFromPush","state","calls","find","c","cid","callType","callId","split","call","get"],"sourceRoot":"../../../../src","sources":["utils/push/utils.ts"],"mappings":"AAKA,SAASA,qBAAqB,QAAQ,sCAAsC;AAI5E;AACA;AACA;AACA;AACA,OAAO,MAAMC,+BAA+B,GAAG,MAAAA,CAC7CC,UAAsB,EACtBC,QAAgB,EAChBC,MAAiD,KAC9C;EACH,IAAIC,WAA0C;EAE9C,IAAI;IACFA,WAAW,GAAG,MAAMH,UAAU,CAACI,uBAAuB,CAAC,CAAC;IACxD,IAAI,CAACD,WAAW,EAAE;MAChB;IACF;EACF,CAAC,CAAC,OAAOE,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,gDAAgD,EAAEF,CAAC,CAAC;IAChE;EACF;EACA,MAAMG,mBAAmB,CAACL,WAAW,EAAEF,QAAQ,EAAEC,MAAM,CAAC;AAC1D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,mBAAmB,GAAG,MAAAA,CACjCC,MAAyB,EACzBR,QAAgB,EAChBC,MAAwC,KACrC;EACH,IAAIQ,YAAkB;EACtB,IAAI;IACFA,YAAY,GAAG,MAAMD,MAAM,CAACE,aAAa,CAACV,QAAQ,CAAC;EACrD,CAAC,CAAC,OAAOI,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,6CAA6C,EAAEF,CAAC,CAAC;IAC7D;EACF;EACA;EACA,IAAI;IACF,IAAIH,MAAM,KAAK,QAAQ,EAAE;MACvB,MAAMQ,YAAY,CAACE,IAAI,CAAC,CAAC;IAC3B,CAAC,MAAM,IAAIV,MAAM,KAAK,SAAS,EAAE;MAC/B,MAAMQ,YAAY,CAACG,KAAK,CAAC;QAAEC,MAAM,EAAE;MAAK,CAAC,CAAC;IAC5C;EACF,CAAC,CAAC,OAAOT,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,+CAA+C,EAAEF,CAAC,EAAEH,MAAM,CAAC;EACzE;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMa,8BAA8B,GAAG,MAAAA,CAC5CN,MAAyB,EACzBR,QAAgB,EAChBe,0BAA+C,KAC5C;EACH,IAAIN,YAAkB;EACtB,IAAI;IACF,MAAMO,aAAa,GAAGR,MAAM,CAACS,KAAK,CAACC,KAAK,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKrB,QAAQ,CAAC;IACxE,IAAIgB,aAAa,EAAE;MACjBP,YAAY,GAAGO,aAAa;IAC9B,CAAC,MAAM;MACL;MACA,MAAM,CAACM,QAAQ,EAAEC,MAAM,CAAC,GAAGvB,QAAQ,CAACwB,KAAK,CAAC,GAAG,CAAC;MAC9Cf,YAAY,GAAGD,MAAM,CAACiB,IAAI,CAACH,QAAQ,EAAEC,MAAM,CAAC;MAC5C,MAAMd,YAAY,CAACiB,GAAG,CAAC,CAAC;IAC1B;EACF,CAAC,CAAC,OAAOtB,CAAC,EAAE;IACVC,OAAO,CAACC,GAAG,CAAC,6CAA6C,EAAEF,CAAC,CAAC;IAC7D;EACF;EACAP,qBAAqB,CAACY,YAAY,EAAEM,0BAA0B,CAAC;AACjE,CAAC"}
@@ -1,2 +1,2 @@
1
- export const version = '0.1.2';
1
+ export const version = '0.1.4';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YAKjC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/index.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YAOjC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This hook is used to initialize the push token for Android and ask notification permissions.
2
+ * This hook is used to initialize the push token for Android.
3
3
  */
4
4
  export declare const useInitAndroidTokenAndRest: () => void;
5
5
  //# sourceMappingURL=useInitAndroidTokenAndRest.d.ts.map