@stream-io/video-react-native-sdk 1.23.0 → 1.24.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 (222) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/commonjs/components/Call/CallContent/CallContent.js +2 -2
  3. package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
  4. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js +2 -2
  5. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  6. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js +3 -3
  7. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  8. package/dist/commonjs/components/Call/CallControls/AcceptCallButton.js +3 -3
  9. package/dist/commonjs/components/Call/CallControls/AcceptCallButton.js.map +1 -1
  10. package/dist/commonjs/components/Call/CallControls/HangupCallButton.js +3 -3
  11. package/dist/commonjs/components/Call/CallControls/HangupCallButton.js.map +1 -1
  12. package/dist/commonjs/components/Call/CallControls/RejectCallButton.js +2 -2
  13. package/dist/commonjs/components/Call/CallControls/RejectCallButton.js.map +1 -1
  14. package/dist/commonjs/components/Call/CallControls/internal/ReactionsPicker.js +2 -2
  15. package/dist/commonjs/components/Call/CallControls/internal/ReactionsPicker.js.map +1 -1
  16. package/dist/commonjs/components/Call/Lobby/JoinCallButton.js +2 -2
  17. package/dist/commonjs/components/Call/Lobby/JoinCallButton.js.map +1 -1
  18. package/dist/commonjs/components/Livestream/LivestreamControls/HostStartStreamButton.js +4 -4
  19. package/dist/commonjs/components/Livestream/LivestreamControls/HostStartStreamButton.js.map +1 -1
  20. package/dist/commonjs/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js +2 -2
  21. package/dist/commonjs/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js.map +1 -1
  22. package/dist/commonjs/components/Livestream/LivestreamPlayer/LivestreamPlayer.js +4 -4
  23. package/dist/commonjs/components/Livestream/LivestreamPlayer/LivestreamPlayer.js.map +1 -1
  24. package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLobby.js +2 -2
  25. package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLobby.js.map +1 -1
  26. package/dist/commonjs/components/Participant/FloatingParticipantView/FloatingView/AnimatedFloatingView.js +2 -2
  27. package/dist/commonjs/components/Participant/FloatingParticipantView/FloatingView/AnimatedFloatingView.js.map +1 -1
  28. package/dist/commonjs/contexts/internal/ScreenshotIosContext.js +3 -3
  29. package/dist/commonjs/contexts/internal/ScreenshotIosContext.js.map +1 -1
  30. package/dist/commonjs/hooks/push/useInitAndroidTokenAndRest.js +1 -1
  31. package/dist/commonjs/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
  32. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +2 -2
  33. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -1
  34. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +13 -13
  35. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  36. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +2 -2
  37. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -1
  38. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js +1 -1
  39. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -1
  40. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +10 -10
  41. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  42. package/dist/commonjs/hooks/usePermissionRequest.js +2 -2
  43. package/dist/commonjs/hooks/usePermissionRequest.js.map +1 -1
  44. package/dist/commonjs/hooks/useScreenShareButton.js +4 -4
  45. package/dist/commonjs/hooks/useScreenShareButton.js.map +1 -1
  46. package/dist/commonjs/hooks/useScreenshot.js +2 -2
  47. package/dist/commonjs/hooks/useScreenshot.js.map +1 -1
  48. package/dist/commonjs/modules/call-manager/PrevLibDetection.js +1 -1
  49. package/dist/commonjs/modules/call-manager/PrevLibDetection.js.map +1 -1
  50. package/dist/commonjs/providers/BusyTonePlayer.js +6 -6
  51. package/dist/commonjs/providers/BusyTonePlayer.js.map +1 -1
  52. package/dist/commonjs/providers/NoiseCancellation/NoiseCancellationProvider.js +2 -2
  53. package/dist/commonjs/providers/NoiseCancellation/NoiseCancellationProvider.js.map +1 -1
  54. package/dist/commonjs/providers/StreamCall/AppStateListener.js +7 -7
  55. package/dist/commonjs/providers/StreamCall/AppStateListener.js.map +1 -1
  56. package/dist/commonjs/utils/getAndroidDefaultRingtoneUrl.js +3 -3
  57. package/dist/commonjs/utils/getAndroidDefaultRingtoneUrl.js.map +1 -1
  58. package/dist/commonjs/utils/push/android.js +30 -30
  59. package/dist/commonjs/utils/push/android.js.map +1 -1
  60. package/dist/commonjs/utils/push/internal/ios.js +9 -9
  61. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  62. package/dist/commonjs/utils/push/internal/utils.js +11 -11
  63. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  64. package/dist/commonjs/utils/push/ios.js +21 -21
  65. package/dist/commonjs/utils/push/ios.js.map +1 -1
  66. package/dist/commonjs/utils/push/libs/expoNotifications.js +1 -1
  67. package/dist/commonjs/utils/push/libs/expoNotifications.js.map +1 -1
  68. package/dist/commonjs/utils/push/libs/firebaseMessaging/index.js +3 -3
  69. package/dist/commonjs/utils/push/libs/firebaseMessaging/index.js.map +1 -1
  70. package/dist/commonjs/utils/push/libs/notifee/index.js +3 -3
  71. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  72. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +7 -7
  73. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -1
  74. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +4 -4
  75. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  76. package/dist/commonjs/version.js +1 -1
  77. package/dist/module/components/Call/CallContent/CallContent.js +3 -3
  78. package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
  79. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js +3 -3
  80. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  81. package/dist/module/components/Call/CallContent/RTCViewPipNative.js +3 -3
  82. package/dist/module/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  83. package/dist/module/components/Call/CallControls/AcceptCallButton.js +3 -3
  84. package/dist/module/components/Call/CallControls/AcceptCallButton.js.map +1 -1
  85. package/dist/module/components/Call/CallControls/HangupCallButton.js +3 -4
  86. package/dist/module/components/Call/CallControls/HangupCallButton.js.map +1 -1
  87. package/dist/module/components/Call/CallControls/RejectCallButton.js +3 -3
  88. package/dist/module/components/Call/CallControls/RejectCallButton.js.map +1 -1
  89. package/dist/module/components/Call/CallControls/internal/ReactionsPicker.js +3 -3
  90. package/dist/module/components/Call/CallControls/internal/ReactionsPicker.js.map +1 -1
  91. package/dist/module/components/Call/Lobby/JoinCallButton.js +3 -3
  92. package/dist/module/components/Call/Lobby/JoinCallButton.js.map +1 -1
  93. package/dist/module/components/Livestream/LivestreamControls/HostStartStreamButton.js +5 -5
  94. package/dist/module/components/Livestream/LivestreamControls/HostStartStreamButton.js.map +1 -1
  95. package/dist/module/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js +3 -3
  96. package/dist/module/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js.map +1 -1
  97. package/dist/module/components/Livestream/LivestreamPlayer/LivestreamPlayer.js +5 -5
  98. package/dist/module/components/Livestream/LivestreamPlayer/LivestreamPlayer.js.map +1 -1
  99. package/dist/module/components/Livestream/ViewerLivestream/ViewerLobby.js +3 -4
  100. package/dist/module/components/Livestream/ViewerLivestream/ViewerLobby.js.map +1 -1
  101. package/dist/module/components/Participant/FloatingParticipantView/FloatingView/AnimatedFloatingView.js +3 -3
  102. package/dist/module/components/Participant/FloatingParticipantView/FloatingView/AnimatedFloatingView.js.map +1 -1
  103. package/dist/module/contexts/internal/ScreenshotIosContext.js +4 -4
  104. package/dist/module/contexts/internal/ScreenshotIosContext.js.map +1 -1
  105. package/dist/module/hooks/push/useInitAndroidTokenAndRest.js +2 -2
  106. package/dist/module/hooks/push/useInitAndroidTokenAndRest.js.map +1 -1
  107. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +3 -3
  108. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -1
  109. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +14 -14
  110. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  111. package/dist/module/hooks/push/useProcessPushCallEffect.js +3 -3
  112. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -1
  113. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js +2 -2
  114. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -1
  115. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +11 -11
  116. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  117. package/dist/module/hooks/usePermissionRequest.js +3 -3
  118. package/dist/module/hooks/usePermissionRequest.js.map +1 -1
  119. package/dist/module/hooks/useScreenShareButton.js +5 -5
  120. package/dist/module/hooks/useScreenShareButton.js.map +1 -1
  121. package/dist/module/hooks/useScreenshot.js +3 -3
  122. package/dist/module/hooks/useScreenshot.js.map +1 -1
  123. package/dist/module/modules/call-manager/PrevLibDetection.js +2 -2
  124. package/dist/module/modules/call-manager/PrevLibDetection.js.map +1 -1
  125. package/dist/module/providers/BusyTonePlayer.js +7 -7
  126. package/dist/module/providers/BusyTonePlayer.js.map +1 -1
  127. package/dist/module/providers/NoiseCancellation/NoiseCancellationProvider.js +3 -3
  128. package/dist/module/providers/NoiseCancellation/NoiseCancellationProvider.js.map +1 -1
  129. package/dist/module/providers/StreamCall/AppStateListener.js +8 -8
  130. package/dist/module/providers/StreamCall/AppStateListener.js.map +1 -1
  131. package/dist/module/utils/getAndroidDefaultRingtoneUrl.js +3 -3
  132. package/dist/module/utils/getAndroidDefaultRingtoneUrl.js.map +1 -1
  133. package/dist/module/utils/push/android.js +31 -31
  134. package/dist/module/utils/push/android.js.map +1 -1
  135. package/dist/module/utils/push/internal/ios.js +9 -9
  136. package/dist/module/utils/push/internal/ios.js.map +1 -1
  137. package/dist/module/utils/push/internal/utils.js +12 -12
  138. package/dist/module/utils/push/internal/utils.js.map +1 -1
  139. package/dist/module/utils/push/ios.js +22 -22
  140. package/dist/module/utils/push/ios.js.map +1 -1
  141. package/dist/module/utils/push/libs/expoNotifications.js +2 -2
  142. package/dist/module/utils/push/libs/expoNotifications.js.map +1 -1
  143. package/dist/module/utils/push/libs/firebaseMessaging/index.js +3 -3
  144. package/dist/module/utils/push/libs/firebaseMessaging/index.js.map +1 -1
  145. package/dist/module/utils/push/libs/notifee/index.js +3 -3
  146. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  147. package/dist/module/utils/push/setupIosCallKeepEvents.js +8 -8
  148. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -1
  149. package/dist/module/utils/push/setupIosVoipPushEvents.js +5 -5
  150. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  151. package/dist/module/version.js +1 -1
  152. package/dist/typescript/components/Call/CallContent/CallContent.d.ts.map +1 -1
  153. package/dist/typescript/components/Call/CallContent/RTCViewPipIOS.d.ts.map +1 -1
  154. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts.map +1 -1
  155. package/dist/typescript/components/Call/CallControls/AcceptCallButton.d.ts.map +1 -1
  156. package/dist/typescript/components/Call/CallControls/HangupCallButton.d.ts.map +1 -1
  157. package/dist/typescript/components/Call/CallControls/internal/ReactionsPicker.d.ts.map +1 -1
  158. package/dist/typescript/components/Livestream/ViewerLivestream/ViewerLobby.d.ts.map +1 -1
  159. package/dist/typescript/components/Participant/FloatingParticipantView/FloatingView/AnimatedFloatingView.d.ts.map +1 -1
  160. package/dist/typescript/contexts/internal/ScreenshotIosContext.d.ts.map +1 -1
  161. package/dist/typescript/hooks/push/useInitAndroidTokenAndRest.d.ts.map +1 -1
  162. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -1
  163. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  164. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -1
  165. package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts.map +1 -1
  166. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  167. package/dist/typescript/hooks/useScreenShareButton.d.ts.map +1 -1
  168. package/dist/typescript/hooks/useScreenshot.d.ts.map +1 -1
  169. package/dist/typescript/modules/call-manager/PrevLibDetection.d.ts.map +1 -1
  170. package/dist/typescript/providers/BusyTonePlayer.d.ts.map +1 -1
  171. package/dist/typescript/providers/NoiseCancellation/NoiseCancellationProvider.d.ts.map +1 -1
  172. package/dist/typescript/providers/StreamCall/AppStateListener.d.ts.map +1 -1
  173. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  174. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  175. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  176. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  177. package/dist/typescript/utils/push/libs/expoNotifications.d.ts.map +1 -1
  178. package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
  179. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  180. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -1
  181. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  182. package/dist/typescript/version.d.ts +1 -1
  183. package/ios/StreamInCallManager.swift +10 -2
  184. package/package.json +3 -3
  185. package/src/components/Call/CallContent/CallContent.tsx +7 -9
  186. package/src/components/Call/CallContent/RTCViewPipIOS.tsx +7 -9
  187. package/src/components/Call/CallContent/RTCViewPipNative.tsx +8 -6
  188. package/src/components/Call/CallControls/AcceptCallButton.tsx +3 -3
  189. package/src/components/Call/CallControls/HangupCallButton.tsx +3 -4
  190. package/src/components/Call/CallControls/RejectCallButton.tsx +4 -4
  191. package/src/components/Call/CallControls/internal/ReactionsPicker.tsx +6 -3
  192. package/src/components/Call/Lobby/JoinCallButton.tsx +3 -3
  193. package/src/components/Livestream/LivestreamControls/HostStartStreamButton.tsx +5 -5
  194. package/src/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.tsx +3 -3
  195. package/src/components/Livestream/LivestreamPlayer/LivestreamPlayer.tsx +5 -5
  196. package/src/components/Livestream/ViewerLivestream/ViewerLobby.tsx +3 -4
  197. package/src/components/Participant/FloatingParticipantView/FloatingView/AnimatedFloatingView.tsx +3 -4
  198. package/src/contexts/internal/ScreenshotIosContext.tsx +12 -14
  199. package/src/hooks/push/useInitAndroidTokenAndRest.ts +4 -6
  200. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +9 -3
  201. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +14 -19
  202. package/src/hooks/push/useProcessPushCallEffect.ts +11 -9
  203. package/src/hooks/push/useProcessPushNonRingingCallEffect.ts +6 -5
  204. package/src/hooks/useAndroidKeepCallAliveEffect.ts +17 -14
  205. package/src/hooks/usePermissionRequest.tsx +3 -3
  206. package/src/hooks/useScreenShareButton.ts +5 -7
  207. package/src/hooks/useScreenshot.ts +7 -11
  208. package/src/modules/call-manager/PrevLibDetection.ts +6 -5
  209. package/src/providers/BusyTonePlayer.tsx +7 -11
  210. package/src/providers/NoiseCancellation/NoiseCancellationProvider.tsx +7 -11
  211. package/src/providers/StreamCall/AppStateListener.tsx +8 -12
  212. package/src/utils/getAndroidDefaultRingtoneUrl.ts +3 -3
  213. package/src/utils/push/android.ts +93 -85
  214. package/src/utils/push/internal/ios.ts +9 -15
  215. package/src/utils/push/internal/utils.ts +28 -25
  216. package/src/utils/push/ios.ts +28 -32
  217. package/src/utils/push/libs/expoNotifications.ts +6 -5
  218. package/src/utils/push/libs/firebaseMessaging/index.ts +5 -4
  219. package/src/utils/push/libs/notifee/index.ts +3 -4
  220. package/src/utils/push/setupIosCallKeepEvents.ts +12 -14
  221. package/src/utils/push/setupIosVoipPushEvents.ts +7 -9
  222. package/src/version.ts +1 -1
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Call,
3
3
  CallingState,
