@fishjam-cloud/react-native-client 0.23.0 → 0.25.0-rc.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.
- package/README.md +56 -15
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/overrides/RTCPeerConnection.d.ts +8 -0
- package/dist/overrides/RTCPeerConnection.d.ts.map +1 -0
- package/dist/overrides/RTCPeerConnection.js +16 -0
- package/dist/overrides/RTCView.d.ts +11 -0
- package/dist/overrides/RTCView.d.ts.map +1 -0
- package/dist/overrides/RTCView.js +21 -0
- package/dist/polyfills/local-storage.d.ts +10 -0
- package/dist/polyfills/local-storage.d.ts.map +1 -0
- package/dist/polyfills/local-storage.js +24 -0
- package/{build/hooks → dist}/useForegroundService.d.ts +10 -10
- package/dist/useForegroundService.d.ts.map +1 -0
- package/dist/useForegroundService.js +10 -0
- package/dist/webrtc-polyfill.d.ts +2 -0
- package/dist/webrtc-polyfill.d.ts.map +1 -0
- package/dist/webrtc-polyfill.js +14 -0
- package/package.json +44 -92
- package/plugin/broadcastExtensionFiles/Atomic.swift +37 -0
- package/plugin/broadcastExtensionFiles/DarwinNotificationCenter.swift +29 -0
- package/plugin/broadcastExtensionFiles/Info.plist +2 -2
- package/plugin/broadcastExtensionFiles/SampleHandler.swift +104 -0
- package/plugin/broadcastExtensionFiles/SampleUploader.swift +146 -0
- package/plugin/broadcastExtensionFiles/SocketConnection.swift +198 -0
- package/plugin/build/types.d.ts +5 -3
- package/plugin/build/withFishjam.d.ts +31 -2
- package/plugin/build/withFishjam.js +32 -6
- package/plugin/build/withFishjamAndroid.d.ts +2 -2
- package/plugin/build/withFishjamAndroid.js +60 -13
- package/plugin/build/withFishjamIos.d.ts +3 -8
- package/plugin/build/withFishjamIos.js +54 -69
- package/plugin/src/types.ts +19 -0
- package/plugin/src/withFishjam.ts +42 -0
- package/plugin/src/withFishjamAndroid.ts +112 -0
- package/plugin/src/withFishjamIos.ts +336 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/LICENSE.txt +0 -201
- package/android/build.gradle +0 -95
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/io/fishjam/reactnative/AudioDeviceKind.kt +0 -34
- package/android/src/main/java/io/fishjam/reactnative/AudioSwitchManager.kt +0 -61
- package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +0 -126
- package/android/src/main/java/io/fishjam/reactnative/Errors.kt +0 -31
- package/android/src/main/java/io/fishjam/reactnative/PipContainerView.kt +0 -282
- package/android/src/main/java/io/fishjam/reactnative/PipContainerViewModule.kt +0 -41
- package/android/src/main/java/io/fishjam/reactnative/PipTrackSelector.kt +0 -98
- package/android/src/main/java/io/fishjam/reactnative/PipViewFactory.kt +0 -186
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +0 -1001
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +0 -358
- package/android/src/main/java/io/fishjam/reactnative/Utils.kt +0 -11
- package/android/src/main/java/io/fishjam/reactnative/VideoPreviewView.kt +0 -40
- package/android/src/main/java/io/fishjam/reactnative/VideoPreviewViewModule.kt +0 -22
- package/android/src/main/java/io/fishjam/reactnative/VideoRendererView.kt +0 -76
- package/android/src/main/java/io/fishjam/reactnative/VideoRendererViewModule.kt +0 -33
- package/android/src/main/java/io/fishjam/reactnative/VideoView.kt +0 -257
- package/android/src/main/java/io/fishjam/reactnative/extensions/CaptureDevice.kt +0 -17
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/FishjamForegroundService.kt +0 -101
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceManager.kt +0 -118
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceState.kt +0 -46
- package/android/src/main/java/io/fishjam/reactnative/helpers/PictureInPictureHelperFragment.kt +0 -20
- package/android/src/main/java/io/fishjam/reactnative/managers/ListenerManager.kt +0 -24
- package/android/src/main/java/io/fishjam/reactnative/managers/LocalCameraTracksChangedListenersManager.kt +0 -8
- package/android/src/main/java/io/fishjam/reactnative/managers/LocalTracksSwitchListenersManager.kt +0 -17
- package/android/src/main/java/io/fishjam/reactnative/managers/TracksUpdateListenersManager.kt +0 -7
- package/android/src/main/java/io/fishjam/reactnative/utils/PermissionUtils.kt +0 -45
- package/build/RNFishjamClientModule.d.ts +0 -106
- package/build/RNFishjamClientModule.d.ts.map +0 -1
- package/build/RNFishjamClientModule.js +0 -21
- package/build/RNFishjamClientModule.js.map +0 -1
- package/build/common/metadata.d.ts +0 -9
- package/build/common/metadata.d.ts.map +0 -1
- package/build/common/metadata.js +0 -11
- package/build/common/metadata.js.map +0 -1
- package/build/components/FishjamRoom/GridTrackItem.d.ts +0 -12
- package/build/components/FishjamRoom/GridTrackItem.d.ts.map +0 -1
- package/build/components/FishjamRoom/GridTrackItem.js +0 -56
- package/build/components/FishjamRoom/GridTrackItem.js.map +0 -1
- package/build/components/FishjamRoom/VideosGrid.d.ts +0 -3
- package/build/components/FishjamRoom/VideosGrid.d.ts.map +0 -1
- package/build/components/FishjamRoom/VideosGrid.js +0 -20
- package/build/components/FishjamRoom/VideosGrid.js.map +0 -1
- package/build/components/FishjamRoom/index.d.ts +0 -33
- package/build/components/FishjamRoom/index.d.ts.map +0 -1
- package/build/components/FishjamRoom/index.js +0 -53
- package/build/components/FishjamRoom/index.js.map +0 -1
- package/build/components/FishjamRoom/parsePeersToTracks.d.ts +0 -4
- package/build/components/FishjamRoom/parsePeersToTracks.d.ts.map +0 -1
- package/build/components/FishjamRoom/parsePeersToTracks.js +0 -37
- package/build/components/FishjamRoom/parsePeersToTracks.js.map +0 -1
- package/build/components/PipContainerView.d.ts +0 -48
- package/build/components/PipContainerView.d.ts.map +0 -1
- package/build/components/PipContainerView.js +0 -34
- package/build/components/PipContainerView.js.map +0 -1
- package/build/components/VideoPreviewView.d.ts +0 -28
- package/build/components/VideoPreviewView.d.ts.map +0 -1
- package/build/components/VideoPreviewView.js +0 -17
- package/build/components/VideoPreviewView.js.map +0 -1
- package/build/components/VideoRendererView.d.ts +0 -39
- package/build/components/VideoRendererView.d.ts.map +0 -1
- package/build/components/VideoRendererView.js +0 -25
- package/build/components/VideoRendererView.js.map +0 -1
- package/build/consts/index.d.ts +0 -5
- package/build/consts/index.d.ts.map +0 -1
- package/build/consts/index.js +0 -8
- package/build/consts/index.js.map +0 -1
- package/build/debug/common/webRTC.d.ts +0 -9
- package/build/debug/common/webRTC.d.ts.map +0 -1
- package/build/debug/common/webRTC.js +0 -11
- package/build/debug/common/webRTC.js.map +0 -1
- package/build/debug/index.d.ts +0 -4
- package/build/debug/index.d.ts.map +0 -1
- package/build/debug/index.js +0 -3
- package/build/debug/index.js.map +0 -1
- package/build/debug/stats/types.d.ts +0 -55
- package/build/debug/stats/types.d.ts.map +0 -1
- package/build/debug/stats/types.js +0 -2
- package/build/debug/stats/types.js.map +0 -1
- package/build/debug/stats/useRTCStatistics.d.ts +0 -9
- package/build/debug/stats/useRTCStatistics.d.ts.map +0 -1
- package/build/debug/stats/useRTCStatistics.js +0 -79
- package/build/debug/stats/useRTCStatistics.js.map +0 -1
- package/build/hooks/internal/useFishjamEvent.d.ts +0 -4
- package/build/hooks/internal/useFishjamEvent.d.ts.map +0 -1
- package/build/hooks/internal/useFishjamEvent.js +0 -38
- package/build/hooks/internal/useFishjamEvent.js.map +0 -1
- package/build/hooks/internal/useFishjamEventState.d.ts +0 -3
- package/build/hooks/internal/useFishjamEventState.d.ts.map +0 -1
- package/build/hooks/internal/useFishjamEventState.js +0 -18
- package/build/hooks/internal/useFishjamEventState.js.map +0 -1
- package/build/hooks/useAppScreenShare.d.ts +0 -20
- package/build/hooks/useAppScreenShare.d.ts.map +0 -1
- package/build/hooks/useAppScreenShare.js +0 -54
- package/build/hooks/useAppScreenShare.js.map +0 -1
- package/build/hooks/useAudioSettings.d.ts +0 -49
- package/build/hooks/useAudioSettings.d.ts.map +0 -1
- package/build/hooks/useAudioSettings.js +0 -70
- package/build/hooks/useAudioSettings.js.map +0 -1
- package/build/hooks/useBandwidthEstimation.d.ts +0 -14
- package/build/hooks/useBandwidthEstimation.d.ts.map +0 -1
- package/build/hooks/useBandwidthEstimation.js +0 -19
- package/build/hooks/useBandwidthEstimation.js.map +0 -1
- package/build/hooks/useCallKit.d.ts +0 -121
- package/build/hooks/useCallKit.d.ts.map +0 -1
- package/build/hooks/useCallKit.js +0 -142
- package/build/hooks/useCallKit.js.map +0 -1
- package/build/hooks/useCamera.d.ts +0 -113
- package/build/hooks/useCamera.d.ts.map +0 -1
- package/build/hooks/useCamera.js +0 -95
- package/build/hooks/useCamera.js.map +0 -1
- package/build/hooks/useConnection.d.ts +0 -73
- package/build/hooks/useConnection.d.ts.map +0 -1
- package/build/hooks/useConnection.js +0 -46
- package/build/hooks/useConnection.js.map +0 -1
- package/build/hooks/useForegroundService.d.ts.map +0 -1
- package/build/hooks/useForegroundService.js +0 -66
- package/build/hooks/useForegroundService.js.map +0 -1
- package/build/hooks/useMicrophone.d.ts +0 -16
- package/build/hooks/useMicrophone.d.ts.map +0 -1
- package/build/hooks/useMicrophone.js +0 -31
- package/build/hooks/useMicrophone.js.map +0 -1
- package/build/hooks/usePeerStatus.d.ts +0 -10
- package/build/hooks/usePeerStatus.d.ts.map +0 -1
- package/build/hooks/usePeerStatus.js +0 -13
- package/build/hooks/usePeerStatus.js.map +0 -1
- package/build/hooks/usePeers.d.ts +0 -98
- package/build/hooks/usePeers.d.ts.map +0 -1
- package/build/hooks/usePeers.js +0 -81
- package/build/hooks/usePeers.js.map +0 -1
- package/build/hooks/usePermissions.d.ts +0 -24
- package/build/hooks/usePermissions.d.ts.map +0 -1
- package/build/hooks/usePermissions.js +0 -61
- package/build/hooks/usePermissions.js.map +0 -1
- package/build/hooks/useReconnection.d.ts +0 -11
- package/build/hooks/useReconnection.d.ts.map +0 -1
- package/build/hooks/useReconnection.js +0 -14
- package/build/hooks/useReconnection.js.map +0 -1
- package/build/hooks/useSandbox.d.ts +0 -20
- package/build/hooks/useSandbox.d.ts.map +0 -1
- package/build/hooks/useSandbox.js +0 -54
- package/build/hooks/useSandbox.js.map +0 -1
- package/build/hooks/useScreenShare.d.ts +0 -37
- package/build/hooks/useScreenShare.d.ts.map +0 -1
- package/build/hooks/useScreenShare.js +0 -52
- package/build/hooks/useScreenShare.js.map +0 -1
- package/build/hooks/useUpdatePeerMetadata.d.ts +0 -15
- package/build/hooks/useUpdatePeerMetadata.d.ts.map +0 -1
- package/build/hooks/useUpdatePeerMetadata.js +0 -21
- package/build/hooks/useUpdatePeerMetadata.js.map +0 -1
- package/build/index.d.ts +0 -36
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -30
- package/build/index.js.map +0 -1
- package/build/livestream/components/LivestreamStreamer.d.ts +0 -24
- package/build/livestream/components/LivestreamStreamer.d.ts.map +0 -1
- package/build/livestream/components/LivestreamStreamer.js +0 -12
- package/build/livestream/components/LivestreamStreamer.js.map +0 -1
- package/build/livestream/components/LivestreamViewer.d.ts +0 -46
- package/build/livestream/components/LivestreamViewer.d.ts.map +0 -1
- package/build/livestream/components/LivestreamViewer.js +0 -10
- package/build/livestream/components/LivestreamViewer.js.map +0 -1
- package/build/livestream/hooks/useLivestreamStreamer.d.ts +0 -65
- package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +0 -1
- package/build/livestream/hooks/useLivestreamStreamer.js +0 -72
- package/build/livestream/hooks/useLivestreamStreamer.js.map +0 -1
- package/build/livestream/hooks/useLivestreamViewer.d.ts +0 -36
- package/build/livestream/hooks/useLivestreamViewer.d.ts.map +0 -1
- package/build/livestream/hooks/useLivestreamViewer.js +0 -73
- package/build/livestream/hooks/useLivestreamViewer.js.map +0 -1
- package/build/livestream/index.d.ts +0 -11
- package/build/livestream/index.d.ts.map +0 -1
- package/build/livestream/index.js +0 -6
- package/build/livestream/index.js.map +0 -1
- package/build/protos/fishjam/peer_notifications.d.ts +0 -63
- package/build/protos/fishjam/peer_notifications.d.ts.map +0 -1
- package/build/protos/fishjam/peer_notifications.js +0 -235
- package/build/protos/fishjam/peer_notifications.js.map +0 -1
- package/build/types.d.ts +0 -34
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -2
- package/build/types.js.map +0 -1
- package/build/utils/config.d.ts +0 -6
- package/build/utils/config.d.ts.map +0 -1
- package/build/utils/config.js +0 -10
- package/build/utils/config.js.map +0 -1
- package/build/utils/errorListener.d.ts +0 -2
- package/build/utils/errorListener.d.ts.map +0 -1
- package/build/utils/errorListener.js +0 -15
- package/build/utils/errorListener.js.map +0 -1
- package/build/utils/eventPayloadValidator.d.ts +0 -3
- package/build/utils/eventPayloadValidator.d.ts.map +0 -1
- package/build/utils/eventPayloadValidator.js +0 -86
- package/build/utils/eventPayloadValidator.js.map +0 -1
- package/build/utils/getFishjamUrl.d.ts +0 -2
- package/build/utils/getFishjamUrl.d.ts.map +0 -1
- package/build/utils/getFishjamUrl.js +0 -10
- package/build/utils/getFishjamUrl.js.map +0 -1
- package/debug/package.json +0 -4
- package/expo-module.config.json +0 -19
- package/ios/CameraPermissionsRequester.swift +0 -117
- package/ios/Events.swift +0 -152
- package/ios/PictureInPictureManager.swift +0 -215
- package/ios/PipContainerView.swift +0 -56
- package/ios/PipContainerViewModule.swift +0 -48
- package/ios/RNFishjamClient.podspec +0 -30
- package/ios/RNFishjamClient.swift +0 -995
- package/ios/RNFishjamClientModule.swift +0 -289
- package/ios/RNFishjamProxy.swift +0 -12
- package/ios/Utils/PermissionUtils.swift +0 -16
- package/ios/Utils.swift +0 -23
- package/ios/VideoPreviewView.swift +0 -54
- package/ios/VideoPreviewViewModule.swift +0 -21
- package/ios/VideoRendererView.swift +0 -98
- package/ios/VideoRendererViewModule.swift +0 -23
- package/ios/extensions/AVCaptureDevice.swift +0 -20
- package/ios/managers/LocalCameraTracksChangedListenersManager.swift +0 -23
- package/ios/managers/TracksUpdateListenersManager.swift +0 -21
- package/livestream/package.json +0 -4
- package/plugin/broadcastExtensionFiles/FishjamBroadcastSampleHandler.swift +0 -50
- /package/plugin/broadcastExtensionFiles/{FishjamScreenBroadcastExtension.entitlements → ScreenBroadcastExtension.entitlements} +0 -0
|
@@ -33,23 +33,21 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
// ios-related code was mostly copied from OneSignal expo plugin: https://github.com/OneSignal/onesignal-expo-plugin/blob/main/onesignal/withOneSignalIos.ts
|
|
36
|
+
exports.withFishjamIos = void 0;
|
|
38
37
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
39
|
-
const fs = __importStar(require("promise-fs"));
|
|
40
38
|
const path = __importStar(require("path"));
|
|
39
|
+
const fs = __importStar(require("promise-fs"));
|
|
41
40
|
function getSbeTargetName(props) {
|
|
42
|
-
return
|
|
43
|
-
'FishjamScreenBroadcastExtension');
|
|
41
|
+
return props?.ios?.broadcastExtensionTargetName || 'ScreenBroadcastExtension';
|
|
44
42
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
return `\ntarget '${targetName}' do\n pod 'FishjamCloudClient/Broadcast'\nend`;
|
|
43
|
+
function getSbeDisplayName(props) {
|
|
44
|
+
return props?.ios?.broadcastExtensionDisplayName || 'ScreenBroadcast';
|
|
48
45
|
}
|
|
49
46
|
const TARGETED_DEVICE_FAMILY = `"1,2"`;
|
|
50
47
|
const IPHONEOS_DEPLOYMENT_TARGET = '15.1';
|
|
51
48
|
const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
|
|
52
49
|
const BUNDLE_IDENTIFIER_TEMPLATE_REGEX = /{{BUNDLE_IDENTIFIER}}/gm;
|
|
50
|
+
const DISPLAY_NAME_TEMPLATE_REGEX = /{{DISPLAY_NAME}}/gm;
|
|
53
51
|
/**
|
|
54
52
|
* A helper function for updating a value in a file for given regex
|
|
55
53
|
*/
|
|
@@ -60,36 +58,9 @@ async function updateFileWithRegex(iosPath, fileName, regex, value, props) {
|
|
|
60
58
|
file = file.replace(regex, value);
|
|
61
59
|
await fs.writeFile(filePath, file);
|
|
62
60
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Inserts a required target to Podfile.
|
|
65
|
-
* This is needed to provide the dependency of FishjamCloudClient/Broadcast to the extension.
|
|
66
|
-
*/
|
|
67
|
-
async function updatePodfile(iosPath, props) {
|
|
68
|
-
const podfileSnippet = getSbePodfileSnippet(props);
|
|
69
|
-
let matches;
|
|
70
|
-
try {
|
|
71
|
-
const podfile = await fs.readFile(`${iosPath}/Podfile`, {
|
|
72
|
-
encoding: 'utf-8',
|
|
73
|
-
});
|
|
74
|
-
matches = podfile.match(podfileSnippet);
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
console.error('Error reading from Podfile: ', e);
|
|
78
|
-
}
|
|
79
|
-
if (matches) {
|
|
80
|
-
console.log(`${getSbeTargetName(props)} target already added to Podfile. Skipping...`);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
fs.appendFile(`${iosPath}/Podfile`, podfileSnippet);
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
console.error('Error writing to Podfile: ', e);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
61
|
/**
|
|
91
62
|
* Adds "App Group" permission
|
|
92
|
-
* App Group
|
|
63
|
+
* App Group allows your app and the ScreenBroadcastExtension to communicate with each other.
|
|
93
64
|
*/
|
|
94
65
|
const withAppGroupPermissions = (config, props) => {
|
|
95
66
|
const APP_GROUP_KEY = 'com.apple.security.application-groups';
|
|
@@ -111,6 +82,7 @@ const withAppGroupPermissions = (config, props) => {
|
|
|
111
82
|
newConfig.modResults[APP_GROUP_KEY] = modResultsArray;
|
|
112
83
|
return newConfig;
|
|
113
84
|
});
|
|
85
|
+
// eslint-disable-next-line no-shadow
|
|
114
86
|
config = (0, config_plugins_1.withXcodeProject)(config, (props) => {
|
|
115
87
|
const xcodeProject = props.modResults;
|
|
116
88
|
const targets = xcodeProject.getFirstTarget();
|
|
@@ -124,8 +96,7 @@ const withAppGroupPermissions = (config, props) => {
|
|
|
124
96
|
projectObj.attributes ??= {};
|
|
125
97
|
projectObj.attributes.TargetAttributes ??= {};
|
|
126
98
|
projectObj.attributes.TargetAttributes[targetUuid] ??= {};
|
|
127
|
-
projectObj.attributes.TargetAttributes[targetUuid].SystemCapabilities ??=
|
|
128
|
-
{};
|
|
99
|
+
projectObj.attributes.TargetAttributes[targetUuid].SystemCapabilities ??= {};
|
|
129
100
|
projectObj.attributes.TargetAttributes[targetUuid].SystemCapabilities['com.apple.ApplicationGroups.iOS'] = {
|
|
130
101
|
enabled: 1,
|
|
131
102
|
};
|
|
@@ -133,6 +104,7 @@ const withAppGroupPermissions = (config, props) => {
|
|
|
133
104
|
const entitlementsFilePath = `${mainTargetName}/${mainTargetName}.entitlements`;
|
|
134
105
|
const configurations = xcodeProject.pbxXCBuildConfigurationSection();
|
|
135
106
|
Object.keys(configurations).forEach((key) => {
|
|
107
|
+
// eslint-disable-next-line no-shadow
|
|
136
108
|
const config = configurations[key];
|
|
137
109
|
if (config.buildSettings?.PRODUCT_NAME?.includes(mainTargetName)) {
|
|
138
110
|
if (!config.buildSettings.CODE_SIGN_ENTITLEMENTS) {
|
|
@@ -146,14 +118,13 @@ const withAppGroupPermissions = (config, props) => {
|
|
|
146
118
|
};
|
|
147
119
|
/**
|
|
148
120
|
* Adds constants to Info.plist
|
|
149
|
-
* In
|
|
121
|
+
* In order to dynamically retrieve extension's bundleId and group name we need to store it in Info.plist.
|
|
150
122
|
*/
|
|
151
123
|
const withInfoPlistConstants = (config, props) => (0, config_plugins_1.withInfoPlist)(config, (configuration) => {
|
|
152
124
|
const bundleIdentifier = configuration.ios?.bundleIdentifier || '';
|
|
153
125
|
const groupIdentifier = props?.ios?.appGroupContainerId || `group.${bundleIdentifier}`;
|
|
154
|
-
configuration.modResults['
|
|
155
|
-
configuration.modResults['
|
|
156
|
-
`${bundleIdentifier}.${getSbeTargetName(props)}`;
|
|
126
|
+
configuration.modResults['RTCScreenSharingExtension'] = `${bundleIdentifier}.${getSbeTargetName(props)}`;
|
|
127
|
+
configuration.modResults['RTCAppGroupIdentifier'] = groupIdentifier;
|
|
157
128
|
return configuration;
|
|
158
129
|
});
|
|
159
130
|
/**
|
|
@@ -169,18 +140,25 @@ const withFishjamSBE = (config, options) => (0, config_plugins_1.withXcodeProjec
|
|
|
169
140
|
const targetName = getSbeTargetName(options);
|
|
170
141
|
const pluginDir = require.resolve('@fishjam-cloud/react-native-client/package.json');
|
|
171
142
|
const extensionSourceDir = path.join(pluginDir, '../plugin/broadcastExtensionFiles/');
|
|
172
|
-
await updatePodfile(iosPath, options);
|
|
173
143
|
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
|
|
174
|
-
const templateTargetName = '
|
|
144
|
+
const templateTargetName = 'ScreenBroadcastExtension';
|
|
175
145
|
const extFiles = [
|
|
176
|
-
'
|
|
146
|
+
'SampleHandler.swift',
|
|
147
|
+
'SampleUploader.swift',
|
|
177
148
|
`${templateTargetName}.entitlements`,
|
|
178
149
|
`Info.plist`,
|
|
150
|
+
'SocketConnection.swift',
|
|
151
|
+
'DarwinNotificationCenter.swift',
|
|
152
|
+
'Atomic.swift',
|
|
179
153
|
];
|
|
180
154
|
const destFiles = [
|
|
181
|
-
'
|
|
155
|
+
'SampleHandler.swift',
|
|
156
|
+
'SampleUploader.swift',
|
|
182
157
|
`${targetName}.entitlements`,
|
|
183
158
|
`Info.plist`,
|
|
159
|
+
'SocketConnection.swift',
|
|
160
|
+
'DarwinNotificationCenter.swift',
|
|
161
|
+
'Atomic.swift',
|
|
184
162
|
];
|
|
185
163
|
await xcodeProject.parse(async function (err) {
|
|
186
164
|
if (err) {
|
|
@@ -188,6 +166,7 @@ const withFishjamSBE = (config, options) => (0, config_plugins_1.withXcodeProjec
|
|
|
188
166
|
return;
|
|
189
167
|
}
|
|
190
168
|
if (xcodeProject.pbxTargetByName(targetName)) {
|
|
169
|
+
// eslint-disable-next-line no-console
|
|
191
170
|
console.log(`${targetName} already exists in project. Skipping...`);
|
|
192
171
|
return;
|
|
193
172
|
}
|
|
@@ -201,10 +180,17 @@ const withFishjamSBE = (config, options) => (0, config_plugins_1.withXcodeProjec
|
|
|
201
180
|
}
|
|
202
181
|
catch (e) {
|
|
203
182
|
console.error('Error copying extension files: ', e);
|
|
183
|
+
throw e;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
await updateFileWithRegex(iosPath, `${targetName}.entitlements`, GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier, options);
|
|
187
|
+
await updateFileWithRegex(iosPath, 'SampleHandler.swift', GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier, options);
|
|
188
|
+
await updateFileWithRegex(iosPath, 'SampleUploader.swift', BUNDLE_IDENTIFIER_TEMPLATE_REGEX, bundleIdentifier || '', options);
|
|
189
|
+
await updateFileWithRegex(iosPath, 'Info.plist', DISPLAY_NAME_TEMPLATE_REGEX, getSbeDisplayName(options), options);
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
console.error('Error updating extension files: ', e);
|
|
204
193
|
}
|
|
205
|
-
await updateFileWithRegex(iosPath, `${targetName}.entitlements`, GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier, options);
|
|
206
|
-
await updateFileWithRegex(iosPath, 'FishjamBroadcastSampleHandler.swift', GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier, options);
|
|
207
|
-
await updateFileWithRegex(iosPath, 'FishjamBroadcastSampleHandler.swift', BUNDLE_IDENTIFIER_TEMPLATE_REGEX, bundleIdentifier || '', options);
|
|
208
194
|
// Create new PBXGroup for the extension
|
|
209
195
|
const extGroup = xcodeProject.addPbxGroup(extFiles, targetName, targetName);
|
|
210
196
|
// Add the new PBXGroup to the top level group. This makes the
|
|
@@ -220,15 +206,19 @@ const withFishjamSBE = (config, options) => (0, config_plugins_1.withXcodeProjec
|
|
|
220
206
|
// An upstream fix should be made to the code referenced in this link:
|
|
221
207
|
// - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
|
|
222
208
|
const projObjects = xcodeProject.hash.project.objects;
|
|
223
|
-
projObjects['PBXTargetDependency'] =
|
|
224
|
-
|
|
225
|
-
projObjects['PBXContainerItemProxy'] =
|
|
226
|
-
projObjects['PBXTargetDependency'] || {};
|
|
209
|
+
projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};
|
|
210
|
+
projObjects['PBXContainerItemProxy'] = projObjects['PBXContainerItemProxy'] || {};
|
|
227
211
|
// Add the SBE target
|
|
228
212
|
// This adds PBXTargetDependency and PBXContainerItemProxy for you
|
|
229
213
|
const sbeTarget = xcodeProject.addTarget(targetName, 'app_extension', targetName, `${bundleIdentifier}.${targetName}`);
|
|
230
214
|
// Add build phases to the new target
|
|
231
|
-
xcodeProject.addBuildPhase([
|
|
215
|
+
xcodeProject.addBuildPhase([
|
|
216
|
+
'SampleHandler.swift',
|
|
217
|
+
'SampleUploader.swift',
|
|
218
|
+
'SocketConnection.swift',
|
|
219
|
+
'DarwinNotificationCenter.swift',
|
|
220
|
+
'Atomic.swift',
|
|
221
|
+
], 'PBXSourcesBuildPhase', 'Sources', sbeTarget.uuid);
|
|
232
222
|
xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', sbeTarget.uuid);
|
|
233
223
|
xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', sbeTarget.uuid);
|
|
234
224
|
xcodeProject.addFramework('ReplayKit.framework', {
|
|
@@ -257,14 +247,6 @@ const withFishjamSBE = (config, options) => (0, config_plugins_1.withXcodeProjec
|
|
|
257
247
|
});
|
|
258
248
|
return props;
|
|
259
249
|
});
|
|
260
|
-
const withFishjamPictureInPicture = (config, props) => (0, config_plugins_1.withInfoPlist)(config, (configuration) => {
|
|
261
|
-
if (props?.ios?.supportsPictureInPicture) {
|
|
262
|
-
const backgroundModes = new Set(configuration.modResults.UIBackgroundModes ?? []);
|
|
263
|
-
backgroundModes.add('audio');
|
|
264
|
-
configuration.modResults.UIBackgroundModes = Array.from(backgroundModes);
|
|
265
|
-
}
|
|
266
|
-
return configuration;
|
|
267
|
-
});
|
|
268
250
|
/**
|
|
269
251
|
* Adds iOS VoIP background mode to keep the app running during calls
|
|
270
252
|
*/
|
|
@@ -276,10 +258,14 @@ const withFishjamVoIPBackgroundMode = (config, props) => (0, config_plugins_1.wi
|
|
|
276
258
|
}
|
|
277
259
|
return configuration;
|
|
278
260
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
261
|
+
const withFishjamPictureInPicture = (config, props) => (0, config_plugins_1.withInfoPlist)(config, (configuration) => {
|
|
262
|
+
if (props?.ios?.supportsPictureInPicture) {
|
|
263
|
+
const backgroundModes = new Set(configuration.modResults.UIBackgroundModes ?? []);
|
|
264
|
+
backgroundModes.add('audio');
|
|
265
|
+
configuration.modResults.UIBackgroundModes = Array.from(backgroundModes);
|
|
266
|
+
}
|
|
267
|
+
return configuration;
|
|
268
|
+
});
|
|
283
269
|
const withFishjamIos = (config, props) => {
|
|
284
270
|
if (props?.ios?.enableScreensharing) {
|
|
285
271
|
config = withAppGroupPermissions(config, props);
|
|
@@ -287,12 +273,11 @@ const withFishjamIos = (config, props) => {
|
|
|
287
273
|
config = withFishjamSBE(config, props);
|
|
288
274
|
}
|
|
289
275
|
config = (0, config_plugins_1.withPodfileProperties)(config, (configuration) => {
|
|
290
|
-
configuration.modResults['ios.deploymentTarget'] =
|
|
291
|
-
props?.ios?.iphoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
|
|
276
|
+
configuration.modResults['ios.deploymentTarget'] = props?.ios?.iphoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
|
|
292
277
|
return configuration;
|
|
293
278
|
});
|
|
294
279
|
config = withFishjamPictureInPicture(config, props);
|
|
295
280
|
config = withFishjamVoIPBackgroundMode(config, props);
|
|
296
281
|
return config;
|
|
297
282
|
};
|
|
298
|
-
exports.
|
|
283
|
+
exports.withFishjamIos = withFishjamIos;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type FishjamPluginOptions =
|
|
2
|
+
| {
|
|
3
|
+
android?: {
|
|
4
|
+
enableForegroundService?: boolean;
|
|
5
|
+
enableScreensharing?: boolean;
|
|
6
|
+
supportsPictureInPicture?: boolean;
|
|
7
|
+
};
|
|
8
|
+
ios?: {
|
|
9
|
+
enableScreensharing?: boolean;
|
|
10
|
+
supportsPictureInPicture?: boolean;
|
|
11
|
+
broadcastExtensionTargetName?: string;
|
|
12
|
+
broadcastExtensionDisplayName?: string;
|
|
13
|
+
appGroupContainerId?: string;
|
|
14
|
+
mainTargetName?: string;
|
|
15
|
+
iphoneDeploymentTarget?: string;
|
|
16
|
+
enableVoIPBackgroundMode?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
| undefined;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
|
|
3
|
+
import type { FishjamPluginOptions } from './types';
|
|
4
|
+
import { withFishjamAndroid } from './withFishjamAndroid';
|
|
5
|
+
import { withFishjamIos } from './withFishjamIos';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Main Fishjam Expo config plugin.
|
|
9
|
+
*
|
|
10
|
+
* This plugin configures both iOS and Android platforms for Picture-in-Picture support.
|
|
11
|
+
*
|
|
12
|
+
* ## Usage
|
|
13
|
+
*
|
|
14
|
+
* ```json
|
|
15
|
+
* {
|
|
16
|
+
* "plugins": [
|
|
17
|
+
* [
|
|
18
|
+
* "@fishjam-cloud/react-native-client",
|
|
19
|
+
* {
|
|
20
|
+
* "android": {
|
|
21
|
+
* "supportsPictureInPicture": true
|
|
22
|
+
* },
|
|
23
|
+
* "ios": {
|
|
24
|
+
* "supportsPictureInPicture": true
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ]
|
|
28
|
+
* ]
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param config - Expo config object
|
|
33
|
+
* @param options - Plugin configuration options
|
|
34
|
+
* @returns Modified config object
|
|
35
|
+
*/
|
|
36
|
+
const withFishjam: ConfigPlugin<FishjamPluginOptions> = (config, options) => {
|
|
37
|
+
config = withFishjamAndroid(config, options);
|
|
38
|
+
config = withFishjamIos(config, options);
|
|
39
|
+
return config;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default withFishjam;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { AndroidConfig, withAndroidManifest } from '@expo/config-plugins';
|
|
3
|
+
import { getMainApplicationOrThrow } from '@expo/config-plugins/build/android/Manifest';
|
|
4
|
+
|
|
5
|
+
import type { FishjamPluginOptions } from './types';
|
|
6
|
+
|
|
7
|
+
const withFishjamPictureInPicture: ConfigPlugin<FishjamPluginOptions> = (config, props) =>
|
|
8
|
+
withAndroidManifest(config, (configuration) => {
|
|
9
|
+
const activity = AndroidConfig.Manifest.getMainActivityOrThrow(configuration.modResults);
|
|
10
|
+
|
|
11
|
+
if (props?.android?.supportsPictureInPicture) {
|
|
12
|
+
activity.$['android:supportsPictureInPicture'] = 'true';
|
|
13
|
+
} else {
|
|
14
|
+
delete activity.$['android:supportsPictureInPicture'];
|
|
15
|
+
}
|
|
16
|
+
return configuration;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const withFishjamForegroundService: ConfigPlugin<FishjamPluginOptions> = (config, props) =>
|
|
20
|
+
withAndroidManifest(config, async (configuration) => {
|
|
21
|
+
if (!props?.android?.enableForegroundService) {
|
|
22
|
+
return configuration;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const mainApplication = getMainApplicationOrThrow(configuration.modResults);
|
|
26
|
+
mainApplication.service = mainApplication.service || [];
|
|
27
|
+
|
|
28
|
+
const webRTCForegroundService = {
|
|
29
|
+
$: {
|
|
30
|
+
'android:name': 'com.oney.WebRTCModule.foregroundService.WebRTCForegroundService',
|
|
31
|
+
'android:foregroundServiceType': 'camera|microphone',
|
|
32
|
+
'android:stopWithTask': 'true',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const existingWebRTCForegroundServiceIndex = mainApplication.service.findIndex(
|
|
37
|
+
(service) => service.$['android:name'] === webRTCForegroundService.$['android:name'],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (existingWebRTCForegroundServiceIndex !== -1) {
|
|
41
|
+
mainApplication.service[existingWebRTCForegroundServiceIndex] = webRTCForegroundService;
|
|
42
|
+
} else {
|
|
43
|
+
mainApplication.service.push(webRTCForegroundService);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (props?.android?.enableScreensharing) {
|
|
47
|
+
const mediaProjectionService = {
|
|
48
|
+
$: {
|
|
49
|
+
'android:name': 'com.oney.WebRTCModule.MediaProjectionService',
|
|
50
|
+
'android:foregroundServiceType': 'mediaProjection',
|
|
51
|
+
'android:stopWithTask': 'true',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const existingMediaProjectionServiceIndex = mainApplication.service.findIndex(
|
|
56
|
+
(service) => service.$['android:name'] === mediaProjectionService.$['android:name'],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (existingMediaProjectionServiceIndex !== -1) {
|
|
60
|
+
mainApplication.service[existingMediaProjectionServiceIndex] = mediaProjectionService;
|
|
61
|
+
} else {
|
|
62
|
+
mainApplication.service.push(mediaProjectionService);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return configuration;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const withFishjamForegroundServicePermission: ConfigPlugin<FishjamPluginOptions> = (config, props) =>
|
|
69
|
+
withAndroidManifest(config, (configuration) => {
|
|
70
|
+
if (!props?.android?.enableForegroundService) {
|
|
71
|
+
return configuration;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const mainApplication = configuration.modResults;
|
|
75
|
+
if (!mainApplication.manifest) {
|
|
76
|
+
return configuration;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!mainApplication.manifest['uses-permission']) {
|
|
80
|
+
mainApplication.manifest['uses-permission'] = [];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const permissions = mainApplication.manifest['uses-permission'];
|
|
84
|
+
|
|
85
|
+
const foregroundServicePermissions = [
|
|
86
|
+
'android.permission.FOREGROUND_SERVICE',
|
|
87
|
+
'android.permission.FOREGROUND_SERVICE_CAMERA',
|
|
88
|
+
'android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION',
|
|
89
|
+
'android.permission.FOREGROUND_SERVICE_MICROPHONE',
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
foregroundServicePermissions.forEach((permissionName) => {
|
|
93
|
+
const hasPermission = permissions.some((perm) => perm.$?.['android:name'] === permissionName);
|
|
94
|
+
|
|
95
|
+
if (!hasPermission) {
|
|
96
|
+
permissions.push({
|
|
97
|
+
$: {
|
|
98
|
+
'android:name': permissionName,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return configuration;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const withFishjamAndroid: ConfigPlugin<FishjamPluginOptions> = (config, props) => {
|
|
108
|
+
config = withFishjamForegroundServicePermission(config, props);
|
|
109
|
+
config = withFishjamForegroundService(config, props);
|
|
110
|
+
config = withFishjamPictureInPicture(config, props);
|
|
111
|
+
return config;
|
|
112
|
+
};
|