@stream-io/video-react-native-sdk 1.19.1 → 1.20.1-alpha.1

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 (61) hide show
  1. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +10 -1
  2. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  3. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer.js +3 -2
  4. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer.js.map +1 -1
  5. package/dist/commonjs/contexts/BackgroundFilters.js +4 -0
  6. package/dist/commonjs/contexts/BackgroundFilters.js.map +1 -1
  7. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +31 -12
  8. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  9. package/dist/commonjs/hooks/useTrackDimensions.js +31 -35
  10. package/dist/commonjs/hooks/useTrackDimensions.js.map +1 -1
  11. package/dist/commonjs/providers/StreamCall/DeviceStats.js +19 -8
  12. package/dist/commonjs/providers/StreamCall/DeviceStats.js.map +1 -1
  13. package/dist/commonjs/utils/StreamVideoRN/index.js +22 -6
  14. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  15. package/dist/commonjs/version.js +1 -1
  16. package/dist/commonjs/version.js.map +1 -1
  17. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js +10 -1
  18. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  19. package/dist/module/components/Participant/ParticipantView/VideoRenderer.js +3 -2
  20. package/dist/module/components/Participant/ParticipantView/VideoRenderer.js.map +1 -1
  21. package/dist/module/contexts/BackgroundFilters.js +4 -0
  22. package/dist/module/contexts/BackgroundFilters.js.map +1 -1
  23. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +31 -12
  24. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  25. package/dist/module/hooks/useTrackDimensions.js +30 -35
  26. package/dist/module/hooks/useTrackDimensions.js.map +1 -1
  27. package/dist/module/providers/StreamCall/DeviceStats.js +20 -9
  28. package/dist/module/providers/StreamCall/DeviceStats.js.map +1 -1
  29. package/dist/module/utils/StreamVideoRN/index.js +23 -6
  30. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  31. package/dist/module/version.js +1 -1
  32. package/dist/module/version.js.map +1 -1
  33. package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts.map +1 -1
  34. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer.d.ts.map +1 -1
  35. package/dist/typescript/contexts/BackgroundFilters.d.ts.map +1 -1
  36. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  37. package/dist/typescript/hooks/useTrackDimensions.d.ts +2 -2
  38. package/dist/typescript/hooks/useTrackDimensions.d.ts.map +1 -1
  39. package/dist/typescript/providers/StreamCall/DeviceStats.d.ts.map +1 -1
  40. package/dist/typescript/utils/StreamVideoRN/index.d.ts +6 -2
  41. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  42. package/dist/typescript/utils/StreamVideoRN/types.d.ts +6 -1
  43. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  44. package/dist/typescript/version.d.ts +1 -1
  45. package/dist/typescript/version.d.ts.map +1 -1
  46. package/expo-config-plugin/dist/withMainActivity.js +6 -1
  47. package/ios/RTCViewPip.swift +11 -21
  48. package/ios/RTCViewPipManager.swift +4 -17
  49. package/ios/StreamVideoReactNative.xcodeproj/project.xcworkspace/xcuserdata/santhoshvaiyapuri.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  50. package/ios/StreamVideoReactNative.xcodeproj/xcuserdata/santhoshvaiyapuri.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  51. package/package.json +8 -8
  52. package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +12 -5
  53. package/src/components/Participant/ParticipantView/VideoRenderer.tsx +7 -2
  54. package/src/contexts/BackgroundFilters.tsx +4 -0
  55. package/src/hooks/useAndroidKeepCallAliveEffect.ts +30 -10
  56. package/src/hooks/useTrackDimensions.ts +51 -34
  57. package/src/providers/StreamCall/DeviceStats.tsx +20 -9
  58. package/src/utils/StreamVideoRN/index.ts +41 -6
  59. package/src/utils/StreamVideoRN/types.ts +6 -0
  60. package/src/version.ts +1 -1
  61. package/CHANGELOG.md +0 -2594
@@ -1,4 +1,4 @@
1
- import { useCallStateHooks } from '@stream-io/video-react-bindings';
1
+ import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
2
2
  import { useEffect } from 'react';