4
- getLogger,
5
4
  StreamVideoClient,
5
+ videoLoggerSystem,
6
6
  } from '@stream-io/video-client';
7
7
  import { AppState, Platform } from 'react-native';
8
8
  import type {
@@ -59,19 +59,18 @@ export async function initAndroidPushToken(
59
59
  if (Platform.OS !== 'android' || !pushConfig.android.pushProviderName) {
60
60
  return;
61
61
  }
62
- const logger = getLogger(['initAndroidPushToken']);
62
+ const logger = videoLoggerSystem.getLogger('initAndroidPushToken');
63
63
  const setDeviceToken = async (token: string) => {
64
64
  const userId = client.streamClient._user?.id ?? '';
65
65
  if (client.streamClient.anonymous) {
66
- logger('debug', 'Skipped sending firebase token for anonymous user');
66
+ logger.debug('Skipped sending firebase token for anonymous user');
67
67
  return;
68
68
  }
69
69
  if (
70
70
  lastFirebaseToken.token === token &&
71
71
  lastFirebaseToken.userId === userId
72
72
  ) {
73
- logger(
74
- 'debug',
73
+ logger.debug(
75
74
  `Skipping setting the same token again for userId: ${userId} and token: ${token}`,
76
75
  );
77
76
  return;
@@ -80,14 +79,14 @@ export async function initAndroidPushToken(
80
79
  setPushLogoutCallback(async () => {
81
80
  lastFirebaseToken = { token: '', userId: '' };
82
81
  try {
83
- logger('debug', `Logout removeDeviceToken: ${token}`);
82
+ logger.debug(`Logout removeDeviceToken: ${token}`);
84
83
  await client.removeDevice(token);
85
84
  } catch (err) {
86
- logger('warn', 'Failed to remove firebase token from stream', err);
85
+ logger.warn('Failed to remove firebase token from stream', err);
87
86
  }
88
87
  });
89
88
  const push_provider_name = pushConfig.android.pushProviderName;
90
- logger('debug', `sending firebase token: ${token} for userId: ${userId}`);
89
+ logger.debug(`sending firebase token: ${token} for userId: ${userId}`);
91
90
  await client.addDevice(token, 'firebase', push_provider_name);
92
91
  };
93
92
  if (pushConfig.isExpo) {
@@ -95,7 +94,7 @@ export async function initAndroidPushToken(
95
94
  ? getExpoNotificationsLib()
96
95
  : getExpoNotificationsLibNoThrow();
97
96
  if (expoNotificationsLib) {
98
- logger('debug', `setting expo notification token listeners`);
97
+ logger.debug(`setting expo notification token listeners`);
99
98
  const subscription = expoNotificationsLib.addPushTokenListener(
100
99
  (devicePushToken) => {
101
100
  setDeviceToken(devicePushToken.data);
@@ -114,7 +113,7 @@ export async function initAndroidPushToken(
114
113
  ? getFirebaseMessagingLibNoThrow(true)
115
114
  : getFirebaseMessagingLib();
116
115
  if (messaging) {
117
- logger('debug', `setting firebase token listeners`);
116
+ logger.debug(`setting firebase token listeners`);
118
117
  const unsubscribe = messaging().onTokenRefresh((refreshedToken) =>
119
118
  setDeviceToken(refreshedToken),
120
119
  );
@@ -155,9 +154,8 @@ export const firebaseDataHandler = async (
155
154
  const notifee = notifeeLib.default;
156
155
  const settings = await notifee.getNotificationSettings();
157
156
  if (settings.authorizationStatus !== 1) {
158
- const logger = getLogger(['firebaseDataHandler']);
159
- logger(
160
- 'debug',
157
+ const logger = videoLoggerSystem.getLogger('firebaseDataHandler');
158
+ logger.debug(
161
159
  `Notification permission not granted, unable to post ${data.type} notifications`,
162
160
  );
163
161
  return;
@@ -192,20 +190,22 @@ export const firebaseDataHandler = async (
192
190
  return new Promise(async () => {
193
191
  const client = await pushConfig.createStreamVideoClient();
194
192
  if (!client) {
195
- getLogger(['firebaseMessagingOnMessageHandler'])(
196
- 'debug',
197
- `Closing fg service as there is no client to create from push config`,
198
- );
193
+ videoLoggerSystem
194
+ .getLogger('firebaseMessagingOnMessageHandler')
195
+ .debug(
196
+ `Closing fg service as there is no client to create from push config`,
197
+ );
199
198
  notifee.stopForegroundService();
200
199
  return;
201
200
  }
202
201
  const callFromPush = await client.onRingingCall(call_cid);
203
202
  let _shouldCallBeClosed = shouldCallBeClosed(callFromPush);
204
203
  if (_shouldCallBeClosed) {
205
- getLogger(['firebaseMessagingOnMessageHandler'])(
206
- 'debug',
207
- `Closing fg service callCid: ${call_cid} shouldCallBeClosed: ${_shouldCallBeClosed}`,
208
- );
204
+ videoLoggerSystem
205
+ .getLogger('firebaseMessagingOnMessageHandler')
206
+ .debug(
207
+ `Closing fg service callCid: ${call_cid} shouldCallBeClosed: ${_shouldCallBeClosed}`,
208
+ );
209
209
  notifee.stopForegroundService();
210
210
  return;
211
211
  }
@@ -214,22 +214,24 @@ export const firebaseDataHandler = async (
214
214
  const unsubscribe = callFromPush.on('all', (event) => {
215
215
  const _canListenToWS = canListenToWS();
216
216
  if (!_canListenToWS) {
217
- getLogger(['firebaseMessagingOnMessageHandler'])(
218
- 'debug',
219
- `Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`,
220
- { event },
221
- );
217
+ videoLoggerSystem
218
+ .getLogger('firebaseMessagingOnMessageHandler')
219
+ .debug(
220
+ `Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`,
221
+ { event },
222
+ );
222
223
  unsubscribeFunctions.forEach((fn) => fn());
223
224
  notifee.stopForegroundService();
224
225
  return;
225
226
  }
226
227
  _shouldCallBeClosed = shouldCallBeClosed(callFromPush);
227
228
  if (_shouldCallBeClosed) {
228
- getLogger(['firebaseMessagingOnMessageHandler'])(
229
- 'debug',
230
- `Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed: ${_shouldCallBeClosed}`,
231
- { event },
232
- );
229
+ videoLoggerSystem
230
+ .getLogger('firebaseMessagingOnMessageHandler')
231
+ .debug(
232
+ `Closing fg service from event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed: ${_shouldCallBeClosed}`,
233
+ { event },
234
+ );
233
235
  unsubscribeFunctions.forEach((fn) => fn());
234
236
  notifee.stopForegroundService();
235
237
  }
@@ -241,10 +243,11 @@ export const firebaseDataHandler = async (
241
243
  callingState === CallingState.IDLE ||
242
244
  callingState === CallingState.LEFT
243
245
  ) {
244
- getLogger(['firebaseMessagingOnMessageHandler'])(
245
- 'debug',
246
- `Closing fg service from callingState callCid: ${call_cid} callingState: ${callingState}`,
247
- );
246
+ videoLoggerSystem
247
+ .getLogger('firebaseMessagingOnMessageHandler')
248
+ .debug(
249
+ `Closing fg service from callingState callCid: ${call_cid} callingState: ${callingState}`,
250
+ );
248
251
  unsubscribeFunctions.forEach((fn) => fn());
249
252
  notifee.stopForegroundService();
250
253
  }
@@ -261,9 +264,10 @@ export const firebaseDataHandler = async (
261
264
  const incomingCallNotificationTextGetters =
262
265
  pushConfig.android.incomingCallNotificationTextGetters;
263
266
  if (!incomingCallChannel || !incomingCallNotificationTextGetters) {
264
- const logger = getLogger(['firebaseMessagingOnMessageHandler']);
265
- logger(
266
- 'error',
267
+ const logger = videoLoggerSystem.getLogger(
268
+ 'firebaseMessagingOnMessageHandler',
269
+ );
270
+ logger.error(
267
271
  "Can't show incoming call notification as either or both incomingCallChannel and incomingCallNotificationTextGetters were not provided",
268
272
  );
269
273
  return;
@@ -284,10 +288,11 @@ export const firebaseDataHandler = async (
284
288
  const title = getTitle(createdUserName);
285
289
  const body = getBody(createdUserName);
286
290
 
287
- getLogger(['firebaseMessagingOnMessageHandler'])(
288
- 'debug',
289
- `Displaying incoming call notification with callCid: ${call_cid} title: ${title} body: ${body} asForegroundService: ${asForegroundService}`,
290
- );
291
+ videoLoggerSystem
292
+ .getLogger('firebaseMessagingOnMessageHandler')
293
+ .debug(
294
+ `Displaying incoming call notification with callCid: ${call_cid} title: ${title} body: ${body} asForegroundService: ${asForegroundService}`,
295
+ );
291
296
 
292
297
  const channelId = incomingCallChannel.id;
293
298
  await notifee.displayNotification({
@@ -346,10 +351,11 @@ export const firebaseDataHandler = async (
346
351
  const callFromPush = await client.onRingingCall(call_cid);
347
352
 
348
353
  if (shouldCallBeClosed(callFromPush)) {
349
- getLogger(['firebaseMessagingOnMessageHandler'])(
350
- 'debug',
351
- `Removing incoming call notification immediately with callCid: ${call_cid} as it should be closed`,
352
- );
354
+ videoLoggerSystem
355
+ .getLogger('firebaseMessagingOnMessageHandler')
356
+ .debug(
357
+ `Removing incoming call notification immediately with callCid: ${call_cid} as it should be closed`,
358
+ );
353
359
  notifee.cancelDisplayedNotification(call_cid);
354
360
  }
355
361
  } else {
@@ -358,9 +364,10 @@ export const firebaseDataHandler = async (
358
364
  const callNotificationTextGetters =
359
365
  pushConfig.android.callNotificationTextGetters;
360
366
  if (!callChannel || !callNotificationTextGetters) {
361
- const logger = getLogger(['firebaseMessagingOnMessageHandler']);
362
- logger(
363
- 'debug',
367
+ const logger = videoLoggerSystem.getLogger(
368
+ 'firebaseMessagingOnMessageHandler',
369
+ );
370
+ logger.debug(
364
371
  "Can't show call notification as either or both callChannel and callNotificationTextGetters is not provided",
365
372
  );
366
373
  return;
@@ -375,10 +382,11 @@ export const firebaseDataHandler = async (
375
382
  const title = getTitle(type, createdUserName);
376
383
  const body = getBody(type, createdUserName);
377
384
 
378
- getLogger(['firebaseMessagingOnMessageHandler'])(
379
- 'debug',
380
- `Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`,
381
- );
385
+ videoLoggerSystem
386
+ .getLogger('firebaseMessagingOnMessageHandler')
387
+ .debug(
388
+ `Displaying NonRingingPushEvent ${type} notification with title: ${title} body: ${body}`,
389
+ );
382
390
  await notifee.displayNotification({
383
391
  title: getTitle(type, createdUserName),
384
392
  body: getBody(type, createdUserName),
@@ -450,53 +458,54 @@ export const onAndroidNotifeeEvent = async ({
450
458
  mustDecline ||
451
459
  type === notifeeLib.EventType.ACTION_PRESS
452
460
  ) {
453
- getLogger(['onAndroidNotifeeEvent'])(
454
- 'debug',
455
- `clearPushWSEventSubscriptions for callCId: ${call_cid} mustAccept: ${mustAccept} mustDecline: ${mustDecline}`,
456
- );
461
+ videoLoggerSystem
462
+ .getLogger('onAndroidNotifeeEvent')
463
+ .debug(
464
+ `clearPushWSEventSubscriptions for callCId: ${call_cid} mustAccept: ${mustAccept} mustDecline: ${mustDecline}`,
465
+ );
457
466
  clearPushWSEventSubscriptions(call_cid);
458
467
  notifee.stopForegroundService();
459
468
  }
460
469
 
461
470
  if (mustAccept) {
462
- getLogger(['onAndroidNotifeeEvent'])(
463
- 'debug',
464
- `pushAcceptedIncomingCallCId$ added with callCId: ${call_cid}`,
465
- );
471
+ videoLoggerSystem
472
+ .getLogger('onAndroidNotifeeEvent')
473
+ .debug(`pushAcceptedIncomingCallCId$ added with callCId: ${call_cid}`);
466
474
  pushAcceptedIncomingCallCId$.next(call_cid);
467
475
  // NOTE: accept will be handled by the app with rxjs observers as the app will go to foreground always
468
476
  } else if (mustDecline) {
469
- getLogger(['onAndroidNotifeeEvent'])(
470
- 'debug',
471
- `pushRejectedIncomingCallCId$ added with callCId: ${call_cid}`,
472
- );
477
+ videoLoggerSystem
478
+ .getLogger('onAndroidNotifeeEvent')
479
+ .debug(`pushRejectedIncomingCallCId$ added with callCId: ${call_cid}`);
473
480
  pushRejectedIncomingCallCId$.next(call_cid);
474
481
  if (hasObservers) {
475
482
  // if we had observers we can return here as the observers will handle the call as the app is in the foreground state
476
- getLogger(['onAndroidNotifeeEvent'])(
477
- 'debug',
478
- `Skipped processCallFromPushInBackground for Declining call with callCId: ${call_cid} as the app is in the foreground state`,
479
- );
483
+ videoLoggerSystem
484
+ .getLogger('onAndroidNotifeeEvent')
485
+ .debug(
486
+ `Skipped processCallFromPushInBackground for Declining call with callCId: ${call_cid} as the app is in the foreground state`,
487
+ );
480
488
  return;
481
489
  }
482
- getLogger(['onAndroidNotifeeEvent'])(
483
- 'debug',
484
- `start processCallFromPushInBackground - Declining call with callCId: ${call_cid}`,
485
- );
490
+ videoLoggerSystem
491
+ .getLogger('onAndroidNotifeeEvent')
492
+ .debug(
493
+ `start processCallFromPushInBackground - Declining call with callCId: ${call_cid}`,
494
+ );
486
495
  await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
487
496
  } else {
488
497
  if (type === notifeeLib.EventType.PRESS) {
489
- getLogger(['onAndroidNotifeeEvent'])(
490
- 'debug',
491
- `pushTappedIncomingCallCId$ added with callCId: ${call_cid}`,
492
- );
498
+ videoLoggerSystem
499
+ .getLogger('onAndroidNotifeeEvent')
500
+ .debug(`pushTappedIncomingCallCId$ added with callCId: ${call_cid}`);
493
501
  pushTappedIncomingCallCId$.next(call_cid);
494
502
  // pressed state will be handled by the app with rxjs observers as the app will go to foreground always
495
503
  } else if (isBackground && type === notifeeLib.EventType.DELIVERED) {
496
- getLogger(['onAndroidNotifeeEvent'])(
497
- 'debug',
498
- `pushAndroidBackgroundDeliveredIncomingCallCId$ added with callCId: ${call_cid}`,
499
- );
504
+ videoLoggerSystem
505
+ .getLogger('onAndroidNotifeeEvent')
506
+ .debug(
507
+ `pushAndroidBackgroundDeliveredIncomingCallCId$ added with callCId: ${call_cid}`,
508
+ );
500
509
  pushAndroidBackgroundDeliveredIncomingCallCId$.next(call_cid);
501
510
  // background delivered state will be handled by the app with rxjs observers as processing needs to happen only when app is opened
502
511
  }
@@ -504,10 +513,9 @@ export const onAndroidNotifeeEvent = async ({
504
513
  } else {
505
514
  const notifeeLib = getNotifeeLibThrowIfNotInstalledForPush();
506
515
  if (type === notifeeLib.EventType.PRESS) {
507
- getLogger(['onAndroidNotifeeEvent'])(
508
- 'debug',
509
- `onTapNonRingingCallNotification with callCId: ${call_cid}`,
510
- );
516
+ videoLoggerSystem
517
+ .getLogger('onAndroidNotifeeEvent')
518
+ .debug(`onTapNonRingingCallNotification with callCId: ${call_cid}`);
511
519
  pushConfig.onTapNonRingingCallNotification?.(
512
520
  call_cid,
513
521
  data.type as NonRingingPushEvent,
@@ -1,10 +1,10 @@
1
- import { getLogger } from '@stream-io/video-client';
2
1
  import { AppState, NativeModules, Platform } from 'react-native';
3
2
  import { getCallKeepLib, getVoipPushNotificationLib } from '../libs';
4
3
  import { voipPushNotificationCallCId$ } from './rxSubjects';
5
4
  import { pushUnsubscriptionCallbacks } from './constants';
6
5
  import { canAddPushWSSubscriptionsRef, shouldCallBeEnded } from './utils';
7
6
  import { StreamVideoConfig } from '../../StreamVideoRN/types';
7
+ import { videoLoggerSystem } from '@stream-io/video-client';
8
8
 
9
9
  export const onVoipNotificationReceived = async (
10
10
  notification: any,
@@ -42,12 +42,11 @@ export const onVoipNotificationReceived = async (
42
42
  if (!call_cid || Platform.OS !== 'ios' || !pushConfig.ios.pushProviderName) {
43
43
  return;
44
44
  }
45
- const logger = getLogger(['setupIosVoipPushEvents']);
45
+ const logger = videoLoggerSystem.getLogger('setupIosVoipPushEvents');
46
46
  const client = await pushConfig.createStreamVideoClient();
47
47
 
48
48
  if (!client) {
49
- logger(
50
- 'debug',
49
+ logger.debug(
51
50
  'client not found, not processing call.ring voip push notification',
52
51
  );
53
52
  return;
@@ -67,11 +66,10 @@ export const onVoipNotificationReceived = async (
67
66
  call_cid,
68
67
  );
69
68
  } catch (error) {
70
- logger('error', 'Error in getting call uuid from native module', error);
69
+ logger.error('Error in getting call uuid from native module', error);
71
70
  }
72
71
  if (!uuid) {
73
- logger(
74
- 'error',
72
+ logger.error(
75
73
  `Not processing call.ring push notification, as no uuid found for call_cid: ${call_cid}`,
76
74
  );
77
75
  return;
@@ -86,8 +84,7 @@ export const onVoipNotificationReceived = async (
86
84
  );
87
85
  if (mustEndCall) {
88
86
  const callkeep = getCallKeepLib();
89
- logger(
90
- 'debug',
87
+ logger.debug(
91
88
  `callkeep.reportEndCallWithUUID for uuid: ${uuid}, call_cid: ${call_cid}, reason: ${callkeepReason}`,
92
89
  );
93
90
  callkeep.reportEndCallWithUUID(uuid, callkeepReason);
@@ -104,8 +101,7 @@ export const onVoipNotificationReceived = async (
104
101
  const unsubscribe = callFromPush.on('all', (event) => {
105
102
  const _canListenToWS = canListenToWS();
106
103
  if (!_canListenToWS) {
107
- logger(
108
- 'debug',
104
+ logger.debug(
109
105
  `unsubscribe due to event callCid: ${call_cid} canListenToWS: ${_canListenToWS}`,
110
106
  event,
111
107
  );
@@ -114,8 +110,7 @@ export const onVoipNotificationReceived = async (
114
110
  }
115
111
  const _closed = closeCallIfNecessary();
116
112
  if (_closed) {
117
- logger(
118
- 'debug',
113
+ logger.debug(
119
114
  `unsubscribe due to event callCid: ${call_cid} canListenToWS: ${_canListenToWS} shouldCallBeClosed: ${_closed}`,
120
115
  event,
121
116
  );
@@ -128,8 +123,7 @@ export const onVoipNotificationReceived = async (
128
123
  }
129
124
  // send the info to this subject, it is listened by callkeep events
130
125
  // callkeep events will then accept/reject the call
131
- logger(
132
- 'debug',
126
+ logger.debug(
133
127
  `call_cid:${call_cid} uuid:${uuid} received and processed from call.ring push notification`,
134
128
  );
135
129
  voipPushNotificationCallCId$.next(call_cid);
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Call,
3
3
  CallingState,
4
- getLogger,
5
4
  StreamVideoClient,
5
+ videoLoggerSystem,
6
6
  } from '@stream-io/video-client';
7
7
  import type {
8
8
  NonRingingPushEvent,
@@ -56,10 +56,11 @@ export const shouldCallBeEnded = (
56
56
  callkeepReason = 4;
57
57
  }
58
58
  }
59
- getLogger(['shouldCallBeEnded'])(
60
- 'debug',
61
- `callCid: ${callFromPush.cid} mustEndCall: ${mustEndCall} callkeepReason: ${callkeepReason}`,
62
- );
59
+ videoLoggerSystem
60
+ .getLogger('shouldCallBeEnded')
61
+ .debug(
62
+ `callCid: ${callFromPush.cid} mustEndCall: ${mustEndCall} callkeepReason: ${callkeepReason}`,
63
+ );
63
64
  return { mustEndCall, callkeepReason };
64
65
  };
65
66
 
@@ -80,8 +81,10 @@ export const processCallFromPushInBackground = async (
80
81
  return;
81
82
  }
82
83
  } catch (e) {
83
- const logger = getLogger(['processCallFromPushInBackground']);
84
- logger('error', 'failed to create video client', e);
84
+ const logger = videoLoggerSystem.getLogger(
85
+ 'processCallFromPushInBackground',
86
+ );
87
+ logger.error('failed to create video client', e);
85
88
  return;
86
89
  }
87
90
  await processCallFromPush(videoClient, call_cid, action, pushConfig);
@@ -104,8 +107,8 @@ export const processCallFromPush = async (
104
107
  try {
105
108
  callFromPush = await client.onRingingCall(call_cid);
106
109
  } catch (e) {
107
- const logger = getLogger(['processCallFromPush']);
108
- logger('error', 'failed to fetch call from push notification', e);
110
+ const logger = videoLoggerSystem.getLogger('processCallFromPush');
111
+ logger.error('failed to fetch call from push notification', e);
109
112
  return;
110
113
  }
111
114
  // 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
@@ -114,27 +117,25 @@ export const processCallFromPush = async (
114
117
  if (pushConfig.publishOptions) {
115
118
  callFromPush.updatePublishOptions(pushConfig.publishOptions);
116
119
  }
117
- getLogger(['processCallFromPush'])(
118
- 'debug',
119
- `joining call from push notification with callCid: ${callFromPush.cid}`,
120
- );
120
+ videoLoggerSystem
121
+ .getLogger('processCallFromPush')
122
+ .debug(
123
+ `joining call from push notification with callCid: ${callFromPush.cid}`,
124
+ );
121
125
  await callFromPush.join();
122
126
  } else if (action === 'decline') {
123
127
  const canReject =
124
128
  callFromPush.state.callingState === CallingState.RINGING;
125
- getLogger(['processCallFromPush'])(
126
- 'debug',
127
- `declining call from push notification with callCid: ${callFromPush.cid} reject: ${canReject}`,
128
- );
129
+ videoLoggerSystem
130
+ .getLogger('processCallFromPush')
131
+ .debug(
132
+ `declining call from push notification with callCid: ${callFromPush.cid} reject: ${canReject}`,
133
+ );
129
134
  await callFromPush.leave({ reject: canReject, reason: 'decline' });
130
135
  }
131
136
  } catch (e) {
132
- const logger = getLogger(['processCallFromPush']);
133
- logger(
134
- 'warn',
135
- `failed to process ${action} call from push notification`,
136
- e,
137
- );
137
+ const logger = videoLoggerSystem.getLogger('processCallFromPush');
138
+ logger.warn(`failed to process ${action} call from push notification`, e);
138
139
  }
139
140
  };
140
141
 
@@ -162,8 +163,10 @@ export const processNonIncomingCallFromPush = async (
162
163
  await callFromPush.get();
163
164
  }
164
165
  } catch (e) {
165
- const logger = getLogger(['processNonIncomingCallFromPush']);
166
- logger('error', 'failed to fetch call from push notification', e);
166
+ const logger = videoLoggerSystem.getLogger(
167
+ 'processNonIncomingCallFromPush',
168
+ );
169
+ logger.error('failed to fetch call from push notification', e);
167
170
  return;
168
171
  }
169
172
  onNewCallNotification(callFromPush, nonRingingNotificationType);