@stream-io/video-react-native-sdk 0.7.3 → 0.7.5

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 (78) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/commonjs/components/Call/CallControls/ToggleAudioPreviewButton.js +4 -4
  3. package/dist/commonjs/components/Call/CallControls/ToggleAudioPreviewButton.js.map +1 -1
  4. package/dist/commonjs/components/Call/CallControls/ToggleAudioPublishingButton.js +3 -3
  5. package/dist/commonjs/components/Call/CallControls/ToggleAudioPublishingButton.js.map +1 -1
  6. package/dist/commonjs/components/Call/CallControls/ToggleCameraFaceButton.js +2 -2
  7. package/dist/commonjs/components/Call/CallControls/ToggleCameraFaceButton.js.map +1 -1
  8. package/dist/commonjs/components/Call/CallControls/ToggleVideoPreviewButton.js +4 -4
  9. package/dist/commonjs/components/Call/CallControls/ToggleVideoPreviewButton.js.map +1 -1
  10. package/dist/commonjs/components/Call/CallControls/ToggleVideoPublishingButton.js +3 -3
  11. package/dist/commonjs/components/Call/CallControls/ToggleVideoPublishingButton.js.map +1 -1
  12. package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js +2 -2
  13. package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js.map +1 -1
  14. package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js +4 -9
  15. package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js.map +1 -1
  16. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +3 -1
  17. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -1
  18. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +18 -11
  19. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  20. package/dist/commonjs/utils/push/android.js +19 -10
  21. package/dist/commonjs/utils/push/android.js.map +1 -1
  22. package/dist/commonjs/utils/push/rxSubjects.js +8 -1
  23. package/dist/commonjs/utils/push/rxSubjects.js.map +1 -1
  24. package/dist/commonjs/utils/push/utils.js +1 -1
  25. package/dist/commonjs/utils/push/utils.js.map +1 -1
  26. package/dist/commonjs/version.js +1 -1
  27. package/dist/module/components/Call/CallControls/ToggleAudioPreviewButton.js +4 -4
  28. package/dist/module/components/Call/CallControls/ToggleAudioPreviewButton.js.map +1 -1
  29. package/dist/module/components/Call/CallControls/ToggleAudioPublishingButton.js +3 -3
  30. package/dist/module/components/Call/CallControls/ToggleAudioPublishingButton.js.map +1 -1
  31. package/dist/module/components/Call/CallControls/ToggleCameraFaceButton.js +2 -2
  32. package/dist/module/components/Call/CallControls/ToggleCameraFaceButton.js.map +1 -1
  33. package/dist/module/components/Call/CallControls/ToggleVideoPreviewButton.js +4 -4
  34. package/dist/module/components/Call/CallControls/ToggleVideoPreviewButton.js.map +1 -1
  35. package/dist/module/components/Call/CallControls/ToggleVideoPublishingButton.js +3 -3
  36. package/dist/module/components/Call/CallControls/ToggleVideoPublishingButton.js.map +1 -1
  37. package/dist/module/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js +2 -2
  38. package/dist/module/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js.map +1 -1
  39. package/dist/module/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js +4 -9
  40. package/dist/module/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js.map +1 -1
  41. package/dist/module/hooks/push/useProcessPushCallEffect.js +4 -2
  42. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -1
  43. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +18 -11
  44. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  45. package/dist/module/utils/push/android.js +21 -12
  46. package/dist/module/utils/push/android.js.map +1 -1
  47. package/dist/module/utils/push/rxSubjects.js +7 -0
  48. package/dist/module/utils/push/rxSubjects.js.map +1 -1
  49. package/dist/module/utils/push/utils.js +1 -1
  50. package/dist/module/utils/push/utils.js.map +1 -1
  51. package/dist/module/version.js +1 -1
  52. package/dist/typescript/components/Call/CallControls/ToggleAudioPreviewButton.d.ts.map +1 -1
  53. package/dist/typescript/components/Call/CallControls/ToggleVideoPreviewButton.d.ts.map +1 -1
  54. package/dist/typescript/components/Livestream/LivestreamControls/LivestreamVideoControlButton.d.ts.map +1 -1
  55. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -1
  56. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  57. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  58. package/dist/typescript/utils/push/rxSubjects.d.ts +6 -0
  59. package/dist/typescript/utils/push/rxSubjects.d.ts.map +1 -1
  60. package/dist/typescript/utils/push/utils.d.ts +1 -1
  61. package/dist/typescript/utils/push/utils.d.ts.map +1 -1
  62. package/dist/typescript/version.d.ts +1 -1
  63. package/expo-config-plugin/dist/common/types.d.ts +1 -0
  64. package/expo-config-plugin/dist/withAndroidManifest.js +5 -0
  65. package/package.json +1 -1
  66. package/src/components/Call/CallControls/ToggleAudioPreviewButton.tsx +6 -4
  67. package/src/components/Call/CallControls/ToggleAudioPublishingButton.tsx +3 -3
  68. package/src/components/Call/CallControls/ToggleCameraFaceButton.tsx +2 -2
  69. package/src/components/Call/CallControls/ToggleVideoPreviewButton.tsx +6 -4
  70. package/src/components/Call/CallControls/ToggleVideoPublishingButton.tsx +3 -3
  71. package/src/components/Livestream/LivestreamControls/LivestreamAudioControlButton.tsx +2 -2
  72. package/src/components/Livestream/LivestreamControls/LivestreamVideoControlButton.tsx +15 -26
  73. package/src/hooks/push/useProcessPushCallEffect.ts +11 -2
  74. package/src/hooks/useAndroidKeepCallAliveEffect.ts +20 -11
  75. package/src/utils/push/android.ts +29 -16
  76. package/src/utils/push/rxSubjects.ts +8 -0
  77. package/src/utils/push/utils.ts +2 -2
  78. package/src/version.ts +1 -1
