Skip to content

Commit 8c3e073

Browse files
committed
Remove unused code
1 parent b034bb4 commit 8c3e073

File tree

1 file changed

+1
-176
lines changed

1 file changed

+1
-176
lines changed

app.plugin.js

Lines changed: 1 addition & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,6 @@
1-
/*
2-
iOS
3-
4-
- Add this package to your Podfile
5-
6-
pod 'react-native-twilio-video-webrtc', path: '../node_modules/react-native-twilio-video-webrtc'
7-
8-
- To enable camera usage and microphone usage you will need to add the following entries to your Info.plist file:
9-
10-
<key>NSCameraUsageDescription</key>
11-
<string>Your message to user when the camera is accessed for the first time</string>
12-
<key>NSMicrophoneUsageDescription</key>
13-
<string>Your message to user when the microphone is accessed for the first time</string>
14-
15-
Android
16-
17-
- Add the library to your settings.gradle file:
18-
19-
include ':react-native-twilio-video-webrtc'
20-
project(':react-native-twilio-video-webrtc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twilio-video-webrtc/android')
21-
22-
- And include the library in your dependencies in android/app/build.gradle:
23-
24-
dependencies {
25-
.....
26-
.....
27-
.....
28-
compile project(':react-native-twilio-video-webrtc')
29-
}
30-
31-
- Now you're ready to load the package in MainApplication.java. In the imports section, add this:
32-
33-
import com.twiliorn.library.TwilioPackage;
34-
35-
- Then update the getPackages() method:
36-
37-
protected List<ReactPackage> getPackages() {
38-
return Arrays.<ReactPackage>asList(
39-
...
40-
new TwilioPackage()
41-
);
42-
}
43-
44-
- Permissions
45-
- For most applications, you'll want to add camera and audio permissions to your AndroidManifest.xml file:
46-
47-
<uses-permission android:name="android.permission.CAMERA" />
48-
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
49-
<uses-permission android:name="android.permission.RECORD_AUDIO" />
50-
<uses-feature android:name="android.hardware.camera" android:required="false" />
51-
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
52-
<uses-feature android:name="android.hardware.microphone" android:required="false" />
53-
54-
- Additional Tips
55-
- Under default settings, the Android build will fail if the total number of symbols exceeds a certain threshold. If you should encounter this issue when adding this library (e.g., if your build fails with com.android.dex.DexIndexOverflowException), you can turn on jumbo mode by editing your app/build.gradle:
56-
57-
android {
58-
...
59-
dexOptions {
60-
jumboMode true
61-
}
62-
}
63-
64-
- If you are using proguard (very likely), you will also need to ensure that the symbols needed by this library are not stripped. To do that, add these two lines to proguard-rules.pro:
65-
66-
-keep class org.webrtc.** { *; }
67-
-keep class com.twilio.** { *; }
68-
-keep class tvi.webrtc.** { *; }
69-
*/
70-
711
const {
722
withInfoPlist,
733
withAndroidManifest,
74-
withAppBuildGradle,
75-
withSettingsGradle,
764
withDangerousMod,
775
} = require('@expo/config-plugins');
786
const {
@@ -84,75 +12,11 @@ const path = require("path");
8412
const CAMERA_USAGE = 'Allow $(PRODUCT_NAME) to use the camera';
8513
const MIC_USAGE = 'Allow $(PRODUCT_NAME) to use the microphone';
8614

87-
// Helper function to replace text in AppDelegate etc. by target anchors in the text, making it more robust
88-
// when new native modules are installed as the text is always inserted as specified before / after the anchors
89-
function InsertLinesHelper(insert, target, contents, offset = 1, replace = 0) {
90-
// Check that what you want to insert does not already exist
91-
if (!contents.includes(insert)) {
92-
const array = contents.split("\n");
93-
94-
let newArray = [];
95-
96-
if (target == "start") {
97-
newArray = [...array.slice(0, 1), insert, ...array.slice(1)];
98-
} else if (target == "end") {
99-
newArray = [...array, insert];
100-
} else {
101-
// Find the index of the target text you want to anchor your insert on
102-
let index = array.findIndex((str) => {
103-
return str.includes(target);
104-
});
105-
106-
// Insert the wanted text around this anchor (i.e. offset / replace options)
107-
newArray = [
108-
...array.slice(0, index + offset),
109-
insert,
110-
...array.slice(index + offset + replace),
111-
];
112-
}
113-
114-
return newArray.join("\n");
115-
} else {
116-
return contents;
117-
}
118-
}
11915

12016
const withTwilioVideoWebRTC = (
12117
config,
122-
{ cameraUsagePermission, micUsagePermission, addJumboMode } = {},
18+
{ cameraUsagePermission, micUsagePermission } = {},
12319
) => {
124-
// Add package to Podfile
125-
/*config = withDangerousMod(config, [
126-
"ios",
127-
async (config) => {
128-
const filePath = path.join(
129-
config.modRequest.platformProjectRoot,
130-
"Podfile"
131-
);
132-
const contents = fs.readFileSync(filePath, "utf-8");
133-
134-
const addTwilioVideo = mergeContents({
135-
tag: "react-native-twilio-video-webrtc",
136-
src: contents,
137-
newSrc: ` pod 'react-native-twilio-video-webrtc', path: '../node_modules/react-native-twilio-video-webrtc'`,
138-
anchor: /use_react_native!\(/i,
139-
offset: 0,
140-
comment: "#",
141-
});
142-
143-
if (!addTwilioVideo.didMerge) {
144-
console.log(
145-
"ERROR: Cannot add react-native-twilio-video-webrtc to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile."
146-
);
147-
return config;
148-
}
149-
150-
fs.writeFileSync(filePath, addTwilioVideo.contents);
151-
152-
return config;
153-
},
154-
]);*/
155-
15620
// Add permissions to Info.plist
15721
config = withInfoPlist(config, (config) => {
15822
config.modResults.NSCameraUsageDescription =
@@ -168,29 +32,6 @@ const withTwilioVideoWebRTC = (
16832
return config;
16933
});
17034

171-
// Add package to settings.gradle
172-
/*config = withSettingsGradle(config, (config) => {
173-
const addTwilioVideo = mergeContents({
174-
tag: "react-native-twilio-video-webrtc",
175-
src: config.modResults.contents,
176-
newSrc: "\ninclude ':react-native-twilio-video-webrtc'\nproject(':react-native-twilio-video-webrtc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twilio-video-webrtc/android')\n",
177-
anchor: "include ':app'",
178-
offset: 0,
179-
comment: "//",
180-
});
181-
182-
if (!addTwilioVideo.didMerge) {
183-
console.log(
184-
`ERROR: Cannot add react-native-twilio-video-webrtc to the project's ${config.modResults.path} because it's malformed. Please report this with a copy of your project ${config.modResults.path}.`
185-
);
186-
return config;
187-
}
188-
189-
config.modResults.contents = addTwilioVideo.contents;
190-
191-
return config;
192-
});*/
193-
19435
// Add permissions to AndroidManifest
19536
config = withAndroidManifest(config, (config) => {
19637
const permissions = [
@@ -232,22 +73,6 @@ const withTwilioVideoWebRTC = (
23273
return config;
23374
});
23475

235-
// Add jumboMode to build.gradle
236-
/*if(addJumboMode) {
237-
config = withAppBuildGradle(config, (config) => {
238-
const buildGradle = config.modResults.buildGradle;
239-
const jumboMode = `
240-
jumboMode {
241-
enabled = true
242-
}
243-
`;
244-
245-
buildGradle.push(jumboMode);
246-
247-
return config;
248-
});
249-
}*/
250-
25176
// Add rules to proguard-rules.pro
25277
config = withDangerousMod(config, [
25378
"android",

0 commit comments

Comments
 (0)