@fishjam-cloud/react-native-client 0.5.0 → 0.7.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 (124) hide show
  1. package/README.md +6 -6
  2. package/android/build.gradle +6 -2
  3. package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +17 -16
  4. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +64 -49
  5. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +16 -24
  6. package/build/RNFishjamClientModule.d.ts +44 -11
  7. package/build/RNFishjamClientModule.d.ts.map +1 -1
  8. package/build/RNFishjamClientModule.js +18 -4
  9. package/build/RNFishjamClientModule.js.map +1 -1
  10. package/build/common/client.d.ts +3 -8
  11. package/build/common/client.d.ts.map +1 -1
  12. package/build/common/client.js +2 -6
  13. package/build/common/client.js.map +1 -1
  14. package/build/common/metadata.d.ts +2 -1
  15. package/build/common/metadata.d.ts.map +1 -1
  16. package/build/common/metadata.js +2 -1
  17. package/build/common/metadata.js.map +1 -1
  18. package/build/components/FishjamRoom/index.d.ts +21 -0
  19. package/build/components/FishjamRoom/index.d.ts.map +1 -1
  20. package/build/components/FishjamRoom/index.js +16 -1
  21. package/build/components/FishjamRoom/index.js.map +1 -1
  22. package/build/components/FishjamRoom/parsePeersToTracks.d.ts.map +1 -1
  23. package/build/components/FishjamRoom/parsePeersToTracks.js +4 -6
  24. package/build/components/FishjamRoom/parsePeersToTracks.js.map +1 -1
  25. package/build/components/VideoPreviewView.d.ts +7 -3
  26. package/build/components/VideoPreviewView.d.ts.map +1 -1
  27. package/build/components/VideoPreviewView.js +5 -1
  28. package/build/components/VideoPreviewView.js.map +1 -1
  29. package/build/components/VideoRendererView.d.ts +13 -0
  30. package/build/components/VideoRendererView.d.ts.map +1 -1
  31. package/build/components/VideoRendererView.js +13 -0
  32. package/build/components/VideoRendererView.js.map +1 -1
  33. package/build/debug/stats/useRTCStatistics.d.ts.map +1 -1
  34. package/build/debug/stats/useRTCStatistics.js +13 -13
  35. package/build/debug/stats/useRTCStatistics.js.map +1 -1
  36. package/build/hooks/internal/useFishjamEvent.d.ts +4 -0
  37. package/build/hooks/internal/useFishjamEvent.d.ts.map +1 -0
  38. package/build/hooks/internal/useFishjamEvent.js +35 -0
  39. package/build/hooks/internal/useFishjamEvent.js.map +1 -0
  40. package/build/hooks/internal/useFishjamEventState.d.ts +3 -0
  41. package/build/hooks/internal/useFishjamEventState.d.ts.map +1 -0
  42. package/build/hooks/{useFishjamEventState.js → internal/useFishjamEventState.js} +3 -1
  43. package/build/hooks/internal/useFishjamEventState.js.map +1 -0
  44. package/build/hooks/useAppScreenShare.d.ts +9 -0
  45. package/build/hooks/useAppScreenShare.d.ts.map +1 -1
  46. package/build/hooks/useAppScreenShare.js +14 -14
  47. package/build/hooks/useAppScreenShare.js.map +1 -1
  48. package/build/hooks/useAudioSettings.d.ts +4 -0
  49. package/build/hooks/useAudioSettings.d.ts.map +1 -1
  50. package/build/hooks/useAudioSettings.js +8 -11
  51. package/build/hooks/useAudioSettings.js.map +1 -1
  52. package/build/hooks/useBandwidthEstimation.d.ts +3 -0
  53. package/build/hooks/useBandwidthEstimation.d.ts.map +1 -1
  54. package/build/hooks/useBandwidthEstimation.js +9 -5
  55. package/build/hooks/useBandwidthEstimation.js.map +1 -1
  56. package/build/hooks/useCamera.d.ts +11 -33
  57. package/build/hooks/useCamera.d.ts.map +1 -1
  58. package/build/hooks/useCamera.js +18 -68
  59. package/build/hooks/useCamera.js.map +1 -1
  60. package/build/hooks/useConnection.d.ts +58 -0
  61. package/build/hooks/useConnection.d.ts.map +1 -0
  62. package/build/hooks/useConnection.js +39 -0
  63. package/build/hooks/useConnection.js.map +1 -0
  64. package/build/hooks/useForegroundService.d.ts +20 -11
  65. package/build/hooks/useForegroundService.d.ts.map +1 -1
  66. package/build/hooks/useForegroundService.js +2 -3
  67. package/build/hooks/useForegroundService.js.map +1 -1
  68. package/build/hooks/useMicrophone.d.ts.map +1 -1
  69. package/build/hooks/useMicrophone.js +2 -3
  70. package/build/hooks/useMicrophone.js.map +1 -1
  71. package/build/hooks/usePeerStatus.d.ts +3 -12
  72. package/build/hooks/usePeerStatus.d.ts.map +1 -1
  73. package/build/hooks/usePeerStatus.js +5 -10
  74. package/build/hooks/usePeerStatus.js.map +1 -1
  75. package/build/hooks/usePeers.d.ts +19 -22
  76. package/build/hooks/usePeers.d.ts.map +1 -1
  77. package/build/hooks/usePeers.js +21 -20
  78. package/build/hooks/usePeers.js.map +1 -1
  79. package/build/hooks/useReconnection.d.ts +3 -3
  80. package/build/hooks/useReconnection.d.ts.map +1 -1
  81. package/build/hooks/useReconnection.js +5 -10
  82. package/build/hooks/useReconnection.js.map +1 -1
  83. package/build/hooks/useScreenShare.d.ts +2 -23
  84. package/build/hooks/useScreenShare.d.ts.map +1 -1
  85. package/build/hooks/useScreenShare.js +6 -45
  86. package/build/hooks/useScreenShare.js.map +1 -1
  87. package/build/hooks/useUpdatePeerMetadata.d.ts +15 -0
  88. package/build/hooks/useUpdatePeerMetadata.d.ts.map +1 -0
  89. package/build/hooks/useUpdatePeerMetadata.js +21 -0
  90. package/build/hooks/useUpdatePeerMetadata.js.map +1 -0
  91. package/build/index.d.ts +21 -16
  92. package/build/index.d.ts.map +1 -1
  93. package/build/index.js +15 -6
  94. package/build/index.js.map +1 -1
  95. package/build/types.d.ts +0 -19
  96. package/build/types.d.ts.map +1 -1
  97. package/build/types.js.map +1 -1
  98. package/build/utils/errorListener.d.ts.map +1 -1
  99. package/build/utils/errorListener.js +2 -3
  100. package/build/utils/errorListener.js.map +1 -1
  101. package/build/utils/eventPayloadValidator.d.ts +3 -0
  102. package/build/utils/eventPayloadValidator.d.ts.map +1 -0
  103. package/build/utils/eventPayloadValidator.js +94 -0
  104. package/build/utils/eventPayloadValidator.js.map +1 -0
  105. package/ios/Events.swift +8 -8
  106. package/ios/RNFishjamClient.podspec +1 -1
  107. package/ios/RNFishjamClient.swift +45 -48
  108. package/ios/RNFishjamClientModule.swift +13 -14
  109. package/ios/Utils.swift +0 -20
  110. package/package.json +21 -13
  111. package/plugin/build/withFishjamAndroid.js +18 -20
  112. package/plugin/build/withFishjamIos.js +116 -110
  113. package/build/common/webRTC.d.ts +0 -14
  114. package/build/common/webRTC.d.ts.map +0 -1
  115. package/build/common/webRTC.js +0 -15
  116. package/build/common/webRTC.js.map +0 -1
  117. package/build/hooks/useFishjamEvent.d.ts +0 -18
  118. package/build/hooks/useFishjamEvent.d.ts.map +0 -1
  119. package/build/hooks/useFishjamEvent.js +0 -27
  120. package/build/hooks/useFishjamEvent.js.map +0 -1
  121. package/build/hooks/useFishjamEventState.d.ts +0 -3
  122. package/build/hooks/useFishjamEventState.d.ts.map +0 -1
  123. package/build/hooks/useFishjamEventState.js.map +0 -1
  124. /package/{LICENSE → LICENSE.txt} +0 -0