@@ -1,4 +1,8 @@
1
- import notifee, { EventType, Event } from '@notifee/react-native';
1
+ import notifee, {
2
+ EventType,
3
+ Event,
4
+ AndroidCategory,
5
+ } from '@notifee/react-native';
2
6
  import { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
3
7
  import { Call, RxUtils, StreamVideoClient } from '@stream-io/video-client';
4
8
  import { AppState, Platform } from 'react-native';
@@ -18,6 +22,7 @@ import {
18
22
  pushTappedIncomingCallCId$,
19
23
  pushNonRingingCallData$,
20
24
  pushUnsubscriptionCallbacks$,
25
+ pushAndroidBackgroundDeliveredIncomingCallCId$,
21
26
  } from './rxSubjects';
22
27
  import {
23
28
  canAddPushWSSubscriptionsRef,
@@ -103,12 +108,12 @@ export function setupFirebaseHandlerAndroid(pushConfig: PushConfig) {
103
108
  ); // this is to listen to foreground messages, which we dont need for now
104
109
  }
105
110
 
106
- // the notification tap handlers are always registered with notifee for both platforms
111
+ // the notification tap handlers are always registered with notifee for both expo and non-expo in android
107
112
  notifee.onBackgroundEvent(async (event) => {
108
- await onNotifeeEvent(event, pushConfig);
113
+ await onNotifeeEvent(event, pushConfig, true);
109
114
  });
110
115
  notifee.onForegroundEvent((event) => {
111
- onNotifeeEvent(event, pushConfig);
116
+ onNotifeeEvent(event, pushConfig, false);
112
117
  });
113
118
  }
114
119
 
@@ -274,6 +279,10 @@ const firebaseMessagingOnMessageHandler = async (
274
279
  },
275
280
  },
276
281
  ],
282
+ category: AndroidCategory.CALL,
283
+ fullScreenAction: {
284
+ id: 'stream_ringing_incoming_call',
285
+ },
277
286
  timeoutAfter: 60000, // 60 seconds, after which the notification will be dismissed automatically
278
287
  },
279
288
  });
@@ -331,17 +340,16 @@ const firebaseMessagingOnMessageHandler = async (
331
340
  }
332
341
  };
333
342
 