3
3
  import {
4
4
  CallingState,
@@ -17,28 +17,39 @@ const eventEmitter = NativeModules?.StreamVideoReactNative
17
17
  export const DeviceStats = () => {
18
18
  const { useCallCallingState } = useCallStateHooks();
19
19
  const callingState = useCallCallingState();
20
+ const call = useCall();
20
21
 
21
22
  useEffect(() => {
22
- if (callingState !== CallingState.JOINED) {
23
- return;
24
- }
23
+ if (!call || callingState !== CallingState.JOINED) return;
25
24
 
26
25
  NativeModules?.StreamVideoReactNative.isLowPowerModeEnabled().then(
27
- (initialPowerMode: boolean) => setPowerState(initialPowerMode),
26
+ (initialPowerMode: boolean) => {
27
+ setPowerState(initialPowerMode);
28
+ call.tracer.trace('device.lowPowerMode', initialPowerMode);
29
+ },
28
30
  );
29
31
 
30
32
  const powerModeSubscription = eventEmitter?.addListener(
31
33
  'isLowPowerModeEnabled',
32
- (isLowPowerMode: boolean) => setPowerState(isLowPowerMode),
34
+ (isLowPowerMode: boolean) => {
35
+ setPowerState(isLowPowerMode);
36
+ call.tracer.trace('device.lowPowerMode', isLowPowerMode);
37
+ },
33
38
  );
34
39
 
35
40
  NativeModules?.StreamVideoReactNative.currentThermalState().then(
36
- (initialState: string) => setThermalState(initialState),
41
+ (initialState: string) => {
42
+ setThermalState(initialState);
43
+ call.tracer.trace('device.thermalState', initialState);
44
+ },
37
45
  );
38
46
 
39
47
  const thermalStateSubscription = eventEmitter?.addListener(
40
48
  'thermalStateDidChange',
41
- (thermalState: string) => setThermalState(thermalState),
49
+ (thermalState: string) => {
50
+ setThermalState(thermalState);
51
+ call.tracer.trace('device.thermalStateChanged', thermalState);
52
+ },
42
53
  );
43
54
 
44
55
  // on android we need to explicitly start and stop the thermal status updates
@@ -53,7 +64,7 @@ export const DeviceStats = () => {
53
64
  NativeModules?.StreamVideoReactNative.stopThermalStatusUpdates();
54
65
  }
55
66
  };
56
- }, [callingState]);
67
+ }, [call, callingState]);
57
68
 
58
69
  return null;
59
70
  };
@@ -6,6 +6,41 @@ import newNotificationCallbacks, {
6
6
  import { setupIosCallKeepEvents } from '../push/setupIosCallKeepEvents';
7
7
  import { setupIosVoipPushEvents } from '../push/setupIosVoipPushEvents';
8
8
 
9
+ // Utility type for deep partial
10
+ type DeepPartial<T> = {
11
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
12
+ };
13
+
14
+ // Helper function for deep merging
15
+ function deepMerge<T extends Record<string, any>>(
16
+ target: T,
17
+ source: DeepPartial<T>,
18
+ ): T {
19
+ const result = { ...target };
20
+
21
+ for (const key in source) {
22
+ if (source[key] !== undefined) {
23
+ if (
24
+ typeof source[key] === 'object' &&
25
+ source[key] !== null &&
26
+ !Array.isArray(source[key]) &&
27
+ typeof target[key] === 'object' &&
28
+ target[key] !== null &&
29
+ !Array.isArray(target[key])
30
+ ) {
31
+ result[key] = deepMerge(
32
+ target[key],
33
+ source[key] as DeepPartial<T[typeof key]>,
34
+ );
35
+ } else {
36
+ result[key] = source[key] as T[typeof key];
37
+ }
38
+ }
39
+ }
40
+
41
+ return result;
42
+ }
43
+
9
44
  const DEFAULT_STREAM_VIDEO_CONFIG: StreamVideoConfig = {
10
45
  foregroundService: {
11
46
  android: {
@@ -20,6 +55,7 @@ const DEFAULT_STREAM_VIDEO_CONFIG: StreamVideoConfig = {
20
55
  title: 'Call in progress',
21
56
  body: 'Tap to return to the call',
22
57
  },
58
+ taskToRun: () => new Promise(() => {}),
23
59
  },
24
60
  },
25
61
  };
@@ -30,13 +66,12 @@ export class StreamVideoRN {
30
66
  /**
31
67
  * Update the global config for StreamVideoRN except for push config.
32
68
  * To set push config use `StreamVideoRN.setPushConfig` instead.
33
- * This function accepts a partial config object that will be merged with the default config.
69
+ * This function accepts a partial config object that will be deeply merged with the default config.
34
70
  */
35
- static updateConfig(updateConfig: Partial<Omit<StreamVideoConfig, 'push'>>) {
36
- this.config = {
37
- ...this.config,
38
- ...updateConfig,
39
- };
71
+ static updateConfig(
72
+ updateConfig: DeepPartial<Omit<StreamVideoConfig, 'push'>>,
73
+ ) {
74
+ this.config = deepMerge(this.config, updateConfig);
40
75
  }
41
76
 
42
77
  static updateAndroidIncomingCallChannel(
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type ClientPublishOptions,
3
3
  StreamVideoClient,
4
+ type Call,
4
5
  } from '@stream-io/video-client';
5
6
  import type { AndroidChannel } from '@notifee/react-native';
6
7
 
@@ -154,6 +155,11 @@ export type StreamVideoConfig = {
154
155
  title: string;
155
156
  body: string;
156
157
  };
158
+ /**
159
+ * The task to run in the foreground service
160
+ * The task must resolve a promise once complete
161
+ */
162
+ taskToRun: (call: Call) => Promise<void>;
157
163
  };
158
164
  };
159
165
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.19.1';
1
+ export const version = '1.20.1-alpha.1';