@stream-io/video-react-native-sdk 1.9.23 → 1.9.24

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 (54) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/commonjs/hooks/push/useIosCallKeepEventsSetupEffect.js +5 -0
  3. package/dist/commonjs/hooks/push/useIosCallKeepEventsSetupEffect.js.map +1 -1
  4. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +16 -0
  5. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -1
  6. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +61 -26
  7. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  8. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +3 -0
  9. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -1
  10. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js +2 -0
  11. package/dist/commonjs/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -1
  12. package/dist/commonjs/utils/push/android.js +37 -4
  13. package/dist/commonjs/utils/push/android.js.map +1 -1
  14. package/dist/commonjs/utils/push/internal/utils.js +4 -1
  15. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  16. package/dist/commonjs/utils/push/ios.js +32 -8
  17. package/dist/commonjs/utils/push/ios.js.map +1 -1
  18. package/dist/commonjs/version.js +1 -1
  19. package/dist/module/hooks/push/useIosCallKeepEventsSetupEffect.js +6 -1
  20. package/dist/module/hooks/push/useIosCallKeepEventsSetupEffect.js.map +1 -1
  21. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +17 -1
  22. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -1
  23. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +63 -28
  24. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  25. package/dist/module/hooks/push/useProcessPushCallEffect.js +3 -0
  26. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -1
  27. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js +2 -0
  28. package/dist/module/hooks/push/useProcessPushNonRingingCallEffect.js.map +1 -1
  29. package/dist/module/utils/push/android.js +37 -4
  30. package/dist/module/utils/push/android.js.map +1 -1
  31. package/dist/module/utils/push/internal/utils.js +4 -1
  32. package/dist/module/utils/push/internal/utils.js.map +1 -1
  33. package/dist/module/utils/push/ios.js +32 -8
  34. package/dist/module/utils/push/ios.js.map +1 -1
  35. package/dist/module/version.js +1 -1
  36. package/dist/typescript/hooks/push/useIosCallKeepEventsSetupEffect.d.ts.map +1 -1
  37. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -1
  38. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  39. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -1
  40. package/dist/typescript/hooks/push/useProcessPushNonRingingCallEffect.d.ts.map +1 -1
  41. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  42. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  43. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  44. package/dist/typescript/version.d.ts +1 -1
  45. package/package.json +3 -3
  46. package/src/hooks/push/useIosCallKeepEventsSetupEffect.ts +9 -1
  47. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +35 -1
  48. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +103 -22
  49. package/src/hooks/push/useProcessPushCallEffect.ts +10 -1
  50. package/src/hooks/push/useProcessPushNonRingingCallEffect.ts +5 -0
  51. package/src/utils/push/android.ts +90 -4
  52. package/src/utils/push/internal/utils.ts +13 -1
  53. package/src/utils/push/ios.ts +68 -5
  54. package/src/version.ts +1 -1
@@ -27,6 +27,8 @@ function processNonRingingNotificationStreamPayload(
27
27
  ) {
28
28
  const cid = streamPayload.call_cid;
29
29
  const type = streamPayload.type;
30
+ const logger = getLogger(['processNonRingingNotificationStreamPayload']);
31
+ logger('trace', `cid, type - ${cid}, ${type}`);
30
32
  pushNonRingingCallData$.next({ cid, type });
31
33
  return { cid, type };
32
34
  }
@@ -44,6 +46,11 @@ export const oniOSExpoNotificationEvent = (event: ExpoNotification) => {
44
46
  trigger.payload?.stream
45
47
  ) {
46
48
  const streamPayload = trigger.payload.stream as StreamPushPayload;
49
+ const logger = getLogger(['processNonRingingNotificationStreamPayload']);
50
+ logger(
51
+ 'trace',
52
+ `processNonRingingNotificationStreamPayload - ${JSON.stringify(streamPayload)}`
53
+ );
47
54
  processNonRingingNotificationStreamPayload(streamPayload);
48
55
  }
49
56
  }