334
- const onNotifeeEvent = async (event: Event, pushConfig: PushConfig) => {
343
+ const onNotifeeEvent = async (
344
+ event: Event,
345
+ pushConfig: PushConfig,
346
+ isBackground: boolean,
347
+ ) => {
335
348
  const { type, detail } = event;
336
349
  const { notification, pressAction } = detail;
337
350
  const notificationId = notification?.id;
338
351
  const data = notification?.data;
339
- if (
340
- !data ||
341
- !pressAction ||
342
- !notificationId ||
343
- data.sender !== 'stream.video'
344
- ) {
352
+ if (!data || !notificationId || data.sender !== 'stream.video') {
345
353
  return;
346
354
  }
347
355
 
@@ -357,13 +365,13 @@ const onNotifeeEvent = async (event: Event, pushConfig: PushConfig) => {
357
365
  // Check if we need to decline the call
358
366
  const didPressDecline =
359
367
  type === EventType.ACTION_PRESS &&
360
- pressAction.id === DECLINE_CALL_ACTION_ID;
368
+ pressAction?.id === DECLINE_CALL_ACTION_ID;
361
369
  const didDismiss = type === EventType.DISMISSED;
362
370
  const mustDecline = didPressDecline || didDismiss;
363
371
  // Check if we need to accept the call
364
372
  const mustAccept =
365
373
  type === EventType.ACTION_PRESS &&
366
- pressAction.id === ACCEPT_CALL_ACTION_ID;
374
+ pressAction?.id === ACCEPT_CALL_ACTION_ID;
367
375
 
368
376
  if (mustAccept || mustDecline || type === EventType.ACTION_PRESS) {
369
377
  clearPushWSEventSubscriptions();
@@ -380,9 +388,14 @@ const onNotifeeEvent = async (event: Event, pushConfig: PushConfig) => {
380
388
  return;
381
389
  }
382
390
  await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
383
- } else if (type === EventType.PRESS) {
384
- pushTappedIncomingCallCId$.next(call_cid);
385
- // pressed state will be handled by the app with rxjs observers as the app will go to foreground always
391
+ } else {
392
+ if (type === EventType.PRESS) {
393
+ pushTappedIncomingCallCId$.next(call_cid);
394
+ // pressed state will be handled by the app with rxjs observers as the app will go to foreground always
395
+ } else if (isBackground && type === EventType.DELIVERED) {
396
+ pushAndroidBackgroundDeliveredIncomingCallCId$.next(call_cid);
397
+ // background delivered state will be handled by the app with rxjs observers as processing needs to happen only when app is opened
398
+ }
386
399
  }
387
400
  } else {
388
401
  if (type === EventType.PRESS) {
@@ -25,6 +25,14 @@ export const pushTappedIncomingCallCId$ = new BehaviorSubject<
25
25
  string | undefined
26
26
  >(undefined);
27
27
 
28
+ /**
29
+ * This rxjs subject is used to store the call cid of the delivered incoming call from push notification it is neither accepted nor rejected yet
30
+ * Used so that the call is navigated to when app is open from being killed
31
+ * Note: it should be subscribed only when a user has connected to the websocket of Stream
32
+ */
33
+ export const pushAndroidBackgroundDeliveredIncomingCallCId$ =
34
+ new BehaviorSubject<string | undefined>(undefined);
35
+
28
36
  /**
29
37
  * This rxjs subject is used to store the call cid of the accepted incoming call from push notification
30
38
  * Note: it should be subscribed only when a user has connected to the websocket of Stream
@@ -87,7 +87,7 @@ export const processCallFromPushInBackground = async (
87
87
  export const processCallFromPush = async (
88
88
  client: StreamVideoClient,
89
89
  call_cid: string,
90
- action: 'accept' | 'decline' | 'pressed',
90
+ action: 'accept' | 'decline' | 'pressed' | 'backgroundDelivered',
91
91
  ) => {
92
92
  let callFromPush: Call;
93
93
  try {
@@ -96,7 +96,7 @@ export const processCallFromPush = async (
96
96
  console.log('failed to fetch call from push notification', e);
97
97
  return;
98
98
  }
99
- // note: when action was pressed, we dont need to do anything as the only thing is to do is to get the call which adds it to the client
99
+ // 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
100
100
  try {
101
101
  if (action === 'accept') {
102
102
  await callFromPush.join();
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '0.7.3';
1
+ export const version = '0.7.5';