mirror of
https://github.com/expo/config-plugins.git
synced 2026-11-14 10:08:06 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ecaaf5bd9 |
No files matched your search
@@ -1,3 +1,10 @@
|
|||||||
|
### @config-plugins/react-native-callkeep [1.0.2](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-03-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Other chores
|
||||||
|
|
||||||
|
* git ignore build folders ([#59](https://github.com/expo/config-plugins/issues/59)) ([d6050be](https://github.com/expo/config-plugins/commit/d6050beb2a5c68dc59287c27ec388c2002ec7904))
|
||||||
|
|
||||||
### @config-plugins/react-native-callkeep [1.0.1](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-03-16)
|
### @config-plugins/react-native-callkeep [1.0.1](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
import { XcodeProject } from "@expo/config-plugins";
|
||||||
|
export declare function ensureHeaderSearchPath(project: XcodeProject, file: string): void;
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.ensureHeaderSearchPath = void 0;
|
||||||
|
const COMMENT_KEY = /_comment$/;
|
||||||
|
function unquote(str) {
|
||||||
|
if (str)
|
||||||
|
return str.replace(/^"(.*)"$/, "$1");
|
||||||
|
}
|
||||||
|
function nonComments(obj) {
|
||||||
|
var keys = Object.keys(obj), newObj = {}, i = 0;
|
||||||
|
for (i; i < keys.length; i++) {
|
||||||
|
if (!COMMENT_KEY.test(keys[i])) {
|
||||||
|
newObj[keys[i]] = obj[keys[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newObj;
|
||||||
|
}
|
||||||
|
function ensureHeaderSearchPath(project, file) {
|
||||||
|
const configurations = nonComments(project.pbxXCBuildConfigurationSection());
|
||||||
|
const INHERITED = '"$(inherited)"';
|
||||||
|
for (const config in configurations) {
|
||||||
|
const buildSettings = configurations[config].buildSettings;
|
||||||
|
if (unquote(buildSettings["PRODUCT_NAME"]) != project.productName)
|
||||||
|
continue;
|
||||||
|
if (!buildSettings["HEADER_SEARCH_PATHS"]) {
|
||||||
|
buildSettings["HEADER_SEARCH_PATHS"] = [INHERITED];
|
||||||
|
}
|
||||||
|
if (!buildSettings.HEADER_SEARCH_PATHS.includes(file)) {
|
||||||
|
buildSettings["HEADER_SEARCH_PATHS"].push(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ensureHeaderSearchPath = ensureHeaderSearchPath;
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
import { ConfigPlugin } from "@expo/config-plugins";
|
||||||
|
declare const withCallkeep: ConfigPlugin;
|
||||||
|
export declare const withXcodeLinkBinaryWithLibraries: ConfigPlugin<{
|
||||||
|
library: string;
|
||||||
|
status?: string;
|
||||||
|
}>;
|
||||||
|
export default withCallkeep;
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.withXcodeLinkBinaryWithLibraries = void 0;
|
||||||
|
const config_plugins_1 = require("@expo/config-plugins");
|
||||||
|
const ensureHeaderSearchPath_1 = require("./ensureHeaderSearchPath");
|
||||||
|
const withCallkeepHeaderSearchPath = (config) => {
|
||||||
|
const headerSearchPath = `"$(SRCROOT)/../node_modules/react-native-callkeep/ios/RNCallKeep"`;
|
||||||
|
return config_plugins_1.withXcodeProject(config, (config) => {
|
||||||
|
ensureHeaderSearchPath_1.ensureHeaderSearchPath(config.modResults, headerSearchPath);
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const withAndroidManifestService = (config) => {
|
||||||
|
return config_plugins_1.withAndroidManifest(config, (config) => {
|
||||||
|
// <service
|
||||||
|
// android:name="io.wazo.callkeep.VoiceConnectionService"
|
||||||
|
// android:label="Wazo"
|
||||||
|
// android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
|
||||||
|
// // Use this to target android >= 11
|
||||||
|
// android:foregroundServiceType="camera|microphone"
|
||||||
|
// // For android < 11
|
||||||
|
// android:foregroundServiceType="phoneCall"
|
||||||
|
// >
|
||||||
|
// <intent-filter>
|
||||||
|
// <action android:name="android.telecom.ConnectionService" />
|
||||||
|
// </intent-filter>
|
||||||
|
// </service>;
|
||||||
|
const app = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
|
||||||
|
if (!Array.isArray(app.service))
|
||||||
|
app.service = [];
|
||||||
|
if (!app.service.find((item) => item.$["android:name"] ===
|
||||||
|
"io.wazo.callkeep.RNCallKeepBackgroundMessagingService")) {
|
||||||
|
app.service.push({
|
||||||
|
$: {
|
||||||
|
"android:name": "io.wazo.callkeep.RNCallKeepBackgroundMessagingService",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// TODO: Update item
|
||||||
|
if (!app.service.find((item) => item.$["android:name"] === "io.wazo.callkeep.VoiceConnectionService")) {
|
||||||
|
app.service.push({
|
||||||
|
$: {
|
||||||
|
"android:name": "io.wazo.callkeep.VoiceConnectionService",
|
||||||
|
// @ts-ignore
|
||||||
|
"android:label": "Wazo",
|
||||||
|
"android:permission": "android.permission.BIND_TELECOM_CONNECTION_SERVICE",
|
||||||
|
// Use this to target android >= 11
|
||||||
|
// "android:foregroundServiceType": "camera|microphone",
|
||||||
|
// For android < 11
|
||||||
|
"android:foregroundServiceType": "phoneCall",
|
||||||
|
},
|
||||||
|
"intent-filter": [
|
||||||
|
{
|
||||||
|
action: [
|
||||||
|
{
|
||||||
|
$: {
|
||||||
|
"android:name": "android.telecom.ConnectionService",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const withCallkeep = (config) => {
|
||||||
|
config = config_plugins_1.withInfoPlist(config, (config) => {
|
||||||
|
if (!Array.isArray(config.modResults.UIBackgroundModes)) {
|
||||||
|
config.modResults.UIBackgroundModes = [];
|
||||||
|
}
|
||||||
|
if (!config.modResults.UIBackgroundModes.includes("voip")) {
|
||||||
|
config.modResults.UIBackgroundModes.push("voip");
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
config = withCallkeepHeaderSearchPath(config);
|
||||||
|
config = exports.withXcodeLinkBinaryWithLibraries(config, {
|
||||||
|
library: "Intents.framework",
|
||||||
|
status: "optional",
|
||||||
|
});
|
||||||
|
config = exports.withXcodeLinkBinaryWithLibraries(config, {
|
||||||
|
library: "CallKit.framework",
|
||||||
|
});
|
||||||
|
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
||||||
|
"android.permission.BIND_TELECOM_CONNECTION_SERVICE",
|
||||||
|
"android.permission.FOREGROUND_SERVICE",
|
||||||
|
"android.permission.READ_PHONE_STATE",
|
||||||
|
"android.permission.CALL_PHONE",
|
||||||
|
]);
|
||||||
|
config = withAndroidManifestService(config);
|
||||||
|
return config;
|
||||||
|
};
|
||||||
|
const withXcodeLinkBinaryWithLibraries = (config, { library, status }) => {
|
||||||
|
return config_plugins_1.withXcodeProject(config, (config) => {
|
||||||
|
const options = status === "optional" ? { weak: true } : {};
|
||||||
|
const target = config_plugins_1.IOSConfig.XcodeUtils.getApplicationNativeTarget({
|
||||||
|
project: config.modResults,
|
||||||
|
projectName: config.modRequest.projectName,
|
||||||
|
});
|
||||||
|
config.modResults.addFramework(library, {
|
||||||
|
target: target.uuid,
|
||||||
|
...options,
|
||||||
|
});
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
exports.withXcodeLinkBinaryWithLibraries = withXcodeLinkBinaryWithLibraries;
|
||||||
|
exports.default = withCallkeep;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@config-plugins/react-native-callkeep",
|
"name": "@config-plugins/react-native-callkeep",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "Config plugin to auto configure callkeep on prebuild",
|
"description": "Config plugin to auto configure callkeep on prebuild",
|
||||||
"main": "build/withCallkeep.js",
|
"main": "build/withCallkeep.js",
|
||||||
"types": "build/withCallkeep.d.ts",
|
"types": "build/withCallkeep.d.ts",
|
||||||
|
|||||||
Reference in new issue
Block a user