@@ -65,6 +72,11 @@ export const oniOSNotifeeEvent = ({
65
72
  | undefined;
66
73
  const result = processNonRingingNotificationStreamPayload(streamPayload);
67
74
  if (result) {
75
+ const logger = getLogger(['oniOSNotifeeEvent']);
76
+ logger(
77
+ 'debug',
78
+ `onTapNonRingingCallNotification?.(${result.cid}, ${result.type})`
79
+ );
68
80
  pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
69
81
  }
70
82
  }
@@ -76,15 +88,31 @@ export function onPushNotificationiOSStreamVideoEvent(
76
88
  const pushNotificationIosLib = getPushNotificationIosLib();
77
89
  const data = notification.getData();
78
90
  const streamPayload = data?.stream as StreamPushPayload;
91
+ const logger = getLogger(['onPushNotificationiOSStreamVideoEvent']);
92
+ if (!streamPayload) {
93
+ logger(
94
+ 'trace',
95
+ `skipping process: no stream payload found in notification data - ${JSON.stringify(data)}`
96
+ );
97
+ return;
98
+ }
79
99
  const isClicked = data.userInteraction === 1;
80
100
  const pushConfig = StreamVideoRN.getConfig().push;
81
- if (!streamPayload || !isClicked || !pushConfig) {
101
+ if (!isClicked || !pushConfig) {
102
+ logger(
103
+ 'debug',
104
+ `notification.finish called and returning - isClicked: ${isClicked}, pushConfig: ${!!pushConfig}`
105
+ );
82
106
  notification.finish(pushNotificationIosLib.FetchResult.NoData);
83
107
  return;
84
108
  }
85
109
  // listen to foreground notifications
86
110
  const result = processNonRingingNotificationStreamPayload(streamPayload);
87
111
  if (result) {
112
+ logger(
113
+ 'debug',
114
+ `onTapNonRingingCallNotification?.(${result.cid}, ${result.type})`
115
+ );
88
116
  pushConfig.onTapNonRingingCallNotification?.(result.cid, result.type);
89
117
  }
90
118
  notification.finish(pushNotificationIosLib.FetchResult.NoData);
@@ -103,43 +131,78 @@ export async function initIosNonVoipToken(
103
131
  ) {
104
132
  return;
105
133
  }
134
+
135
+ const logger = getLogger(['initIosNonVoipToken']);
106
136
  const setDeviceToken = async (token: string) => {
107
137
  const userId = client.streamClient._user?.id ?? '';
108
138
  if (lastApnToken.token === token && lastApnToken.userId === userId) {
139
+ logger(
140
+ 'debug',
141
+ 'Skipped sending device token to stream as it was already sent',
142
+ token
143
+ );
109
144
  return;
110
145
  }
111
- lastApnToken = { token, userId };
112
146
  setPushLogoutCallback(async () => {
113
147
  lastApnToken = { token: '', userId: '' };
114
148
  try {
149
+ logger('debug', 'Remove device token - setPushLogoutCallback', token);
115
150
  await client.removeDevice(token);
116
151
  } catch (err) {
117
- const logger = getLogger(['initIosNonVoipToken']);
118
- logger('warn', 'Failed to remove apn token from stream', err);
152
+ logger(
153
+ 'warn',
154
+ 'setPushLogoutCallback - Failed to remove apn token from stream',
155
+ err
156
+ );
119
157
  }
120
158
  });
121
159
  const push_provider_name = pushConfig.ios.pushProviderName;
122
- await client.addDevice(token, 'apn', push_provider_name);
160
+ logger('debug', 'Add device token to stream', token);
161
+ await client
162
+ .addDevice(token, 'apn', push_provider_name)
163
+ .then(() => {
164
+ lastApnToken = { token, userId };
165
+ })
166
+ .catch((err) => {
167
+ logger('warn', 'Failed to add apn token to stream', err);
168
+ });
123
169
  };
124
170
  if (pushConfig.isExpo) {
125
171
  const expoNotificationsLib = getExpoNotificationsLib();
126
172
  expoNotificationsLib.getDevicePushTokenAsync().then((devicePushToken) => {
173
+ logger(
174
+ 'debug',
175
+ 'Got device token - expoNotificationsLib.getDevicePushTokenAsync',
176
+ devicePushToken.data
177
+ );
127
178
  setDeviceToken(devicePushToken.data);
128
179
  });
129
180
  const subscription = expoNotificationsLib.addPushTokenListener(
130
181
  (devicePushToken) => {
182
+ logger(
183
+ 'debug',
184
+ 'Got device token - expoNotificationsLib.addPushTokenListener',
185
+ devicePushToken.data
186
+ );
131
187
  setDeviceToken(devicePushToken.data);
132
188
  }
133
189
  );
134
190
  setUnsubscribeListener(() => {
191
+ logger('debug', `removed expo addPushTokenListener`);
135
192
  subscription.remove();
136
193
  });
137
194
  } else {
138
195
  const pushNotificationIosLib = getPushNotificationIosLib();
139
196
  pushNotificationIosLib.addEventListener('register', (token) => {
197
+ logger(
198
+ 'debug',
199
+ `Got device token - pushNotificationIosLib.addEventListener('register')`,
200
+ token
201
+ );
140
202
  setDeviceToken(token);
141
203
  });
142
204
  setUnsubscribeListener(() => {
205
+ logger('debug', `pushNotificationIosLib.removeEventListener('register')`);
143
206
  pushNotificationIosLib.removeEventListener('register');
144
207
  });
145
208
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.9.23';
1
+ export const version = '1.9.24';