@@ -3,9 +3,6 @@ import ExpoModulesCore
3
3
  struct RNSimulcastConfig: Record {
4
4
  @Field
5
5
  var enabled: Bool = false
6
-
7
- @Field
8
- var activeEncodings: [String] = []
9
6
  }
10
7
 
11
8
  struct CameraConfig: Record {
@@ -21,9 +18,6 @@ struct CameraConfig: Record {
21
18
  @Field
22
19
  var simulcastConfig: RNSimulcastConfig = RNSimulcastConfig()
23
20
 
24
- @Field
25
- var maxBandwidth: RNTrackBandwidthLimit = RNTrackBandwidthLimit(0)
26
-
27
21
  @Field
28
22
  var cameraEnabled: Bool = true
29
23
 
@@ -48,9 +42,6 @@ struct ScreenShareOptions: Record {
48
42
 
49
43
  @Field
50
44
  var simulcastConfig: RNSimulcastConfig = RNSimulcastConfig()
51
-
52
- @Field
53
- var maxBandwidth: RNTrackBandwidthLimit = RNTrackBandwidthLimit(0)
54
45
  }
55
46
 
56
47
  struct ReconnectConfig: Record {
@@ -90,6 +81,10 @@ public class RNFishjamClientModule: Module {
90
81
  return rnFishjamClient.peerStatus.rawValue
91
82
  }
92
83
 
84
+ Property("reconnectionStatus") {
85
+ return rnFishjamClient.reconnectionStatus.rawValue
86
+ }
87
+
93
88
  Property("isMicrophoneOn") {
94
89
  return rnFishjamClient.isMicrophoneOn
95
90
  }
@@ -114,6 +109,14 @@ public class RNFishjamClientModule: Module {
114
109
  return rnFishjamClient.isAppScreenShareOn
115
110
  }
116
111
 
112
+ Property("isCameraInitialized") {
113
+ return rnFishjamClient.isCameraInitialized
114
+ }
115
+
116
+ Function("getPeers") {
117
+ return rnFishjamClient.getPeers()
118
+ }
119
+
117
120
  AsyncFunction("joinRoom") {
118
121
  (
119
122
  url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
@@ -156,10 +159,6 @@ public class RNFishjamClientModule: Module {
156
159
  try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
157
160
  }
158
161
 
159
- AsyncFunction("getPeers") {
160
- try rnFishjamClient.getPeers()
161
- }
162
-
163
162
  AsyncFunction("updatePeerMetadata") { (metadata: [String: Any]) in
164
163
  try rnFishjamClient.updatePeerMetadata(metadata: metadata)
165
164
  }
@@ -207,7 +206,7 @@ public class RNFishjamClientModule: Module {
207
206
  }
208
207
 
209
208
  AsyncFunction("getStatistics") {
210
- try rnFishjamClient.getStatistics()
209
+ try await rnFishjamClient.getStatistics()
211
210
  }
212
211
 
213
212
  AsyncFunction("selectAudioSessionMode") { (sessionMode: String) in
package/ios/Utils.swift CHANGED
@@ -21,23 +21,3 @@ let log = OSLog(subsystem: "com.fishjamcloud.react-native-client", category: "Er
21
21
  }
22
22
  }
23
23
  #endif
24
-
25
- extension [String: Any] {
26
- public func toMetadata() -> Metadata {
27
- var res: Metadata = .init()
28
- self.forEach { entry in
29
- res[entry.key] = entry.value
30
- }
31
- return res
32
- }
33
- }
34
-
35
- extension AnyJson {
36
- public func toDict() -> [String: Any] {
37
- var res: [String: Any] = [:]
38
- self.keys.forEach { key in
39
- res[key] = self[key]
40
- }
41
- return res
42
- }
43
- }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/react-native-client",
3
- "version": "0.5.0",
4
- "description": "A React Native client for Fishjam Cloud",
5
- "author": "Fishjam Cloud Team",
3
+ "version": "0.7.0",
4
+ "description": "A React Native client for Fishjam",
5
+ "author": "Fishjam Team",
6
6
  "license": "Apache-2.0",
7
7
  "main": "build/index.js",
8
8
  "types": "build/index.d.ts",
@@ -22,6 +22,7 @@
22
22
  "keywords": [
23
23
  "react-native",
24
24
  "expo",
25
+ "Fishjam",
25
26
  "FishjamCloud",
26
27
  "MembraneWebRTC",
27
28
  "webRTC",
@@ -41,7 +42,8 @@
41
42
  "dependencies": {
42
43
  "phoenix": "^1.7.6",
43
44
  "promise-fs": "^2.1.1",
44
- "protobufjs": "^7.4.0"
45
+ "protobufjs": "^7.4.0",
46
+ "zod": "^3.24.1"
45
47
  },
46
48
  "devDependencies": {
47
49
  "@testing-library/dom": "^10.4.0",
@@ -50,22 +52,21 @@
50
52
  "@types/phoenix": "^1.6.5",
51
53
  "@types/promise-fs": "^2.1.2",
52
54
  "@types/react": "^18.3.12",
53
- "expo-module-scripts": "^3.5.2",
54
- "husky": "^9.1.6",
55
+ "expo-module-scripts": "^4.0.2",
56
+ "husky": "^9.1.7",
55
57
  "jest": "^29.6.1",
56
58
  "jest-environment-jsdom": "^29.6.1",
57
- "jest-expo": "^51.0.4",
59
+ "jest-expo": "~52.0.2",
58
60
  "jest-websocket-mock": "^2.4.0",
59
- "pod-install": "^0.2.0",
61
+ "pod-install": "^0.3.2",
60
62
  "react-dom": "^18.3.1",
61
- "ts-proto": "^2.2.5",
62
- "typedoc": "^0.26.11",
63
+ "ts-proto": "^2.6.0",
64
+ "typedoc": "^0.27.4",
63
65
  "typedoc-plugin-mark-react-functional-components": "^0.2.2",
64
- "typescript": "^5.6.3"
66
+ "typescript": "^5.7.2"
65
67
  },
66
68
  "peerDependencies": {
67
69
  "expo": "*",
68
- "expo-modules-core": "*",
69
70
  "react": "*",
70
71
  "react-native": "*"
71
72
  },
@@ -90,5 +91,12 @@
90
91
  "expo-module.config.json",
91
92
  "README.md",
92
93
  "!**/node_modules"
93
- ]
94
+ ],
95
+ "expo": {
96
+ "doctor": {
97
+ "reactNativeDirectoryCheck": {
98
+ "listUnknownPackages": false
99
+ }
100
+ }
101
+ }
94
102
  }
@@ -3,26 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withFishjamAndroid = void 0;
4
4
  const config_plugins_1 = require("@expo/config-plugins");
5
5
  const Manifest_1 = require("@expo/config-plugins/build/android/Manifest");
6
- const withFishjamForegroundService = (config) => {
7
- return (0, config_plugins_1.withAndroidManifest)(config, async (config) => {
8
- const mainApplication = (0, Manifest_1.getMainApplicationOrThrow)(config.modResults);
9
- mainApplication.service = mainApplication.service || [];
10
- const newService = {
11
- $: {
12
- 'android:name': 'io.fishjam.reactnative.foregroundService.FishjamForegroundService',
13
- 'android:foregroundServiceType': 'camera|microphone|mediaProjection',
14
- },
15
- };
16
- const existingServiceIndex = mainApplication.service.findIndex((service) => service.$['android:name'] === newService.$['android:name']);
17
- if (existingServiceIndex !== -1) {
18
- mainApplication.service[existingServiceIndex] = newService;
19
- }
20
- else {
21
- mainApplication.service.push(newService);
22
- }
23
- return config;
24
- });
25
- };
6
+ const withFishjamForegroundService = (config) => (0, config_plugins_1.withAndroidManifest)(config, async (configuration) => {
7
+ const mainApplication = (0, Manifest_1.getMainApplicationOrThrow)(configuration.modResults);
8
+ mainApplication.service = mainApplication.service || [];
9
+ const newService = {
10
+ $: {
11
+ 'android:name': 'io.fishjam.reactnative.foregroundService.FishjamForegroundService',
12
+ 'android:foregroundServiceType': 'camera|microphone|mediaProjection',
13
+ },
14
+ };
15
+ const existingServiceIndex = mainApplication.service.findIndex((service) => service.$['android:name'] === newService.$['android:name']);
16
+ if (existingServiceIndex !== -1) {
17
+ mainApplication.service[existingServiceIndex] = newService;
18
+ }
19
+ else {
20
+ mainApplication.service.push(newService);
21
+ }
22
+ return configuration;
23
+ });
26
24
  const withFishjamAndroid = (config, props) => {
27
25
  if (props?.android?.enableForegroundService) {
28
26
  config = withFishjamForegroundService(config);
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.SBE_PODFILE_SNIPPET = void 0;
27
37
  // ios-related code was mostly copied from OneSignal expo plugin: https://github.com/OneSignal/onesignal-expo-plugin/blob/main/onesignal/withOneSignalIos.ts
@@ -34,7 +44,7 @@ target '${SBE_TARGET_NAME}' do
34
44
  pod 'FishjamCloudClient/Broadcast'
35
45
  end`;
36
46
  const TARGETED_DEVICE_FAMILY = `"1,2"`;
37
- const IPHONEOS_DEPLOYMENT_TARGET = '13.4';
47
+ const IPHONEOS_DEPLOYMENT_TARGET = '15.1';
38
48
  const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
39
49
  const BUNDLE_IDENTIFIER_TEMPLATE_REGEX = /{{BUNDLE_IDENTIFIER}}/gm;
40
50
  /**
@@ -95,113 +105,109 @@ const withAppGroupPermissions = (config) => {
95
105
  * Adds constants to Info.plist
96
106
  * In other to dynamically retreive extension's bundleId and group name we need to store it in Info.plist.
97
107
  */
98
- const withInfoPlistConstants = (config) => {
99
- return (0, config_plugins_1.withInfoPlist)(config, (config) => {
100
- const bundleIdentifier = config.ios?.bundleIdentifier || '';
101
- config.modResults['AppGroupName'] = `group.${bundleIdentifier}`;
102
- config.modResults['ScreenShareExtensionBundleId'] =
103
- `${bundleIdentifier}.${SBE_TARGET_NAME}`;
104
- return config;
105
- });
106
- };
108
+ const withInfoPlistConstants = (config) => (0, config_plugins_1.withInfoPlist)(config, (configuration) => {
109
+ const bundleIdentifier = configuration.ios?.bundleIdentifier || '';
110
+ configuration.modResults['AppGroupName'] = `group.${bundleIdentifier}`;
111
+ configuration.modResults['ScreenShareExtensionBundleId'] =
112
+ `${bundleIdentifier}.${SBE_TARGET_NAME}`;
113
+ return configuration;
114
+ });
107
115
  /**
108
116
  * Updates and copies required extension files.
109
117
  * Our extension needs to be properly setup inside the Xcode project. In order to do that we need to copy the files and update the pbxproj.
110
118
  */
111
- const withFishjamSBE = (config, options) => {
112
- return (0, config_plugins_1.withXcodeProject)(config, async (props) => {
113
- const appName = props.modRequest.projectName || '';
114
- const iosPath = props.modRequest.platformProjectRoot;
115
- const bundleIdentifier = props.ios?.bundleIdentifier;
116
- const xcodeProject = props.modResults;
117
- const pluginDir = require.resolve('@fishjam-cloud/react-native-client/package.json');
118
- const extensionSourceDir = path.join(pluginDir, '../plugin/broadcastExtensionFiles/');
119
- await updatePodfile(iosPath);
120
- const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
121
- const extFiles = [
122
- 'FishjamBroadcastSampleHandler.swift',
123
- `${SBE_TARGET_NAME}.entitlements`,
124
- `Info.plist`,
125
- ];
126
- await xcodeProject.parse(async function (err) {
127
- if (err) {
128
- console.error(`Error parsing iOS project: ${JSON.stringify(err)}`);
129
- return;
130
- }
131
- if (xcodeProject.pbxTargetByName(SBE_TARGET_NAME)) {
132
- console.log(`${SBE_TARGET_NAME} already exists in project. Skipping...`);
133
- return;
134
- }
135
- try {
136
- // copy extension files
137
- await fs.mkdir(`${iosPath}/${SBE_TARGET_NAME}`, { recursive: true });
138
- for (let i = 0; i < extFiles.length; i++) {
139
- const extFile = extFiles[i];
140
- const targetFile = `${iosPath}/${SBE_TARGET_NAME}/${extFile}`;
141
- await fs.copyFile(`${extensionSourceDir}${extFile}`, targetFile);
142
- }
143
- }
144
- catch (e) {
145
- console.error('Error copying extension files: ', e);
119
+ const withFishjamSBE = (config, options) => (0, config_plugins_1.withXcodeProject)(config, async (props) => {
120
+ const appName = props.modRequest.projectName || '';
121
+ const iosPath = props.modRequest.platformProjectRoot;
122
+ const bundleIdentifier = props.ios?.bundleIdentifier;
123
+ const xcodeProject = props.modResults;
124
+ const pluginDir = require.resolve('@fishjam-cloud/react-native-client/package.json');
125
+ const extensionSourceDir = path.join(pluginDir, '../plugin/broadcastExtensionFiles/');
126
+ await updatePodfile(iosPath);
127
+ const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
128
+ const extFiles = [
129
+ 'FishjamBroadcastSampleHandler.swift',
130
+ `${SBE_TARGET_NAME}.entitlements`,
131
+ `Info.plist`,
132
+ ];
133
+ await xcodeProject.parse(async function (err) {
134
+ if (err) {
135
+ console.error(`Error parsing iOS project: ${JSON.stringify(err)}`);
136
+ return;
137
+ }
138
+ if (xcodeProject.pbxTargetByName(SBE_TARGET_NAME)) {
139
+ console.log(`${SBE_TARGET_NAME} already exists in project. Skipping...`);
140
+ return;
141
+ }
142
+ try {
143
+ // copy extension files
144
+ await fs.mkdir(`${iosPath}/${SBE_TARGET_NAME}`, { recursive: true });
145
+ for (let i = 0; i < extFiles.length; i++) {
146
+ const extFile = extFiles[i];
147
+ const targetFile = `${iosPath}/${SBE_TARGET_NAME}/${extFile}`;
148
+ await fs.copyFile(`${extensionSourceDir}${extFile}`, targetFile);
146
149
  }
147
- // update extension files
148
- await updateFileWithRegex(iosPath, `${SBE_TARGET_NAME}.entitlements`, GROUP_IDENTIFIER_TEMPLATE_REGEX, `group.${bundleIdentifier}`);
149
- await updateFileWithRegex(iosPath, 'FishjamBroadcastSampleHandler.swift', GROUP_IDENTIFIER_TEMPLATE_REGEX, `group.${bundleIdentifier}`);
150
- await updateFileWithRegex(iosPath, 'FishjamBroadcastSampleHandler.swift', BUNDLE_IDENTIFIER_TEMPLATE_REGEX, bundleIdentifier || '');
151
- // Create new PBXGroup for the extension
152
- const extGroup = xcodeProject.addPbxGroup(extFiles, SBE_TARGET_NAME, SBE_TARGET_NAME);
153
- // Add the new PBXGroup to the top level group. This makes the
154
- // files / folder appear in the file explorer in Xcode.
155
- const groups = xcodeProject.hash.project.objects['PBXGroup'];
156
- Object.keys(groups).forEach(function (key) {
157
- if (groups[key].name === undefined) {
158
- xcodeProject.addToPbxGroup(extGroup.uuid, key);
159
- }
160
- });
161
- // WORK AROUND for codeProject.addTarget BUG
162
- // Xcode projects don't contain these if there is only one target
163
- // An upstream fix should be made to the code referenced in this link:
164
- // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
165
- const projObjects = xcodeProject.hash.project.objects;
166
- projObjects['PBXTargetDependency'] =
167
- projObjects['PBXTargetDependency'] || {};
168
- projObjects['PBXContainerItemProxy'] =
169
- projObjects['PBXTargetDependency'] || {};
170
- // Add the SBE target
171
- // This adds PBXTargetDependency and PBXContainerItemProxy for you
172
- const sbeTarget = xcodeProject.addTarget(SBE_TARGET_NAME, 'app_extension', SBE_TARGET_NAME, `${bundleIdentifier}.${SBE_TARGET_NAME}`);
173
- // Add build phases to the new target
174
- xcodeProject.addBuildPhase(['FishjamBroadcastSampleHandler.swift'], 'PBXSourcesBuildPhase', 'Sources', sbeTarget.uuid);
175
- xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', sbeTarget.uuid);
176
- xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', sbeTarget.uuid);
177
- xcodeProject.addFramework('ReplayKit.framework', {
178
- target: sbeTarget.uuid,
179
- });
180
- // Edit the Deployment info of the new Target, only IphoneOS and Targeted Device Family
181
- // However, can be more
182
- const configurations = xcodeProject.pbxXCBuildConfigurationSection();
183
- for (const key in configurations) {
184
- if (typeof configurations[key].buildSettings !== 'undefined' &&
185
- configurations[key].buildSettings.PRODUCT_NAME ===
186
- `"${SBE_TARGET_NAME}"`) {
187
- const buildSettingsObj = configurations[key].buildSettings;
188
- buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
189
- options?.ios?.iphoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
190
- buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
191
- buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${SBE_TARGET_NAME}/${SBE_TARGET_NAME}.entitlements`;
192
- buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
193
- buildSettingsObj.INFOPLIST_FILE = `${SBE_TARGET_NAME}/Info.plist`;
194
- buildSettingsObj.SWIFT_VERSION = '5.0';
195
- buildSettingsObj.MARKETING_VERSION = '1.0.0';
196
- buildSettingsObj.CURRENT_PROJECT_VERSION = '1';
197
- buildSettingsObj.ENABLE_BITCODE = 'NO';
198
- }
150
+ }
151
+ catch (e) {
152
+ console.error('Error copying extension files: ', e);
153
+ }
154
+ // update extension files
155
+ await updateFileWithRegex(iosPath, `${SBE_TARGET_NAME}.entitlements`, GROUP_IDENTIFIER_TEMPLATE_REGEX, `group.${bundleIdentifier}`);
156
+ await updateFileWithRegex(iosPath, 'FishjamBroadcastSampleHandler.swift', GROUP_IDENTIFIER_TEMPLATE_REGEX, `group.${bundleIdentifier}`);
157
+ await updateFileWithRegex(iosPath, 'FishjamBroadcastSampleHandler.swift', BUNDLE_IDENTIFIER_TEMPLATE_REGEX, bundleIdentifier || '');
158
+ // Create new PBXGroup for the extension
159
+ const extGroup = xcodeProject.addPbxGroup(extFiles, SBE_TARGET_NAME, SBE_TARGET_NAME);
160
+ // Add the new PBXGroup to the top level group. This makes the
161
+ // files / folder appear in the file explorer in Xcode.
162
+ const groups = xcodeProject.hash.project.objects['PBXGroup'];
163
+ Object.keys(groups).forEach(function (key) {
164
+ if (groups[key].name === undefined) {
165
+ xcodeProject.addToPbxGroup(extGroup.uuid, key);
199
166
  }
200
- await fs.writeFile(projPath, xcodeProject.writeSync());
201
167
  });
202
- return props;
168
+ // WORK AROUND for codeProject.addTarget BUG
169
+ // Xcode projects don't contain these if there is only one target
170
+ // An upstream fix should be made to the code referenced in this link:
171
+ // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
172
+ const projObjects = xcodeProject.hash.project.objects;
173
+ projObjects['PBXTargetDependency'] =
174
+ projObjects['PBXTargetDependency'] || {};
175
+ projObjects['PBXContainerItemProxy'] =
176
+ projObjects['PBXTargetDependency'] || {};
177
+ // Add the SBE target
178
+ // This adds PBXTargetDependency and PBXContainerItemProxy for you
179
+ const sbeTarget = xcodeProject.addTarget(SBE_TARGET_NAME, 'app_extension', SBE_TARGET_NAME, `${bundleIdentifier}.${SBE_TARGET_NAME}`);
180
+ // Add build phases to the new target
181
+ xcodeProject.addBuildPhase(['FishjamBroadcastSampleHandler.swift'], 'PBXSourcesBuildPhase', 'Sources', sbeTarget.uuid);
182
+ xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', sbeTarget.uuid);
183
+ xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', sbeTarget.uuid);
184
+ xcodeProject.addFramework('ReplayKit.framework', {
185
+ target: sbeTarget.uuid,
186
+ });
187
+ // Edit the Deployment info of the new Target, only IphoneOS and Targeted Device Family
188
+ // However, can be more
189
+ const configurations = xcodeProject.pbxXCBuildConfigurationSection();
190
+ for (const key in configurations) {
191
+ if (typeof configurations[key].buildSettings !== 'undefined' &&
192
+ configurations[key].buildSettings.PRODUCT_NAME ===
193
+ `"${SBE_TARGET_NAME}"`) {
194
+ const buildSettingsObj = configurations[key].buildSettings;
195
+ buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
196
+ options?.ios?.iphoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
197
+ buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
198
+ buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${SBE_TARGET_NAME}/${SBE_TARGET_NAME}.entitlements`;
199
+ buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
200
+ buildSettingsObj.INFOPLIST_FILE = `${SBE_TARGET_NAME}/Info.plist`;
201
+ buildSettingsObj.SWIFT_VERSION = '5.0';
202
+ buildSettingsObj.MARKETING_VERSION = '1.0.0';
203
+ buildSettingsObj.CURRENT_PROJECT_VERSION = '1';
204
+ buildSettingsObj.ENABLE_BITCODE = 'NO';
205
+ }
206
+ }
207
+ await fs.writeFile(projPath, xcodeProject.writeSync());
203
208
  });
204
- };
209
+ return props;
210
+ });
205
211
  /**
206
212
  * Applies screen sharing plugin if enabled. In order for screensharing to work, we need to copy extension files to your iOS project.
207
213
  * Allows for dynamically changing deploymentTarget.
@@ -212,10 +218,10 @@ const withFishjamIos = (config, props) => {
212
218
  withInfoPlistConstants(config);
213
219
  withFishjamSBE(config, props);
214
220
  }
215
- (0, config_plugins_1.withPodfileProperties)(config, (config) => {
216
- config.modResults['ios.deploymentTarget'] =
221
+ (0, config_plugins_1.withPodfileProperties)(config, (configuration) => {
222
+ configuration.modResults['ios.deploymentTarget'] =
217
223
  props?.ios?.iphoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
218
- return config;
224
+ return configuration;
219
225
  });
220
226
  return config;
221
227
  };
@@ -1,14 +0,0 @@
1
- import { TrackEncoding } from '../types';
2
- import type { TrackId } from '../hooks/usePeers';
3
- /**
4
- * sets track encoding that server should send to the client library.
5
- * The encoding will be sent whenever it is available. If chooses encoding is
6
- * temporarily unavailable, some other encoding will be sent until choose encoding
7
- * becomes active again.
8
- *
9
- * @param trackId id of a track which encoding you want to select
10
- * @param encoding encoding to select
11
- * @category Debugging
12
- */
13
- export declare function setTargetTrackEncoding(trackId: TrackId, encoding: TrackEncoding): Promise<void>;
14
- //# sourceMappingURL=webRTC.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webRTC.d.ts","sourceRoot":"","sources":["../../src/common/webRTC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,iBAGxB"}
@@ -1,15 +0,0 @@
1
- import RNFishjamClientModule from '../RNFishjamClientModule';
2
- /**
3
- * sets track encoding that server should send to the client library.
4
- * The encoding will be sent whenever it is available. If chooses encoding is
5
- * temporarily unavailable, some other encoding will be sent until choose encoding
6
- * becomes active again.
7
- *
8
- * @param trackId id of a track which encoding you want to select
9
- * @param encoding encoding to select
10
- * @category Debugging
11
- */
12
- export async function setTargetTrackEncoding(trackId, encoding) {
13
- await RNFishjamClientModule.setTargetTrackEncoding(trackId, encoding);
14
- }
15
- //# sourceMappingURL=webRTC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webRTC.js","sourceRoot":"","sources":["../../src/common/webRTC.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAG7D;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAgB,EAChB,QAAuB;IAEvB,MAAM,qBAAqB,CAAC,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { TrackEncoding } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport type { TrackId } from '../hooks/usePeers';\n\n/**\n * sets track encoding that server should send to the client library.\n * The encoding will be sent whenever it is available. If chooses encoding is\n * temporarily unavailable, some other encoding will be sent until choose encoding\n * becomes active again.\n *\n * @param trackId id of a track which encoding you want to select\n * @param encoding encoding to select\n * @category Debugging\n */\nexport async function setTargetTrackEncoding(\n trackId: TrackId,\n encoding: TrackEncoding,\n) {\n await RNFishjamClientModule.setTargetTrackEncoding(trackId, encoding);\n}\n"]}
@@ -1,18 +0,0 @@
1
- export declare const ReceivableEvents: {
2
- readonly IsMicrophoneOn: "IsMicrophoneOn";
3
- readonly IsScreenShareOn: "IsScreenShareOn";
4
- readonly IsAppScreenShareOn: "IsAppScreenShareOn";
5
- readonly SimulcastConfigUpdate: "SimulcastConfigUpdate";
6
- readonly PeersUpdate: "PeersUpdate";
7
- readonly AudioDeviceUpdate: "AudioDeviceUpdate";
8
- readonly SendMediaEvent: "SendMediaEvent";
9
- readonly BandwidthEstimation: "BandwidthEstimation";
10
- readonly ReconnectionRetriesLimitReached: "ReconnectionRetriesLimitReached";
11
- readonly ReconnectionStarted: "ReconnectionStarted";
12
- readonly Reconnected: "Reconnected";
13
- readonly Warning: "Warning";
14
- readonly PeerStatusChanged: "PeerStatusChanged";
15
- readonly CurrentCameraChanged: "CurrentCameraChanged";
16
- };
17
- export declare function useFishjamEvent<T>(eventName: keyof typeof ReceivableEvents, callback: (event: T) => void): void;
18
- //# sourceMappingURL=useFishjamEvent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAenB,CAAC;AAEX,wBAAgB,eAAe,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,OAAO,gBAAgB,EACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAU7B"}
@@ -1,27 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { nativeModuleEventEmitter } from '../RNFishjamClientModule';
3
- export const ReceivableEvents = {
4
- IsMicrophoneOn: 'IsMicrophoneOn',
5
- IsScreenShareOn: 'IsScreenShareOn',
6
- IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS
7
- SimulcastConfigUpdate: 'SimulcastConfigUpdate',
8
- PeersUpdate: 'PeersUpdate',
9
- AudioDeviceUpdate: 'AudioDeviceUpdate',
10
- SendMediaEvent: 'SendMediaEvent',
11
- BandwidthEstimation: 'BandwidthEstimation',
12
- ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',
13
- ReconnectionStarted: 'ReconnectionStarted',
14
- Reconnected: 'Reconnected',
15
- Warning: 'Warning',
16
- PeerStatusChanged: 'PeerStatusChanged',
17
- CurrentCameraChanged: 'CurrentCameraChanged',
18
- };
19
- export function useFishjamEvent(eventName, callback) {
20
- useEffect(() => {
21
- const eventListener = nativeModuleEventEmitter.addListener(eventName, (event) => {
22
- callback(event[eventName]);
23
- });
24
- return () => eventListener.remove();
25
- }, [callback, eventName]);
26
- }
27
- //# sourceMappingURL=useFishjamEvent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFishjamEvent.js","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB,EAAE,eAAe;IACzD,qBAAqB,EAAE,uBAAuB;IAC9C,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,oBAAoB,EAAE,sBAAsB;CACpC,CAAC;AAEX,MAAM,UAAU,eAAe,CAC7B,SAAwC,EACxC,QAA4B;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,wBAAwB,CAAC,WAAW,CAExD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACrB,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IACtC,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport { nativeModuleEventEmitter } from '../RNFishjamClientModule';\n\nexport const ReceivableEvents = {\n IsMicrophoneOn: 'IsMicrophoneOn',\n IsScreenShareOn: 'IsScreenShareOn',\n IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS\n SimulcastConfigUpdate: 'SimulcastConfigUpdate',\n PeersUpdate: 'PeersUpdate',\n AudioDeviceUpdate: 'AudioDeviceUpdate',\n SendMediaEvent: 'SendMediaEvent',\n BandwidthEstimation: 'BandwidthEstimation',\n ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',\n ReconnectionStarted: 'ReconnectionStarted',\n Reconnected: 'Reconnected',\n Warning: 'Warning',\n PeerStatusChanged: 'PeerStatusChanged',\n CurrentCameraChanged: 'CurrentCameraChanged',\n} as const;\n\nexport function useFishjamEvent<T>(\n eventName: keyof typeof ReceivableEvents,\n callback: (event: T) => void,\n) {\n useEffect(() => {\n const eventListener = nativeModuleEventEmitter.addListener<\n Record<keyof typeof ReceivableEvents, T>\n >(eventName, (event) => {\n callback(event[eventName]);\n });\n return () => eventListener.remove();\n }, [callback, eventName]);\n}\n"]}
@@ -1,3 +0,0 @@
1
- import { ReceivableEvents } from './useFishjamEvent';
2
- export declare function useFishjamEventState<EventType, StateType = EventType>(eventName: keyof typeof ReceivableEvents, defaultValue: StateType, transform?: StateType extends EventType ? undefined : (eventValue: EventType) => StateType): StateType;
3
- //# sourceMappingURL=useFishjamEventState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFishjamEventState.d.ts","sourceRoot":"","sources":["../../src/hooks/useFishjamEventState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAEtE,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EACnE,SAAS,EAAE,MAAM,OAAO,gBAAgB,EACxC,YAAY,EAAE,SAAS,EACvB,SAAS,CAAC,EAAE,SAAS,SAAS,SAAS,GACnC,SAAS,GACT,CAAC,UAAU,EAAE,SAAS,KAAK,SAAS,aAkBzC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFishjamEventState.js","sourceRoot":"","sources":["../../src/hooks/useFishjamEventState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAoB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,UAAU,oBAAoB,CAClC,SAAwC,EACxC,YAAuB,EACvB,SAEwC;IAExC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAY,YAAY,CAAC,CAAC;IAE5D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,QAAmB,EAAE,EAAE;QACtB,IAAI,SAAS,EAAE,CAAC;YACd,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,QAAgC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\nexport function useFishjamEventState<EventType, StateType = EventType>(\n eventName: keyof typeof ReceivableEvents,\n defaultValue: StateType,\n transform?: StateType extends EventType\n ? undefined\n : (eventValue: EventType) => StateType,\n) {\n const [value, setValue] = useState<StateType>(defaultValue);\n\n const onEvent = useCallback(\n (newValue: EventType) => {\n if (transform) {\n setValue(transform(newValue));\n } else {\n setValue(newValue as unknown as StateType);\n }\n },\n [transform],\n );\n\n useFishjamEvent(eventName, onEvent);\n\n return value;\n}\n"]}
File without changes