This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withAdMob: import("..").ConfigPlugin<void>;
export declare function getGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'ios'>, { GADApplicationIdentifier, ...infoPlist }: InfoPlist): InfoPlist;

41
node_modules/@expo/config-plugins/build/ios/AdMob.js generated vendored Normal file
View File

@ -0,0 +1,41 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withAdMob = ios_plugins_1.createInfoPlistPlugin(setAdMobConfig, 'withAdMob');
// NOTE(brentvatne): if the developer has installed the google ads sdk and does
// not provide an app id their app will crash. Standalone apps get around this by
// providing some default value, we will instead here assume that the user can
// do the right thing if they have installed the package. This is a slight discrepancy
// that arises in ejecting because it's possible for the package to be installed and
// not crashing in the managed workflow, then you eject and the app crashes because
// you don't have an id to fall back to.
function getGoogleMobileAdsAppId(config) {
var _a, _b, _c;
return (_c = (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.googleMobileAdsAppId) !== null && _c !== void 0 ? _c : null;
}
exports.getGoogleMobileAdsAppId = getGoogleMobileAdsAppId;
function setGoogleMobileAdsAppId(config, _a) {
var { GADApplicationIdentifier } = _a, infoPlist = __rest(_a, ["GADApplicationIdentifier"]);
const appId = getGoogleMobileAdsAppId(config);
if (appId === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { GADApplicationIdentifier: appId });
}
exports.setGoogleMobileAdsAppId = setGoogleMobileAdsAppId;
function setAdMobConfig(config, infoPlist) {
infoPlist = setGoogleMobileAdsAppId(config, infoPlist);
return infoPlist;
}
//# sourceMappingURL=AdMob.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"AdMob.js","sourceRoot":"","sources":["../../src/ios/AdMob.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,wDAA+D;AAGlD,QAAA,SAAS,GAAG,mCAAqB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAE5E,+EAA+E;AAC/E,iFAAiF;AACjF,8EAA8E;AAC9E,sFAAsF;AACtF,oFAAoF;AACpF,mFAAmF;AACnF,wCAAwC;AACxC,SAAgB,uBAAuB,CAAC,MAA+B;;IACrE,yBAAO,MAAM,CAAC,GAAG,0CAAE,MAAM,0CAAE,oBAAoB,mCAAI,IAAI,CAAC;AAC1D,CAAC;AAFD,0DAEC;AAED,SAAgB,uBAAuB,CACrC,MAA+B,EAC/B,EAAqD;QAArD,EAAE,wBAAwB,OAA2B,EAAzB,oDAAY;IAExC,MAAM,KAAK,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAE9C,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,SAAS,KACZ,wBAAwB,EAAE,KAAK,IAC/B;AACJ,CAAC;AAdD,0DAcC;AAED,SAAS,cAAc,CAAC,MAA+B,EAAE,SAAoB;IAC3E,SAAS,GAAG,uBAAuB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withAdMob = createInfoPlistPlugin(setAdMobConfig, 'withAdMob');\n\n// NOTE(brentvatne): if the developer has installed the google ads sdk and does\n// not provide an app id their app will crash. Standalone apps get around this by\n// providing some default value, we will instead here assume that the user can\n// do the right thing if they have installed the package. This is a slight discrepancy\n// that arises in ejecting because it's possible for the package to be installed and\n// not crashing in the managed workflow, then you eject and the app crashes because\n// you don't have an id to fall back to.\nexport function getGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMobileAdsAppId ?? null;\n}\n\nexport function setGoogleMobileAdsAppId(\n config: Pick<ExpoConfig, 'ios'>,\n { GADApplicationIdentifier, ...infoPlist }: InfoPlist\n): InfoPlist {\n const appId = getGoogleMobileAdsAppId(config);\n\n if (appId === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GADApplicationIdentifier: appId,\n };\n}\n\nfunction setAdMobConfig(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n infoPlist = setGoogleMobileAdsAppId(config, infoPlist);\n return infoPlist;\n}\n"]}

View File

@ -0,0 +1,27 @@
export declare type ContentsJsonImageIdiom = 'iphone' | 'ipad' | 'ios-marketing' | 'universal';
export declare type ContentsJsonImageAppearance = {
appearance: 'luminosity';
value: 'dark';
};
export declare type ContentsJsonImageScale = '1x' | '2x' | '3x';
export interface ContentsJsonImage {
appearances?: ContentsJsonImageAppearance[];
idiom: ContentsJsonImageIdiom;
size?: string;
scale: ContentsJsonImageScale;
filename?: string;
}
export interface ContentsJson {
images: ContentsJsonImage[];
info: {
version: number;
author: string;
};
}
/**
* Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.
*
* @param directory path to add the Contents.json to.
* @param contents image json data
*/
export declare function writeContentsJsonAsync(directory: string, { images }: Pick<ContentsJson, 'images'>): Promise<void>;

View File

@ -0,0 +1,26 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = require("path");
/**
* Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.
*
* @param directory path to add the Contents.json to.
* @param contents image json data
*/
async function writeContentsJsonAsync(directory, { images }) {
await fs_extra_1.default.ensureDir(directory);
await fs_extra_1.default.writeFile(path_1.join(directory, 'Contents.json'), JSON.stringify({
images,
info: {
version: 1,
// common practice is for the tool that generated the icons to be the "author"
author: 'expo',
},
}, null, 2));
}
exports.writeContentsJsonAsync = writeContentsJsonAsync;
//# sourceMappingURL=AssetContents.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"AssetContents.js","sourceRoot":"","sources":["../../src/ios/AssetContents.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAC1B,+BAA4B;AA2B5B;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAC1C,SAAiB,EACjB,EAAE,MAAM,EAAgC;IAExC,MAAM,kBAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAE9B,MAAM,kBAAE,CAAC,SAAS,CAChB,WAAI,CAAC,SAAS,EAAE,eAAe,CAAC,EAChC,IAAI,CAAC,SAAS,CACZ;QACE,MAAM;QACN,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC;YACV,8EAA8E;YAC9E,MAAM,EAAE,MAAM;SACf;KACF,EACD,IAAI,EACJ,CAAC,CACF,CACF,CAAC;AACJ,CAAC;AArBD,wDAqBC","sourcesContent":["import fs from 'fs-extra';\nimport { join } from 'path';\n\nexport type ContentsJsonImageIdiom = 'iphone' | 'ipad' | 'ios-marketing' | 'universal';\n\nexport type ContentsJsonImageAppearance = {\n appearance: 'luminosity';\n value: 'dark';\n};\n\nexport type ContentsJsonImageScale = '1x' | '2x' | '3x';\n\nexport interface ContentsJsonImage {\n appearances?: ContentsJsonImageAppearance[];\n idiom: ContentsJsonImageIdiom;\n size?: string;\n scale: ContentsJsonImageScale;\n filename?: string;\n}\n\nexport interface ContentsJson {\n images: ContentsJsonImage[];\n info: {\n version: number;\n author: string;\n };\n}\n\n/**\n * Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.\n *\n * @param directory path to add the Contents.json to.\n * @param contents image json data\n */\nexport async function writeContentsJsonAsync(\n directory: string,\n { images }: Pick<ContentsJson, 'images'>\n): Promise<void> {\n await fs.ensureDir(directory);\n\n await fs.writeFile(\n join(directory, 'Contents.json'),\n JSON.stringify(\n {\n images,\n info: {\n version: 1,\n // common practice is for the tool that generated the icons to be the \"author\"\n author: 'expo',\n },\n },\n null,\n 2\n )\n );\n}\n"]}

View File

@ -0,0 +1,5 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withBranch: import("..").ConfigPlugin<void>;
export declare function getBranchApiKey(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setBranchApiKey(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;

20
node_modules/@expo/config-plugins/build/ios/Branch.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withBranch = ios_plugins_1.createInfoPlistPlugin(setBranchApiKey, 'withBranch');
function getBranchApiKey(config) {
var _a, _b, _c, _d;
return (_d = (_c = (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.branch) === null || _c === void 0 ? void 0 : _c.apiKey) !== null && _d !== void 0 ? _d : null;
}
exports.getBranchApiKey = getBranchApiKey;
function setBranchApiKey(config, infoPlist) {
const apiKey = getBranchApiKey(config);
if (apiKey === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { branch_key: {
live: apiKey,
} });
}
exports.setBranchApiKey = setBranchApiKey;
//# sourceMappingURL=Branch.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Branch.js","sourceRoot":"","sources":["../../src/ios/Branch.ts"],"names":[],"mappings":";;AAEA,wDAA+D;AAGlD,QAAA,UAAU,GAAG,mCAAqB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAE/E,SAAgB,eAAe,CAAC,MAA+B;;IAC7D,+BAAO,MAAM,CAAC,GAAG,0CAAE,MAAM,0CAAE,MAAM,0CAAE,MAAM,mCAAI,IAAI,CAAC;AACpD,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe,CAAC,MAA+B,EAAE,SAAoB;IACnF,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEvC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,SAAS,KACZ,UAAU,EAAE;YACV,IAAI,EAAE,MAAM;SACb,IACD;AACJ,CAAC;AAbD,0CAaC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withBranch = createInfoPlistPlugin(setBranchApiKey, 'withBranch');\n\nexport function getBranchApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.branch?.apiKey ?? null;\n}\n\nexport function setBranchApiKey(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n const apiKey = getBranchApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n branch_key: {\n live: apiKey,\n },\n };\n}\n"]}

View File

@ -0,0 +1,2 @@
export declare function getSchemesFromXcodeproj(projectRoot: string): string[];
export declare function getApplicationTargetForSchemeAsync(projectRoot: string, scheme: string): Promise<string>;

View File

@ -0,0 +1,40 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const XML_1 = require("../utils/XML");
const Paths_1 = require("./Paths");
function getSchemesFromXcodeproj(projectRoot) {
return Paths_1.findSchemeNames(projectRoot);
}
exports.getSchemesFromXcodeproj = getSchemesFromXcodeproj;
async function getApplicationTargetForSchemeAsync(projectRoot, scheme) {
var _a, _b, _c, _d, _e;
const allSchemePaths = Paths_1.findSchemePaths(projectRoot);
const re = new RegExp(`/${scheme}.xcscheme`);
const schemePath = allSchemePaths.find(i => re.exec(i));
if (!schemePath) {
throw new Error(`scheme '${scheme}' does not exist`);
}
const schemeXML = (await XML_1.readXMLAsync({ path: schemePath }));
const buildActionEntry = (_e = (_d = (_c = (_b = (_a = schemeXML.Scheme) === null || _a === void 0 ? void 0 : _a.BuildAction) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.BuildActionEntries) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.BuildActionEntry;
const targetName = (buildActionEntry === null || buildActionEntry === void 0 ? void 0 : buildActionEntry.length) === 1
? getBlueprintName(buildActionEntry[0])
: getBlueprintName(buildActionEntry === null || buildActionEntry === void 0 ? void 0 : buildActionEntry.find(entry => {
var _a, _b, _c, _d;
return (_d = (_c = (_b = (_a = entry.BuildableReference) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b['$']) === null || _c === void 0 ? void 0 : _c.BuildableName) === null || _d === void 0 ? void 0 : _d.endsWith('.app');
}));
if (!targetName) {
const schemeRelativePath = path_1.default.relative(projectRoot, schemePath);
throw new Error(`${schemeRelativePath} seems to be corrupted`);
}
return targetName;
}
exports.getApplicationTargetForSchemeAsync = getApplicationTargetForSchemeAsync;
function getBlueprintName(entry) {
var _a, _b, _c;
return (_c = (_b = (_a = entry === null || entry === void 0 ? void 0 : entry.BuildableReference) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b['$']) === null || _c === void 0 ? void 0 : _c.BlueprintName;
}
//# sourceMappingURL=BuildScheme.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"BuildScheme.js","sourceRoot":"","sources":["../../src/ios/BuildScheme.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,sCAA4C;AAC5C,mCAA2D;AAqB3D,SAAgB,uBAAuB,CAAC,WAAmB;IACzD,OAAO,uBAAe,CAAC,WAAW,CAAC,CAAC;AACtC,CAAC;AAFD,0DAEC;AAEM,KAAK,UAAU,kCAAkC,CACtD,WAAmB,EACnB,MAAc;;IAEd,MAAM,cAAc,GAAG,uBAAe,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,WAAW,MAAM,kBAAkB,CAAC,CAAC;KACtD;IAED,MAAM,SAAS,GAAI,CAAC,MAAM,kBAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAA0B,CAAC;IACvF,MAAM,gBAAgB,iCACpB,SAAS,CAAC,MAAM,0CAAE,WAAW,0CAAG,CAAC,2CAAG,kBAAkB,0CAAG,CAAC,2CAAG,gBAAgB,CAAC;IAChF,MAAM,UAAU,GACd,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAM,MAAK,CAAC;QAC5B,CAAC,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,gBAAgB,CACd,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,CAAC,KAAK,CAAC,EAAE;;YAC7B,+BAAO,KAAK,CAAC,kBAAkB,0CAAG,CAAC,2CAAI,GAAG,2CAAG,aAAa,0CAAE,QAAQ,CAAC,MAAM,EAAE;QAC/E,CAAC,EACF,CAAC;IACR,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,kBAAkB,GAAG,cAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,GAAG,kBAAkB,wBAAwB,CAAC,CAAC;KAChE;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AA3BD,gFA2BC;AAED,SAAS,gBAAgB,CAAC,KAA4B;;IACpD,yBAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,kBAAkB,0CAAG,CAAC,2CAAI,GAAG,2CAAG,aAAa,CAAC;AAC9D,CAAC","sourcesContent":["import path from 'path';\n\nimport { readXMLAsync } from '../utils/XML';\nimport { findSchemeNames, findSchemePaths } from './Paths';\n\ninterface SchemeXML {\n Scheme?: {\n BuildAction?: {\n BuildActionEntries?: {\n BuildActionEntry?: BuildActionEntryType[];\n }[];\n }[];\n };\n}\n\ninterface BuildActionEntryType {\n BuildableReference?: {\n $?: {\n BlueprintName?: string;\n BuildableName?: string;\n };\n }[];\n}\n\nexport function getSchemesFromXcodeproj(projectRoot: string): string[] {\n return findSchemeNames(projectRoot);\n}\n\nexport async function getApplicationTargetForSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<string> {\n const allSchemePaths = findSchemePaths(projectRoot);\n const re = new RegExp(`/${scheme}.xcscheme`);\n const schemePath = allSchemePaths.find(i => re.exec(i));\n if (!schemePath) {\n throw new Error(`scheme '${scheme}' does not exist`);\n }\n\n const schemeXML = ((await readXMLAsync({ path: schemePath })) as unknown) as SchemeXML;\n const buildActionEntry =\n schemeXML.Scheme?.BuildAction?.[0]?.BuildActionEntries?.[0]?.BuildActionEntry;\n const targetName =\n buildActionEntry?.length === 1\n ? getBlueprintName(buildActionEntry[0])\n : getBlueprintName(\n buildActionEntry?.find(entry => {\n return entry.BuildableReference?.[0]?.['$']?.BuildableName?.endsWith('.app');\n })\n );\n if (!targetName) {\n const schemeRelativePath = path.relative(projectRoot, schemePath);\n throw new Error(`${schemeRelativePath} seems to be corrupted`);\n }\n return targetName;\n}\n\nfunction getBlueprintName(entry?: BuildActionEntryType): string | undefined {\n return entry?.BuildableReference?.[0]?.['$']?.BlueprintName;\n}\n"]}

View File

@ -0,0 +1,40 @@
import { ExpoConfig } from '@expo/config-types';
import { ConfigPlugin } from '../Plugin.types';
import { InfoPlist } from './IosConfig.types';
export declare const withBundleIdentifier: ConfigPlugin<{
bundleIdentifier?: string;
}>;
declare function getBundleIdentifier(config: ExpoConfig): string | null;
/**
* In Turtle v1 we set the bundleIdentifier directly on Info.plist rather
* than in pbxproj
*/
declare function setBundleIdentifier(config: ExpoConfig, infoPlist: InfoPlist): InfoPlist;
/**
* Gets the bundle identifier of the Xcode project found in the project directory.
* If either the Xcode project doesn't exist or the project is not configured
* this function returns null.
*
* @param {string} projectRoot Path to project root containing the ios directory
* @returns {string | null} bundle identifier of the Xcode project or null if the project is not configured
*/
declare function getBundleIdentifierFromPbxproj(projectRoot: string): string | null;
/**
* Updates the bundle identifier for a given pbxproj
*
* @param {string} pbxprojPath Path to pbxproj file
* @param {string} bundleIdentifier Bundle identifier to set in the pbxproj
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
declare function updateBundleIdentifierForPbxproj(pbxprojPath: string, bundleIdentifier: string, updateProductName?: boolean): void;
/**
* Updates the bundle identifier for pbx projects inside the ios directory of the given project root
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {string} bundleIdentifier Desired bundle identifier
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
declare function setBundleIdentifierForPbxproj(projectRoot: string, bundleIdentifier: string, updateProductName?: boolean): void;
declare function resetAllPlistBundleIdentifiers(projectRoot: string): void;
declare function resetPlistBundleIdentifier(plistPath: string): void;
export { getBundleIdentifier, setBundleIdentifier, getBundleIdentifierFromPbxproj, updateBundleIdentifierForPbxproj, setBundleIdentifierForPbxproj, resetAllPlistBundleIdentifiers, resetPlistBundleIdentifier, };

View File

@ -0,0 +1,152 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const plist_1 = __importDefault(require("@expo/plist"));
const assert_1 = __importDefault(require("assert"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const xcode_1 = __importDefault(require("xcode"));
const core_plugins_1 = require("../plugins/core-plugins");
const Paths_1 = require("./Paths");
const Xcodeproj_1 = require("./utils/Xcodeproj");
exports.withBundleIdentifier = (config, { bundleIdentifier }) => {
return core_plugins_1.withDangerousMod(config, [
'ios',
async (config) => {
var _a;
const bundleId = bundleIdentifier !== null && bundleIdentifier !== void 0 ? bundleIdentifier : (_a = config.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier;
assert_1.default(bundleId, '`bundleIdentifier` must be defined in the app config (`expo.ios.bundleIdentifier`) or passed to the plugin `withBundleIdentifier`.');
await setBundleIdentifierForPbxproj(config.modRequest.projectRoot, bundleId);
return config;
},
]);
};
function getBundleIdentifier(config) {
var _a, _b;
return (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier) !== null && _b !== void 0 ? _b : null;
}
exports.getBundleIdentifier = getBundleIdentifier;
/**
* In Turtle v1 we set the bundleIdentifier directly on Info.plist rather
* than in pbxproj
*/
function setBundleIdentifier(config, infoPlist) {
const bundleIdentifier = getBundleIdentifier(config);
if (!bundleIdentifier) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { CFBundleIdentifier: bundleIdentifier });
}
exports.setBundleIdentifier = setBundleIdentifier;
/**
* Gets the bundle identifier of the Xcode project found in the project directory.
* If either the Xcode project doesn't exist or the project is not configured
* this function returns null.
*
* @param {string} projectRoot Path to project root containing the ios directory
* @returns {string | null} bundle identifier of the Xcode project or null if the project is not configured
*/
function getBundleIdentifierFromPbxproj(projectRoot) {
let pbxprojPath;
try {
pbxprojPath = Paths_1.getPBXProjectPath(projectRoot);
}
catch (_a) {
return null;
}
const project = xcode_1.default.project(pbxprojPath);
project.parseSync();
const [, nativeTarget] = Xcodeproj_1.findFirstNativeTarget(project);
for (const [, item] of Xcodeproj_1.getBuildConfigurationForId(project, nativeTarget.buildConfigurationList)) {
const bundleIdentifierRaw = item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER;
if (bundleIdentifierRaw) {
const bundleIdentifier = bundleIdentifierRaw[0] === '"' ? bundleIdentifierRaw.slice(1, -1) : bundleIdentifierRaw;
// it's possible to use interpolation for the bundle identifier
// the most common case is when the last part of the id is set to `$(PRODUCT_NAME:rfc1034identifier)`
// in this case, PRODUCT_NAME should be replaced with its value
// the `rfc1034identifier` modifier replaces all non-alphanumeric characters with dashes
const bundleIdentifierParts = bundleIdentifier.split('.');
if (bundleIdentifierParts[bundleIdentifierParts.length - 1] ===
'$(PRODUCT_NAME:rfc1034identifier)' &&
item.buildSettings.PRODUCT_NAME) {
bundleIdentifierParts[bundleIdentifierParts.length - 1] = item.buildSettings.PRODUCT_NAME.replace(/[^a-zA-Z0-9]/g, '-');
}
return bundleIdentifierParts.join('.');
}
}
return null;
}
exports.getBundleIdentifierFromPbxproj = getBundleIdentifierFromPbxproj;
/**
* Updates the bundle identifier for a given pbxproj
*
* @param {string} pbxprojPath Path to pbxproj file
* @param {string} bundleIdentifier Bundle identifier to set in the pbxproj
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
function updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateProductName = true) {
const project = xcode_1.default.project(pbxprojPath);
project.parseSync();
const [, nativeTarget] = Xcodeproj_1.findFirstNativeTarget(project);
Xcodeproj_1.getBuildConfigurationForId(project, nativeTarget.buildConfigurationList).forEach(([, item]) => {
if (item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER === bundleIdentifier) {
return;
}
item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER = `"${bundleIdentifier}"`;
if (updateProductName) {
const productName = bundleIdentifier.split('.').pop();
if (!(productName === null || productName === void 0 ? void 0 : productName.includes('$'))) {
item.buildSettings.PRODUCT_NAME = productName;
}
}
});
fs_extra_1.default.writeFileSync(pbxprojPath, project.writeSync());
}
exports.updateBundleIdentifierForPbxproj = updateBundleIdentifierForPbxproj;
/**
* Updates the bundle identifier for pbx projects inside the ios directory of the given project root
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {string} bundleIdentifier Desired bundle identifier
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
function setBundleIdentifierForPbxproj(projectRoot, bundleIdentifier, updateProductName = true) {
// Get all pbx projects in the ${projectRoot}/ios directory
let pbxprojPaths = [];
try {
pbxprojPaths = Paths_1.getAllPBXProjectPaths(projectRoot);
}
catch (_a) { }
for (const pbxprojPath of pbxprojPaths) {
updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateProductName);
}
}
exports.setBundleIdentifierForPbxproj = setBundleIdentifierForPbxproj;
/**
* Reset bundle identifier field in Info.plist to use PRODUCT_BUNDLE_IDENTIFIER, as recommended by Apple.
*/
const defaultBundleId = '$(PRODUCT_BUNDLE_IDENTIFIER)';
function resetAllPlistBundleIdentifiers(projectRoot) {
const infoPlistPaths = Paths_1.getAllInfoPlistPaths(projectRoot);
for (const plistPath of infoPlistPaths) {
resetPlistBundleIdentifier(plistPath);
}
}
exports.resetAllPlistBundleIdentifiers = resetAllPlistBundleIdentifiers;
function resetPlistBundleIdentifier(plistPath) {
const rawPlist = fs_extra_1.default.readFileSync(plistPath, 'utf8');
const plistObject = plist_1.default.parse(rawPlist);
if (plistObject.CFBundleIdentifier) {
if (plistObject.CFBundleIdentifier === defaultBundleId)
return;
// attempt to match default Info.plist format
const format = { pretty: true, indent: `\t` };
const xml = plist_1.default.build(Object.assign(Object.assign({}, plistObject), { CFBundleIdentifier: defaultBundleId }), format);
if (xml !== rawPlist) {
fs_extra_1.default.writeFileSync(plistPath, xml);
}
}
}
exports.resetPlistBundleIdentifier = resetPlistBundleIdentifier;
//# sourceMappingURL=BundleIdentifier.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare function getCustomInfoPlistEntries(config: Pick<ExpoConfig, 'ios'>): {
[k: string]: any;
};
export declare function setCustomInfoPlistEntries(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;

View File

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getCustomInfoPlistEntries(config) {
var _a, _b;
return (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.infoPlist) !== null && _b !== void 0 ? _b : {};
}
exports.getCustomInfoPlistEntries = getCustomInfoPlistEntries;
function setCustomInfoPlistEntries(config, infoPlist) {
const entries = getCustomInfoPlistEntries(config);
return Object.assign(Object.assign({}, infoPlist), entries);
}
exports.setCustomInfoPlistEntries = setCustomInfoPlistEntries;
//# sourceMappingURL=CustomInfoPlistEntries.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"CustomInfoPlistEntries.js","sourceRoot":"","sources":["../../src/ios/CustomInfoPlistEntries.ts"],"names":[],"mappings":";;AAIA,SAAgB,yBAAyB,CAAC,MAA+B;;IACvE,mBAAO,MAAM,CAAC,GAAG,0CAAE,SAAS,mCAAI,EAAE,CAAC;AACrC,CAAC;AAFD,8DAEC;AAED,SAAgB,yBAAyB,CACvC,MAA+B,EAC/B,SAAoB;IAEpB,MAAM,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAElD,uCACK,SAAS,GACT,OAAO,EACV;AACJ,CAAC;AAVD,8DAUC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist } from './IosConfig.types';\n\nexport function getCustomInfoPlistEntries(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.infoPlist ?? {};\n}\n\nexport function setCustomInfoPlistEntries(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const entries = getCustomInfoPlistEntries(config);\n\n return {\n ...infoPlist,\n ...entries,\n };\n}\n"]}

View File

@ -0,0 +1,19 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
export declare const withDeviceFamily: ConfigPlugin;
export declare function getSupportsTablet(config: Pick<ExpoConfig, 'ios'>): boolean;
export declare function getIsTabletOnly(config: Pick<ExpoConfig, 'ios'>): boolean;
export declare function getDeviceFamilies(config: Pick<ExpoConfig, 'ios'>): number[];
/**
* Wrapping the families in double quotes is the only way to set a value with a comma in it.
*
* @param deviceFamilies
*/
export declare function formatDeviceFamilies(deviceFamilies: number[]): string;
/**
* Add to pbxproj under TARGETED_DEVICE_FAMILY
*/
export declare function setDeviceFamily(config: Pick<ExpoConfig, 'ios'>, { project }: {
project: XcodeProject;
}): XcodeProject;

View File

@ -0,0 +1,76 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
const WarningAggregator = __importStar(require("../utils/warnings"));
exports.withDeviceFamily = config => {
return ios_plugins_1.withXcodeProject(config, async (config) => {
config.modResults = await setDeviceFamily(config, {
project: config.modResults,
});
return config;
});
};
function getSupportsTablet(config) {
var _a;
return !!((_a = config.ios) === null || _a === void 0 ? void 0 : _a.supportsTablet);
}
exports.getSupportsTablet = getSupportsTablet;
function getIsTabletOnly(config) {
var _a;
return !!((_a = config === null || config === void 0 ? void 0 : config.ios) === null || _a === void 0 ? void 0 : _a.isTabletOnly);
}
exports.getIsTabletOnly = getIsTabletOnly;
function getDeviceFamilies(config) {
var _a;
const supportsTablet = getSupportsTablet(config);
const isTabletOnly = getIsTabletOnly(config);
if (isTabletOnly && ((_a = config.ios) === null || _a === void 0 ? void 0 : _a.supportsTablet) === false) {
WarningAggregator.addWarningIOS('device-family', `Found contradictory values: \`{ ios: { isTabletOnly: true, supportsTablet: false } }\`. Using \`{ isTabletOnly: true }\`.`);
}
// 1 is iPhone, 2 is iPad
if (isTabletOnly) {
return [2];
}
else if (supportsTablet) {
return [1, 2];
}
else {
// is iPhone only
return [1];
}
}
exports.getDeviceFamilies = getDeviceFamilies;
/**
* Wrapping the families in double quotes is the only way to set a value with a comma in it.
*
* @param deviceFamilies
*/
function formatDeviceFamilies(deviceFamilies) {
return `"${deviceFamilies.join(',')}"`;
}
exports.formatDeviceFamilies = formatDeviceFamilies;
/**
* Add to pbxproj under TARGETED_DEVICE_FAMILY
*/
function setDeviceFamily(config, { project }) {
const deviceFamilies = formatDeviceFamilies(getDeviceFamilies(config));
const configurations = project.pbxXCBuildConfigurationSection();
// @ts-ignore
for (const { buildSettings } of Object.values(configurations || {})) {
// Guessing that this is the best way to emulate Xcode.
// Using `project.addToBuildSettings` modifies too many targets.
if (typeof (buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.PRODUCT_NAME) !== 'undefined') {
buildSettings.TARGETED_DEVICE_FAMILY = deviceFamilies;
}
}
return project;
}
exports.setDeviceFamily = setDeviceFamily;
//# sourceMappingURL=DeviceFamily.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"DeviceFamily.js","sourceRoot":"","sources":["../../src/ios/DeviceFamily.ts"],"names":[],"mappings":";;;;;;;;;AAIA,wDAA0D;AAC1D,qEAAuD;AAE1C,QAAA,gBAAgB,GAAiB,MAAM,CAAC,EAAE;IACrD,OAAO,8BAAgB,CAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QAC7C,MAAM,CAAC,UAAU,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE;YAChD,OAAO,EAAE,MAAM,CAAC,UAAU;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,iBAAiB,CAAC,MAA+B;;IAC/D,OAAO,CAAC,QAAC,MAAM,CAAC,GAAG,0CAAE,cAAc,CAAA,CAAC;AACtC,CAAC;AAFD,8CAEC;AAED,SAAgB,eAAe,CAAC,MAA+B;;IAC7D,OAAO,CAAC,QAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,0CAAE,YAAY,CAAA,CAAC;AACrC,CAAC;AAFD,0CAEC;AAED,SAAgB,iBAAiB,CAAC,MAA+B;;IAC/D,MAAM,cAAc,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAE7C,IAAI,YAAY,IAAI,OAAA,MAAM,CAAC,GAAG,0CAAE,cAAc,MAAK,KAAK,EAAE;QACxD,iBAAiB,CAAC,aAAa,CAC7B,eAAe,EACf,2HAA2H,CAC5H,CAAC;KACH;IAED,yBAAyB;IACzB,IAAI,YAAY,EAAE;QAChB,OAAO,CAAC,CAAC,CAAC,CAAC;KACZ;SAAM,IAAI,cAAc,EAAE;QACzB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACf;SAAM;QACL,iBAAiB;QACjB,OAAO,CAAC,CAAC,CAAC,CAAC;KACZ;AACH,CAAC;AApBD,8CAoBC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,cAAwB;IAC3D,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACzC,CAAC;AAFD,oDAEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAC7B,MAA+B,EAC/B,EAAE,OAAO,EAA6B;IAEtC,MAAM,cAAc,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvE,MAAM,cAAc,GAAG,OAAO,CAAC,8BAA8B,EAAE,CAAC;IAChE,aAAa;IACb,KAAK,MAAM,EAAE,aAAa,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC,EAAE;QACnE,uDAAuD;QACvD,gEAAgE;QAChE,IAAI,QAAO,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,YAAY,CAAA,KAAK,WAAW,EAAE;YACtD,aAAa,CAAC,sBAAsB,GAAG,cAAc,CAAC;SACvD;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAjBD,0CAiBC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\nimport * as WarningAggregator from '../utils/warnings';\n\nexport const withDeviceFamily: ConfigPlugin = config => {\n return withXcodeProject(config, async config => {\n config.modResults = await setDeviceFamily(config, {\n project: config.modResults,\n });\n return config;\n });\n};\n\nexport function getSupportsTablet(config: Pick<ExpoConfig, 'ios'>): boolean {\n return !!config.ios?.supportsTablet;\n}\n\nexport function getIsTabletOnly(config: Pick<ExpoConfig, 'ios'>): boolean {\n return !!config?.ios?.isTabletOnly;\n}\n\nexport function getDeviceFamilies(config: Pick<ExpoConfig, 'ios'>): number[] {\n const supportsTablet = getSupportsTablet(config);\n const isTabletOnly = getIsTabletOnly(config);\n\n if (isTabletOnly && config.ios?.supportsTablet === false) {\n WarningAggregator.addWarningIOS(\n 'device-family',\n `Found contradictory values: \\`{ ios: { isTabletOnly: true, supportsTablet: false } }\\`. Using \\`{ isTabletOnly: true }\\`.`\n );\n }\n\n // 1 is iPhone, 2 is iPad\n if (isTabletOnly) {\n return [2];\n } else if (supportsTablet) {\n return [1, 2];\n } else {\n // is iPhone only\n return [1];\n }\n}\n\n/**\n * Wrapping the families in double quotes is the only way to set a value with a comma in it.\n *\n * @param deviceFamilies\n */\nexport function formatDeviceFamilies(deviceFamilies: number[]): string {\n return `\"${deviceFamilies.join(',')}\"`;\n}\n\n/**\n * Add to pbxproj under TARGETED_DEVICE_FAMILY\n */\nexport function setDeviceFamily(\n config: Pick<ExpoConfig, 'ios'>,\n { project }: { project: XcodeProject }\n): XcodeProject {\n const deviceFamilies = formatDeviceFamilies(getDeviceFamilies(config));\n\n const configurations = project.pbxXCBuildConfigurationSection();\n // @ts-ignore\n for (const { buildSettings } of Object.values(configurations || {})) {\n // Guessing that this is the best way to emulate Xcode.\n // Using `project.addToBuildSettings` modifies too many targets.\n if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {\n buildSettings.TARGETED_DEVICE_FAMILY = deviceFamilies;\n }\n }\n\n return project;\n}\n"]}

View File

@ -0,0 +1,43 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
declare type Plist = Record<string, any>;
export declare const withAccessesContactNotes: import("..").ConfigPlugin<void>;
export declare const withAssociatedDomains: import("..").ConfigPlugin<void>;
export declare function getConfigEntitlements(config: ExpoConfig): {
[k: string]: any;
};
export declare function setCustomEntitlementsEntries(config: ExpoConfig, entitlements: InfoPlist): {
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
};
export declare function setAccessesContactNotes(config: ExpoConfig, { 'com.apple.developer.contacts.notes': _, ...entitlementsPlist }: Plist): Plist;
export declare function setAssociatedDomains(config: ExpoConfig, { 'com.apple.developer.associated-domains': _, ...entitlementsPlist }: Plist): Plist;
export declare function getEntitlementsPath(projectRoot: string): string;
export {};

View File

@ -0,0 +1,125 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const slash_1 = __importDefault(require("slash"));
const ios_plugins_1 = require("../plugins/ios-plugins");
const Paths = __importStar(require("./Paths"));
const Xcodeproj_1 = require("./utils/Xcodeproj");
exports.withAccessesContactNotes = ios_plugins_1.createEntitlementsPlugin(setAccessesContactNotes, 'withAccessesContactNotes');
exports.withAssociatedDomains = ios_plugins_1.createEntitlementsPlugin(setAssociatedDomains, 'withAssociatedDomains');
// TODO: should it be possible to turn off these entitlements by setting false in app.json and running apply
function getConfigEntitlements(config) {
var _a, _b;
return (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.entitlements) !== null && _b !== void 0 ? _b : {};
}
exports.getConfigEntitlements = getConfigEntitlements;
function setCustomEntitlementsEntries(config, entitlements) {
const entries = getConfigEntitlements(config);
return Object.assign(Object.assign({}, entitlements), entries);
}
exports.setCustomEntitlementsEntries = setCustomEntitlementsEntries;
function setAccessesContactNotes(config, _a) {
var _b;
var { 'com.apple.developer.contacts.notes': _ } = _a, entitlementsPlist = __rest(_a, ['com.apple.developer.contacts.notes']);
if ((_b = config.ios) === null || _b === void 0 ? void 0 : _b.accessesContactNotes) {
return Object.assign(Object.assign({}, entitlementsPlist), { 'com.apple.developer.contacts.notes': config.ios.accessesContactNotes });
}
return entitlementsPlist;
}
exports.setAccessesContactNotes = setAccessesContactNotes;
function setAssociatedDomains(config, _a) {
var _b;
var { 'com.apple.developer.associated-domains': _ } = _a, entitlementsPlist = __rest(_a, ['com.apple.developer.associated-domains']);
if ((_b = config.ios) === null || _b === void 0 ? void 0 : _b.associatedDomains) {
return Object.assign(Object.assign({}, entitlementsPlist), { 'com.apple.developer.associated-domains': config.ios.associatedDomains });
}
return entitlementsPlist;
}
exports.setAssociatedDomains = setAssociatedDomains;
function getEntitlementsPath(projectRoot) {
const paths = Paths.getAllEntitlementsPaths(projectRoot);
let targetPath = null;
/**
* Add file to pbxproj under CODE_SIGN_ENTITLEMENTS
*/
const project = Xcodeproj_1.getPbxproj(projectRoot);
const projectName = Xcodeproj_1.getProjectName(projectRoot);
const productName = Xcodeproj_1.getProductName(project);
// Use posix formatted path, even on Windows
const entitlementsRelativePath = slash_1.default(path_1.default.join(projectName, `${productName}.entitlements`));
const entitlementsPath = slash_1.default(path_1.default.normalize(path_1.default.join(projectRoot, 'ios', entitlementsRelativePath)));
const pathsToDelete = [];
while (paths.length) {
const last = slash_1.default(path_1.default.normalize(paths.pop()));
if (last !== entitlementsPath) {
pathsToDelete.push(last);
}
else {
targetPath = last;
}
}
// Create a new entitlements file
if (!targetPath) {
targetPath = entitlementsPath;
// Use the default template
let template = ENTITLEMENTS_TEMPLATE;
// If an old entitlements file exists, copy it's contents into the new file.
if (pathsToDelete.length) {
// Get the last entitlements file and use it as the template
const last = pathsToDelete[pathsToDelete.length - 1];
template = fs_extra_1.default.readFileSync(last, 'utf8');
}
fs_extra_1.default.ensureDirSync(path_1.default.dirname(entitlementsPath));
fs_extra_1.default.writeFileSync(entitlementsPath, template);
Object.entries(project.pbxXCBuildConfigurationSection())
.filter(Xcodeproj_1.isNotComment)
.filter(Xcodeproj_1.isBuildConfig)
.filter(Xcodeproj_1.isNotTestHost)
.forEach(({ 1: { buildSettings } }) => {
buildSettings.CODE_SIGN_ENTITLEMENTS = entitlementsRelativePath;
});
fs_extra_1.default.writeFileSync(project.filepath, project.writeSync());
}
// Clean up others
deleteEntitlementsFiles(pathsToDelete);
return entitlementsPath;
}
exports.getEntitlementsPath = getEntitlementsPath;
function deleteEntitlementsFiles(entitlementsPaths) {
for (const path of entitlementsPaths) {
fs_extra_1.default.removeSync(path);
}
}
const ENTITLEMENTS_TEMPLATE = `
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
`;
//# sourceMappingURL=Entitlements.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,321 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
declare type ExpoConfigFacebook = Pick<ExpoConfig, 'facebookScheme' | 'facebookAdvertiserIDCollectionEnabled' | 'facebookAppId' | 'facebookAutoInitEnabled' | 'facebookAutoLogAppEventsEnabled' | 'facebookDisplayName'>;
export declare const withFacebook: import("..").ConfigPlugin<void>;
/**
* Getters
* TODO: these getters are the same between ios/android, we could reuse them
*/
export declare function getFacebookScheme(config: ExpoConfigFacebook): string | null;
export declare function getFacebookAppId(config: Pick<ExpoConfigFacebook, 'facebookAppId'>): string | null;
export declare function getFacebookDisplayName(config: ExpoConfigFacebook): string | null;
export declare function getFacebookAutoInitEnabled(config: ExpoConfigFacebook): boolean | null;
export declare function getFacebookAutoLogAppEvents(config: ExpoConfigFacebook): boolean | null;
export declare function getFacebookAdvertiserIDCollection(config: ExpoConfigFacebook): boolean | null;
/**
* Setters
*/
export declare function setFacebookConfig(config: ExpoConfigFacebook, infoPlist: InfoPlist): InfoPlist;
export declare function setFacebookScheme(config: ExpoConfigFacebook, infoPlist: InfoPlist): InfoPlist;
export declare function setFacebookAutoInitEnabled(config: ExpoConfigFacebook, { FacebookAutoInitEnabled, ...infoPlist }: InfoPlist): {
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
} | {
FacebookAutoInitEnabled: boolean;
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
};
export declare function setFacebookAutoLogAppEventsEnabled(config: ExpoConfigFacebook, { FacebookAutoLogAppEventsEnabled, ...infoPlist }: InfoPlist): {
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
} | {
FacebookAutoLogAppEventsEnabled: boolean;
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
};
export declare function setFacebookAdvertiserIDCollectionEnabled(config: ExpoConfigFacebook, { FacebookAdvertiserIDCollectionEnabled, ...infoPlist }: InfoPlist): {
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
} | {
FacebookAdvertiserIDCollectionEnabled: boolean;
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
};
export declare function setFacebookAppId(config: Pick<ExpoConfigFacebook, 'facebookAppId'>, { FacebookAppID, ...infoPlist }: InfoPlist): {
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
} | {
FacebookAppID: string;
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookDisplayName?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
};
export declare function setFacebookDisplayName(config: ExpoConfigFacebook, { FacebookDisplayName, ...infoPlist }: InfoPlist): {
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
} | {
FacebookDisplayName: string;
UIStatusBarHidden?: boolean | undefined;
UIStatusBarStyle?: string | undefined;
UILaunchStoryboardName?: string | undefined;
CFBundleShortVersionString?: string | undefined;
CFBundleVersion?: string | undefined;
CFBundleDisplayName?: string | undefined;
CFBundleIdentifier?: string | undefined;
CFBundleName?: string | undefined;
CFBundleURLTypes?: import("./IosConfig.types").URLScheme[] | undefined;
CFBundleDevelopmentRegion?: string | undefined;
ITSAppUsesNonExemptEncryption?: boolean | undefined;
LSApplicationQueriesSchemes?: string[] | undefined;
FacebookAppID?: string | undefined;
FacebookAutoInitEnabled?: boolean | undefined;
FacebookAutoLogAppEventsEnabled?: boolean | undefined;
FacebookAdvertiserIDCollectionEnabled?: boolean | undefined;
UIBackgroundModes?: string[] | undefined;
UISupportedInterfaceOrientations?: import("./IosConfig.types").InterfaceOrientation[] | undefined;
GMSApiKey?: string | undefined;
GADApplicationIdentifier?: string | undefined;
UIUserInterfaceStyle?: "Light" | "Dark" | "Automatic" | undefined;
UIRequiresFullScreen?: boolean | undefined;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[] | undefined;
branch_key?: {
live?: string | undefined;
} | undefined;
};
export declare function setFacebookApplicationQuerySchemes(config: Pick<ExpoConfigFacebook, 'facebookAppId'>, infoPlist: InfoPlist): InfoPlist;
export {};

156
node_modules/@expo/config-plugins/build/ios/Facebook.js generated vendored Normal file
View File

@ -0,0 +1,156 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
const Scheme_1 = require("./Scheme");
const fbSchemes = ['fbapi', 'fb-messenger-api', 'fbauth2', 'fbshareextension'];
exports.withFacebook = ios_plugins_1.createInfoPlistPlugin(setFacebookConfig, 'withFacebook');
/**
* Getters
* TODO: these getters are the same between ios/android, we could reuse them
*/
function getFacebookScheme(config) {
var _a;
return (_a = config.facebookScheme) !== null && _a !== void 0 ? _a : null;
}
exports.getFacebookScheme = getFacebookScheme;
function getFacebookAppId(config) {
var _a;
return (_a = config.facebookAppId) !== null && _a !== void 0 ? _a : null;
}
exports.getFacebookAppId = getFacebookAppId;
function getFacebookDisplayName(config) {
var _a;
return (_a = config.facebookDisplayName) !== null && _a !== void 0 ? _a : null;
}
exports.getFacebookDisplayName = getFacebookDisplayName;
function getFacebookAutoInitEnabled(config) {
var _a;
return (_a = config.facebookAutoInitEnabled) !== null && _a !== void 0 ? _a : null;
}
exports.getFacebookAutoInitEnabled = getFacebookAutoInitEnabled;
function getFacebookAutoLogAppEvents(config) {
var _a;
return (_a = config.facebookAutoLogAppEventsEnabled) !== null && _a !== void 0 ? _a : null;
}
exports.getFacebookAutoLogAppEvents = getFacebookAutoLogAppEvents;
function getFacebookAdvertiserIDCollection(config) {
var _a;
return (_a = config.facebookAdvertiserIDCollectionEnabled) !== null && _a !== void 0 ? _a : null;
}
exports.getFacebookAdvertiserIDCollection = getFacebookAdvertiserIDCollection;
/**
* Setters
*/
function setFacebookConfig(config, infoPlist) {
infoPlist = setFacebookAppId(config, infoPlist);
infoPlist = setFacebookApplicationQuerySchemes(config, infoPlist);
infoPlist = setFacebookDisplayName(config, infoPlist);
infoPlist = setFacebookAutoInitEnabled(config, infoPlist);
infoPlist = setFacebookAutoLogAppEventsEnabled(config, infoPlist);
infoPlist = setFacebookAdvertiserIDCollectionEnabled(config, infoPlist);
infoPlist = setFacebookScheme(config, infoPlist);
return infoPlist;
}
exports.setFacebookConfig = setFacebookConfig;
function setFacebookScheme(config, infoPlist) {
const facebookScheme = getFacebookScheme(config);
return Scheme_1.appendScheme(facebookScheme, infoPlist);
}
exports.setFacebookScheme = setFacebookScheme;
function setFacebookAutoInitEnabled(config, _a) {
var { FacebookAutoInitEnabled } = _a, infoPlist = __rest(_a, ["FacebookAutoInitEnabled"]);
const facebookAutoInitEnabled = getFacebookAutoInitEnabled(config);
if (facebookAutoInitEnabled === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { FacebookAutoInitEnabled: facebookAutoInitEnabled });
}
exports.setFacebookAutoInitEnabled = setFacebookAutoInitEnabled;
function setFacebookAutoLogAppEventsEnabled(config, _a) {
var { FacebookAutoLogAppEventsEnabled } = _a, infoPlist = __rest(_a, ["FacebookAutoLogAppEventsEnabled"]);
const facebookAutoLogAppEventsEnabled = getFacebookAutoLogAppEvents(config);
if (facebookAutoLogAppEventsEnabled === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { FacebookAutoLogAppEventsEnabled: facebookAutoLogAppEventsEnabled });
}
exports.setFacebookAutoLogAppEventsEnabled = setFacebookAutoLogAppEventsEnabled;
function setFacebookAdvertiserIDCollectionEnabled(config, _a) {
var { FacebookAdvertiserIDCollectionEnabled } = _a, infoPlist = __rest(_a, ["FacebookAdvertiserIDCollectionEnabled"]);
const facebookAdvertiserIDCollectionEnabled = getFacebookAdvertiserIDCollection(config);
if (facebookAdvertiserIDCollectionEnabled === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { FacebookAdvertiserIDCollectionEnabled: facebookAdvertiserIDCollectionEnabled });
}
exports.setFacebookAdvertiserIDCollectionEnabled = setFacebookAdvertiserIDCollectionEnabled;
function setFacebookAppId(config, _a) {
var { FacebookAppID } = _a, infoPlist = __rest(_a, ["FacebookAppID"]);
const facebookAppId = getFacebookAppId(config);
if (facebookAppId) {
return Object.assign(Object.assign({}, infoPlist), { FacebookAppID: facebookAppId });
}
return infoPlist;
}
exports.setFacebookAppId = setFacebookAppId;
function setFacebookDisplayName(config, _a) {
var { FacebookDisplayName } = _a, infoPlist = __rest(_a, ["FacebookDisplayName"]);
const facebookDisplayName = getFacebookDisplayName(config);
if (facebookDisplayName) {
return Object.assign(Object.assign({}, infoPlist), { FacebookDisplayName: facebookDisplayName });
}
return infoPlist;
}
exports.setFacebookDisplayName = setFacebookDisplayName;
function setFacebookApplicationQuerySchemes(config, infoPlist) {
const facebookAppId = getFacebookAppId(config);
const existingSchemes = infoPlist.LSApplicationQueriesSchemes || [];
if (facebookAppId && existingSchemes.includes('fbapi')) {
// already inlcuded, no need to add again
return infoPlist;
}
else if (!facebookAppId && !existingSchemes.length) {
// already removed, no need to strip again
const { LSApplicationQueriesSchemes } = infoPlist, restInfoPlist = __rest(infoPlist, ["LSApplicationQueriesSchemes"]);
if (LSApplicationQueriesSchemes === null || LSApplicationQueriesSchemes === void 0 ? void 0 : LSApplicationQueriesSchemes.length) {
return infoPlist;
}
else {
// Return without the empty LSApplicationQueriesSchemes array.
return restInfoPlist;
}
}
// Remove all schemes
for (const scheme of fbSchemes) {
const index = existingSchemes.findIndex(s => s === scheme);
if (index > -1) {
existingSchemes.splice(index, 1);
}
}
if (!facebookAppId) {
// Run again to ensure the LSApplicationQueriesSchemes array is stripped if needed.
infoPlist.LSApplicationQueriesSchemes = existingSchemes;
if (!infoPlist.LSApplicationQueriesSchemes.length) {
delete infoPlist.LSApplicationQueriesSchemes;
}
return infoPlist;
}
// TODO: it's actually necessary to add more query schemes (specific to the
// app) to support all of the features that the Facebook SDK provides, should
// we sync those here too?
const updatedSchemes = [...existingSchemes, ...fbSchemes];
return Object.assign(Object.assign({}, infoPlist), { LSApplicationQueriesSchemes: updatedSchemes });
}
exports.setFacebookApplicationQuerySchemes = setFacebookApplicationQuerySchemes;
//# sourceMappingURL=Facebook.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
import { InfoPlist } from './IosConfig.types';
export declare const withGoogle: ConfigPlugin<void>;
export declare const withGoogleServicesFile: ConfigPlugin;
export declare function getGoogleSignInReservedClientId(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function getGoogleServicesFile(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setGoogleSignInReservedClientId(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;
export declare function setGoogleConfig(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;
export declare function setGoogleServicesFile(config: Pick<ExpoConfig, 'ios'>, { projectRoot, project }: {
project: XcodeProject;
projectRoot: string;
}): XcodeProject;

65
node_modules/@expo/config-plugins/build/ios/Google.js generated vendored Normal file
View File

@ -0,0 +1,65 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const ios_plugins_1 = require("../plugins/ios-plugins");
const Paths_1 = require("./Paths");
const Scheme_1 = require("./Scheme");
const Xcodeproj_1 = require("./utils/Xcodeproj");
exports.withGoogle = ios_plugins_1.createInfoPlistPlugin(setGoogleConfig, 'withGoogle');
exports.withGoogleServicesFile = config => {
return ios_plugins_1.withXcodeProject(config, config => {
config.modResults = setGoogleServicesFile(config, {
projectRoot: config.modRequest.projectRoot,
project: config.modResults,
});
return config;
});
};
function getGoogleSignInReservedClientId(config) {
var _a, _b, _c, _d;
return (_d = (_c = (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.googleSignIn) === null || _c === void 0 ? void 0 : _c.reservedClientId) !== null && _d !== void 0 ? _d : null;
}
exports.getGoogleSignInReservedClientId = getGoogleSignInReservedClientId;
function getGoogleServicesFile(config) {
var _a, _b;
return (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.googleServicesFile) !== null && _b !== void 0 ? _b : null;
}
exports.getGoogleServicesFile = getGoogleServicesFile;
function setGoogleSignInReservedClientId(config, infoPlist) {
const reservedClientId = getGoogleSignInReservedClientId(config);
if (reservedClientId === null) {
return infoPlist;
}
return Scheme_1.appendScheme(reservedClientId, infoPlist);
}
exports.setGoogleSignInReservedClientId = setGoogleSignInReservedClientId;
function setGoogleConfig(config, infoPlist) {
infoPlist = setGoogleSignInReservedClientId(config, infoPlist);
return infoPlist;
}
exports.setGoogleConfig = setGoogleConfig;
function setGoogleServicesFile(config, { projectRoot, project }) {
const googleServicesFileRelativePath = getGoogleServicesFile(config);
if (googleServicesFileRelativePath === null) {
return project;
}
const googleServiceFilePath = path_1.default.resolve(projectRoot, googleServicesFileRelativePath);
fs_extra_1.default.copyFileSync(googleServiceFilePath, path_1.default.join(Paths_1.getSourceRoot(projectRoot), 'GoogleService-Info.plist'));
const projectName = Xcodeproj_1.getProjectName(projectRoot);
const plistFilePath = `${projectName}/GoogleService-Info.plist`;
if (!project.hasFile(plistFilePath)) {
project = Xcodeproj_1.addResourceFileToGroup({
filepath: plistFilePath,
groupName: projectName,
project,
isBuildFile: true,
});
}
return project;
}
exports.setGoogleServicesFile = setGoogleServicesFile;
//# sourceMappingURL=Google.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Google.js","sourceRoot":"","sources":["../../src/ios/Google.ts"],"names":[],"mappings":";;;;;AACA,wDAA0B;AAC1B,gDAAwB;AAIxB,wDAAiF;AAEjF,mCAAwC;AACxC,qCAAwC;AACxC,iDAA2E;AAE9D,QAAA,UAAU,GAAG,mCAAqB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAElE,QAAA,sBAAsB,GAAiB,MAAM,CAAC,EAAE;IAC3D,OAAO,8BAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QACvC,MAAM,CAAC,UAAU,GAAG,qBAAqB,CAAC,MAAM,EAAE;YAChD,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW;YAC1C,OAAO,EAAE,MAAM,CAAC,UAAU;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,+BAA+B,CAAC,MAA+B;;IAC7E,+BAAO,MAAM,CAAC,GAAG,0CAAE,MAAM,0CAAE,YAAY,0CAAE,gBAAgB,mCAAI,IAAI,CAAC;AACpE,CAAC;AAFD,0EAEC;AAED,SAAgB,qBAAqB,CAAC,MAA+B;;IACnE,mBAAO,MAAM,CAAC,GAAG,0CAAE,kBAAkB,mCAAI,IAAI,CAAC;AAChD,CAAC;AAFD,sDAEC;AAED,SAAgB,+BAA+B,CAC7C,MAA+B,EAC/B,SAAoB;IAEpB,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,MAAM,CAAC,CAAC;IAEjE,IAAI,gBAAgB,KAAK,IAAI,EAAE;QAC7B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,qBAAY,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAXD,0EAWC;AAED,SAAgB,eAAe,CAAC,MAA+B,EAAE,SAAoB;IACnF,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC/D,OAAO,SAAS,CAAC;AACnB,CAAC;AAHD,0CAGC;AAED,SAAgB,qBAAqB,CACnC,MAA+B,EAC/B,EAAE,WAAW,EAAE,OAAO,EAAkD;IAExE,MAAM,8BAA8B,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,8BAA8B,KAAK,IAAI,EAAE;QAC3C,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,qBAAqB,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,8BAA8B,CAAC,CAAC;IACxF,kBAAE,CAAC,YAAY,CACb,qBAAqB,EACrB,cAAI,CAAC,IAAI,CAAC,qBAAa,CAAC,WAAW,CAAC,EAAE,0BAA0B,CAAC,CAClE,CAAC;IAEF,MAAM,WAAW,GAAG,0BAAc,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,aAAa,GAAG,GAAG,WAAW,2BAA2B,CAAC;IAChE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACnC,OAAO,GAAG,kCAAsB,CAAC;YAC/B,QAAQ,EAAE,aAAa;YACvB,SAAS,EAAE,WAAW;YACtB,OAAO;YACP,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;KACJ;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AA1BD,sDA0BC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { XcodeProject } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createInfoPlistPlugin, withXcodeProject } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\nimport { getSourceRoot } from './Paths';\nimport { appendScheme } from './Scheme';\nimport { addResourceFileToGroup, getProjectName } from './utils/Xcodeproj';\n\nexport const withGoogle = createInfoPlistPlugin(setGoogleConfig, 'withGoogle');\n\nexport const withGoogleServicesFile: ConfigPlugin = config => {\n return withXcodeProject(config, config => {\n config.modResults = setGoogleServicesFile(config, {\n projectRoot: config.modRequest.projectRoot,\n project: config.modResults,\n });\n return config;\n });\n};\n\nexport function getGoogleSignInReservedClientId(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleSignIn?.reservedClientId ?? null;\n}\n\nexport function getGoogleServicesFile(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.googleServicesFile ?? null;\n}\n\nexport function setGoogleSignInReservedClientId(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const reservedClientId = getGoogleSignInReservedClientId(config);\n\n if (reservedClientId === null) {\n return infoPlist;\n }\n\n return appendScheme(reservedClientId, infoPlist);\n}\n\nexport function setGoogleConfig(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n infoPlist = setGoogleSignInReservedClientId(config, infoPlist);\n return infoPlist;\n}\n\nexport function setGoogleServicesFile(\n config: Pick<ExpoConfig, 'ios'>,\n { projectRoot, project }: { project: XcodeProject; projectRoot: string }\n): XcodeProject {\n const googleServicesFileRelativePath = getGoogleServicesFile(config);\n if (googleServicesFileRelativePath === null) {\n return project;\n }\n\n const googleServiceFilePath = path.resolve(projectRoot, googleServicesFileRelativePath);\n fs.copyFileSync(\n googleServiceFilePath,\n path.join(getSourceRoot(projectRoot), 'GoogleService-Info.plist')\n );\n\n const projectName = getProjectName(projectRoot);\n const plistFilePath = `${projectName}/GoogleService-Info.plist`;\n if (!project.hasFile(plistFilePath)) {\n project = addResourceFileToGroup({\n filepath: plistFilePath,\n groupName: projectName,\n project,\n isBuildFile: true,\n });\n }\n return project;\n}\n"]}

13
node_modules/@expo/config-plugins/build/ios/Icons.d.ts generated vendored Normal file
View File

@ -0,0 +1,13 @@
import { ExpoConfig } from '@expo/config-types';
import { ConfigPlugin } from '../Plugin.types';
import { ContentsJsonImageIdiom } from './AssetContents';
export declare const withIcons: ConfigPlugin;
export declare const ICON_CONTENTS: {
idiom: ContentsJsonImageIdiom;
sizes: {
size: number;
scales: (1 | 2 | 3)[];
}[];
}[];
export declare function getIcons(config: Pick<ExpoConfig, 'icon' | 'ios'>): string | null;
export declare function setIconsAsync(config: ExpoConfig, projectRoot: string): Promise<void>;

161
node_modules/@expo/config-plugins/build/ios/Icons.js generated vendored Normal file
View File

@ -0,0 +1,161 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const image_utils_1 = require("@expo/image-utils");
const fs = __importStar(require("fs-extra"));
const path_1 = require("path");
const core_plugins_1 = require("../plugins/core-plugins");
const WarningAggregator = __importStar(require("../utils/warnings"));
const AssetContents_1 = require("./AssetContents");
const Xcodeproj_1 = require("./utils/Xcodeproj");
exports.withIcons = config => {
return core_plugins_1.withDangerousMod(config, [
'ios',
async (config) => {
await setIconsAsync(config, config.modRequest.projectRoot);
return config;
},
]);
};
const IMAGE_CACHE_NAME = 'icons';
const IMAGESET_PATH = 'Images.xcassets/AppIcon.appiconset';
// Hard-coding seemed like the clearest and safest way to implement the sizes.
exports.ICON_CONTENTS = [
{
idiom: 'iphone',
sizes: [
{
size: 20,
scales: [2, 3],
},
{
size: 29,
scales: [1, 2, 3],
},
{
size: 40,
scales: [2, 3],
},
{
size: 60,
scales: [2, 3],
},
],
},
{
idiom: 'ipad',
sizes: [
{
size: 20,
scales: [1, 2],
},
{
size: 29,
scales: [1, 2],
},
{
size: 40,
scales: [1, 2],
},
{
size: 76,
scales: [1, 2],
},
{
size: 83.5,
scales: [2],
},
],
},
{
idiom: 'ios-marketing',
sizes: [
{
size: 1024,
scales: [1],
},
],
},
];
function getIcons(config) {
var _a;
// No support for empty strings.
return ((_a = config.ios) === null || _a === void 0 ? void 0 : _a.icon) || config.icon || null;
}
exports.getIcons = getIcons;
async function setIconsAsync(config, projectRoot) {
const icon = getIcons(config);
if (!icon) {
WarningAggregator.addWarningIOS('icon', 'This is the image that your app uses on your home screen, you will need to configure it manually.');
return;
}
// Something like projectRoot/ios/MyApp/
const iosNamedProjectRoot = getIosNamedProjectPath(projectRoot);
// Ensure the Images.xcassets/AppIcon.appiconset path exists
await fs.ensureDir(path_1.join(iosNamedProjectRoot, IMAGESET_PATH));
// Store the image JSON data for assigning via the Contents.json
const imagesJson = [];
// keep track of icons that have been generated so we can reuse them in the Contents.json
const generatedIcons = {};
for (const platform of exports.ICON_CONTENTS) {
const isMarketing = platform.idiom === 'ios-marketing';
for (const { size, scales } of platform.sizes) {
for (const scale of scales) {
// The marketing icon is special because it makes no sense.
const filename = isMarketing ? 'ItunesArtwork@2x.png' : getAppleIconName(size, scale);
// Only create an image that hasn't already been generated.
if (!(filename in generatedIcons)) {
const iconSizePx = size * scale;
// Using this method will cache the images in `.expo` based on the properties used to generate them.
// this method also supports remote URLs and using the global sharp instance.
const { source } = await image_utils_1.generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {
src: icon,
name: filename,
width: iconSizePx,
height: iconSizePx,
removeTransparency: true,
// The icon should be square, but if it's not then it will be cropped.
resizeMode: 'cover',
// Force the background color to solid white to prevent any transparency.
// TODO: Maybe use a more adaptive option based on the icon color?
backgroundColor: '#ffffff',
});
// Write image buffer to the file system.
const assetPath = path_1.join(iosNamedProjectRoot, IMAGESET_PATH, filename);
await fs.writeFile(assetPath, source);
// Save a reference to the generated image so we don't create a duplicate.
generatedIcons[filename] = true;
}
imagesJson.push({
idiom: platform.idiom,
size: `${size}x${size}`,
// @ts-ignore: template types not supported in TS yet
scale: `${scale}x`,
filename,
});
}
}
}
// Finally, write the Config.json
await AssetContents_1.writeContentsJsonAsync(path_1.join(iosNamedProjectRoot, IMAGESET_PATH), { images: imagesJson });
}
exports.setIconsAsync = setIconsAsync;
/**
* Return the project's named iOS path: ios/MyProject/
*
* @param projectRoot Expo project root path.
*/
function getIosNamedProjectPath(projectRoot) {
const projectName = Xcodeproj_1.getProjectName(projectRoot);
return path_1.join(projectRoot, 'ios', projectName);
}
function getAppleIconName(size, scale) {
return `App-Icon-${size}x${size}@${scale}x.png`;
}
//# sourceMappingURL=Icons.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,46 @@
export declare type URLScheme = {
CFBundleURLName?: string;
CFBundleURLSchemes: string[];
};
export declare type InterfaceOrientation = 'UIInterfaceOrientationPortrait' | 'UIInterfaceOrientationPortraitUpsideDown' | 'UIInterfaceOrientationLandscapeLeft' | 'UIInterfaceOrientationLandscapeRight';
export declare type InterfaceStyle = 'Light' | 'Dark' | 'Automatic';
export declare type InfoPlist = {
UIStatusBarHidden?: boolean;
UIStatusBarStyle?: string;
UILaunchStoryboardName?: string | 'SplashScreen';
CFBundleShortVersionString?: string;
CFBundleVersion?: string;
CFBundleDisplayName?: string;
CFBundleIdentifier?: string;
CFBundleName?: string;
CFBundleURLTypes?: URLScheme[];
CFBundleDevelopmentRegion?: string;
ITSAppUsesNonExemptEncryption?: boolean;
LSApplicationQueriesSchemes?: string[];
FacebookAppID?: string;
FacebookDisplayName?: string;
FacebookAutoInitEnabled?: boolean;
FacebookAutoLogAppEventsEnabled?: boolean;
FacebookAdvertiserIDCollectionEnabled?: boolean;
UIBackgroundModes?: string[];
UISupportedInterfaceOrientations?: InterfaceOrientation[];
GMSApiKey?: string;
GADApplicationIdentifier?: string;
UIUserInterfaceStyle?: InterfaceStyle;
UIRequiresFullScreen?: boolean;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[];
branch_key?: {
live?: string;
};
};
export declare type ExpoPlist = {
EXUpdatesCheckOnLaunch?: string;
EXUpdatesEnabled?: boolean;
EXUpdatesLaunchWaitMs?: number;
EXUpdatesReleaseChannel?: string;
EXUpdatesRuntimeVersion?: string;
EXUpdatesSDKVersion?: string;
EXUpdatesURL?: string;
};

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IosConfig.types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IosConfig.types.js","sourceRoot":"","sources":["../../src/ios/IosConfig.types.ts"],"names":[],"mappings":"","sourcesContent":["export type URLScheme = {\n CFBundleURLName?: string;\n CFBundleURLSchemes: string[];\n};\n\nexport type InterfaceOrientation =\n | 'UIInterfaceOrientationPortrait'\n | 'UIInterfaceOrientationPortraitUpsideDown'\n | 'UIInterfaceOrientationLandscapeLeft'\n | 'UIInterfaceOrientationLandscapeRight';\n\nexport type InterfaceStyle = 'Light' | 'Dark' | 'Automatic';\n\nexport type InfoPlist = {\n UIStatusBarHidden?: boolean;\n UIStatusBarStyle?: string;\n UILaunchStoryboardName?: string | 'SplashScreen';\n CFBundleShortVersionString?: string;\n CFBundleVersion?: string;\n CFBundleDisplayName?: string;\n CFBundleIdentifier?: string;\n CFBundleName?: string;\n CFBundleURLTypes?: URLScheme[];\n CFBundleDevelopmentRegion?: string;\n ITSAppUsesNonExemptEncryption?: boolean;\n LSApplicationQueriesSchemes?: string[];\n FacebookAppID?: string;\n FacebookDisplayName?: string;\n FacebookAutoInitEnabled?: boolean;\n FacebookAutoLogAppEventsEnabled?: boolean;\n FacebookAdvertiserIDCollectionEnabled?: boolean;\n UIBackgroundModes?: string[];\n UISupportedInterfaceOrientations?: InterfaceOrientation[];\n GMSApiKey?: string;\n GADApplicationIdentifier?: string;\n UIUserInterfaceStyle?: InterfaceStyle;\n UIRequiresFullScreen?: boolean;\n SKAdNetworkItems?: { SKAdNetworkIdentifier: string }[];\n branch_key?: { live?: string };\n};\n\nexport type ExpoPlist = {\n EXUpdatesCheckOnLaunch?: string;\n EXUpdatesEnabled?: boolean;\n EXUpdatesLaunchWaitMs?: number;\n EXUpdatesReleaseChannel?: string;\n EXUpdatesRuntimeVersion?: string;\n EXUpdatesSDKVersion?: string;\n EXUpdatesURL?: string;\n};\n"]}

View File

@ -0,0 +1,14 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
declare type LocaleJson = Record<string, string>;
declare type ResolvedLocalesJson = Record<string, LocaleJson>;
declare type ExpoConfigLocales = NonNullable<ExpoConfig['locales']>;
export declare const withLocales: ConfigPlugin;
export declare function getLocales(config: Pick<ExpoConfig, 'locales'>): Record<string, string | LocaleJson> | null;
export declare function setLocalesAsync(config: Pick<ExpoConfig, 'locales'>, { projectRoot, project }: {
projectRoot: string;
project: XcodeProject;
}): Promise<XcodeProject>;
export declare function getResolvedLocalesAsync(projectRoot: string, input: ExpoConfigLocales): Promise<ResolvedLocalesJson>;
export {};

91
node_modules/@expo/config-plugins/build/ios/Locales.js generated vendored Normal file
View File

@ -0,0 +1,91 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const json_file_1 = __importDefault(require("@expo/json-file"));
const fs = __importStar(require("fs-extra"));
const path_1 = require("path");
const ios_plugins_1 = require("../plugins/ios-plugins");
const WarningAggregator = __importStar(require("../utils/warnings"));
const Xcodeproj_1 = require("./utils/Xcodeproj");
exports.withLocales = config => {
return ios_plugins_1.withXcodeProject(config, async (config) => {
config.modResults = await setLocalesAsync(config, {
projectRoot: config.modRequest.projectRoot,
project: config.modResults,
});
return config;
});
};
function getLocales(config) {
var _a;
return (_a = config.locales) !== null && _a !== void 0 ? _a : null;
}
exports.getLocales = getLocales;
async function setLocalesAsync(config, { projectRoot, project }) {
const locales = getLocales(config);
if (!locales) {
return project;
}
// possibly validate CFBundleAllowMixedLocalizations is enabled
const localesMap = await getResolvedLocalesAsync(projectRoot, locales);
const projectName = Xcodeproj_1.getProjectName(projectRoot);
const supportingDirectory = path_1.join(projectRoot, 'ios', projectName, 'Supporting');
// TODO: Should we delete all before running? Revisit after we land on a lock file.
const stringName = 'InfoPlist.strings';
for (const [lang, localizationObj] of Object.entries(localesMap)) {
const dir = path_1.join(supportingDirectory, `${lang}.lproj`);
await fs.ensureDir(dir);
const strings = path_1.join(dir, stringName);
const buffer = [];
for (const [plistKey, localVersion] of Object.entries(localizationObj)) {
buffer.push(`${plistKey} = "${localVersion}";`);
}
// Write the file to the file system.
await fs.writeFile(strings, buffer.join('\n'));
// deep find the correct folder
const group = Xcodeproj_1.ensureGroupRecursively(project, `${projectName}/Supporting/${lang}.lproj`);
// Ensure the file doesn't already exist
if (!(group === null || group === void 0 ? void 0 : group.children.some(({ comment }) => comment === stringName))) {
// Only write the file if it doesn't already exist.
project = Xcodeproj_1.addResourceFileToGroup({
filepath: strings,
groupName: `${projectName}/Supporting/${lang}.lproj`,
project,
isBuildFile: true,
});
}
}
return project;
}
exports.setLocalesAsync = setLocalesAsync;
async function getResolvedLocalesAsync(projectRoot, input) {
const locales = {};
for (const [lang, localeJsonPath] of Object.entries(input)) {
if (typeof localeJsonPath === 'string') {
try {
locales[lang] = await json_file_1.default.readAsync(path_1.join(projectRoot, localeJsonPath));
}
catch (e) {
// Add a warning when a json file cannot be parsed.
WarningAggregator.addWarningIOS(`locales-${lang}`, `Failed to parse JSON of locale file for language: ${lang}`, 'https://docs.expo.io/distribution/app-stores/#localizing-your-ios-app');
}
}
else {
// In the off chance that someone defined the locales json in the config, pass it directly to the object.
// We do this to make the types more elegant.
locales[lang] = localeJsonPath;
}
}
return locales;
}
exports.getResolvedLocalesAsync = getResolvedLocalesAsync;
//# sourceMappingURL=Locales.js.map

File diff suppressed because one or more lines are too long

19
node_modules/@expo/config-plugins/build/ios/Maps.d.ts generated vendored Normal file
View File

@ -0,0 +1,19 @@
import { ExpoConfig } from '@expo/config-types';
import { ConfigPlugin, InfoPlist } from '../Plugin.types';
import { MergeResults } from '../utils/generateCode';
export declare const MATCH_INIT: RegExp;
export declare const withMaps: ConfigPlugin;
export declare function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>, { GMSApiKey, ...infoPlist }: InfoPlist): InfoPlist;
export declare function addGoogleMapsAppDelegateImport(src: string): MergeResults;
export declare function removeGoogleMapsAppDelegateImport(src: string): MergeResults;
export declare function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults;
export declare function removeGoogleMapsAppDelegateInit(src: string): MergeResults;
/**
* @param src
* @param useGoogleMaps
* @param googleMapsPath '../node_modules/react-native-maps'
* @returns
*/
export declare function addMapsCocoaPods(src: string, googleMapsPath: string): MergeResults;
export declare function removeMapsCocoaPods(src: string): MergeResults;

175
node_modules/@expo/config-plugins/build/ios/Maps.js generated vendored Normal file
View File

@ -0,0 +1,175 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const core_plugins_1 = require("../plugins/core-plugins");
const ios_plugins_1 = require("../plugins/ios-plugins");
const generateCode_1 = require("../utils/generateCode");
const resolvePackageRootFolder_1 = require("../utils/resolvePackageRootFolder");
exports.MATCH_INIT = /(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[\[RCTBridge alloc\])/g;
const withGoogleMapsKey = ios_plugins_1.createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');
exports.withMaps = config => {
config = withGoogleMapsKey(config);
const apiKey = getGoogleMapsApiKey(config);
// Technically adds react-native-maps (Apple maps) and google maps.
config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });
// Adds/Removes AppDelegate setup for Google Maps API on iOS
config = withGoogleMapsAppDelegate(config, { apiKey });
return config;
};
function getGoogleMapsApiKey(config) {
var _a, _b, _c;
return (_c = (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.googleMapsApiKey) !== null && _c !== void 0 ? _c : null;
}
exports.getGoogleMapsApiKey = getGoogleMapsApiKey;
function setGoogleMapsApiKey(config, _a) {
var { GMSApiKey } = _a, infoPlist = __rest(_a, ["GMSApiKey"]);
const apiKey = getGoogleMapsApiKey(config);
if (apiKey === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { GMSApiKey: apiKey });
}
exports.setGoogleMapsApiKey = setGoogleMapsApiKey;
function addGoogleMapsAppDelegateImport(src) {
const newSrc = [];
newSrc.push('#if __has_include(<GoogleMaps/GoogleMaps.h>)', '#import <GoogleMaps/GoogleMaps.h>', '#endif');
return generateCode_1.mergeContents({
tag: 'react-native-maps-import',
src,
newSrc: newSrc.join('\n'),
anchor: /#import "AppDelegate\.h"/,
offset: 1,
comment: '//',
});
}
exports.addGoogleMapsAppDelegateImport = addGoogleMapsAppDelegateImport;
function removeGoogleMapsAppDelegateImport(src) {
return generateCode_1.removeContents({
tag: 'react-native-maps-import',
src,
});
}
exports.removeGoogleMapsAppDelegateImport = removeGoogleMapsAppDelegateImport;
function addGoogleMapsAppDelegateInit(src, apiKey) {
const newSrc = [];
newSrc.push('#if __has_include(<GoogleMaps/GoogleMaps.h>)', ` [GMSServices provideAPIKey:@"${apiKey}"];`, '#endif');
return generateCode_1.mergeContents({
tag: 'react-native-maps-init',
src,
newSrc: newSrc.join('\n'),
anchor: exports.MATCH_INIT,
offset: 0,
comment: '//',
});
}
exports.addGoogleMapsAppDelegateInit = addGoogleMapsAppDelegateInit;
function removeGoogleMapsAppDelegateInit(src) {
return generateCode_1.removeContents({
tag: 'react-native-maps-init',
src,
});
}
exports.removeGoogleMapsAppDelegateInit = removeGoogleMapsAppDelegateInit;
/**
* @param src
* @param useGoogleMaps
* @param googleMapsPath '../node_modules/react-native-maps'
* @returns
*/
function addMapsCocoaPods(src, googleMapsPath) {
return generateCode_1.mergeContents({
tag: 'react-native-maps',
src,
newSrc: ` pod 'react-native-google-maps', path: '${googleMapsPath}'`,
anchor: /use_native_modules/,
offset: 0,
comment: '#',
});
}
exports.addMapsCocoaPods = addMapsCocoaPods;
function removeMapsCocoaPods(src) {
return generateCode_1.removeContents({
tag: 'react-native-maps',
src,
});
}
exports.removeMapsCocoaPods = removeMapsCocoaPods;
function isReactNativeMapsInstalled(projectRoot) {
return resolvePackageRootFolder_1.resolvePackageRootFolder(projectRoot, 'react-native-maps');
}
const withMapsCocoaPods = (config, { useGoogleMaps }) => {
return core_plugins_1.withDangerousMod(config, [
'ios',
async (config) => {
const filePath = path_1.default.join(config.modRequest.platformProjectRoot, 'Podfile');
const contents = await fs_extra_1.default.readFile(filePath, 'utf-8');
let results;
// Only add the block if react-native-maps is installed in the project (best effort).
// Generally prebuild runs after a yarn install so this should always work as expected.
const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);
if (googleMapsPath && useGoogleMaps) {
// Make the pod path relative to the ios folder.
const googleMapsPodPath = path_1.default.relative(config.modRequest.platformProjectRoot, googleMapsPath);
try {
results = addMapsCocoaPods(contents, googleMapsPodPath);
}
catch (error) {
if (error.code === 'ERR_NO_MATCH') {
throw new Error(`Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile.`);
}
throw error;
}
}
else {
// If the package is no longer installed, then remove the block.
results = removeMapsCocoaPods(contents);
}
if (results.didMerge || results.didClear) {
await fs_extra_1.default.writeFile(filePath, results.contents);
}
return config;
},
]);
};
const withGoogleMapsAppDelegate = (config, { apiKey }) => {
return ios_plugins_1.withAppDelegate(config, config => {
if (config.modResults.language === 'objc') {
if (apiKey && isReactNativeMapsInstalled(config.modRequest.projectRoot)) {
try {
config.modResults.contents = addGoogleMapsAppDelegateImport(config.modResults.contents).contents;
config.modResults.contents = addGoogleMapsAppDelegateInit(config.modResults.contents, apiKey).contents;
}
catch (error) {
if (error.code === 'ERR_NO_MATCH') {
throw new Error(`Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`);
}
throw error;
}
}
else {
config.modResults.contents = removeGoogleMapsAppDelegateImport(config.modResults.contents).contents;
config.modResults.contents = removeGoogleMapsAppDelegateInit(config.modResults.contents).contents;
}
}
else {
throw new Error('Cannot setup Google Maps because the AppDelegate is not Objective C');
}
return config;
});
};
//# sourceMappingURL=Maps.js.map

File diff suppressed because one or more lines are too long

15
node_modules/@expo/config-plugins/build/ios/Name.d.ts generated vendored Normal file
View File

@ -0,0 +1,15 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withDisplayName: import("..").ConfigPlugin<void>;
export declare const withName: import("..").ConfigPlugin<void>;
export declare function getName(config: Pick<ExpoConfig, 'name'>): string | null;
/**
* CFBundleDisplayName is used for most things: the name on the home screen, in
* notifications, and others.
*/
export declare function setDisplayName(configOrName: Pick<ExpoConfig, 'name'> | string, { CFBundleDisplayName, ...infoPlist }: InfoPlist): InfoPlist;
/**
* CFBundleName is recommended to be 16 chars or less and is used in lists, eg:
* sometimes on the App Store
*/
export declare function setName(config: Pick<ExpoConfig, 'name'>, { CFBundleName, ...infoPlist }: InfoPlist): InfoPlist;

53
node_modules/@expo/config-plugins/build/ios/Name.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withDisplayName = ios_plugins_1.createInfoPlistPlugin(setDisplayName, 'withDisplayName');
exports.withName = ios_plugins_1.createInfoPlistPlugin(setName, 'withName');
function getName(config) {
return typeof config.name === 'string' ? config.name : null;
}
exports.getName = getName;
/**
* CFBundleDisplayName is used for most things: the name on the home screen, in
* notifications, and others.
*/
function setDisplayName(configOrName, _a) {
var { CFBundleDisplayName } = _a, infoPlist = __rest(_a, ["CFBundleDisplayName"]);
let name = null;
if (typeof configOrName === 'string') {
name = configOrName;
}
else {
name = getName(configOrName);
}
if (!name) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { CFBundleDisplayName: name });
}
exports.setDisplayName = setDisplayName;
/**
* CFBundleName is recommended to be 16 chars or less and is used in lists, eg:
* sometimes on the App Store
*/
function setName(config, _a) {
var { CFBundleName } = _a, infoPlist = __rest(_a, ["CFBundleName"]);
const name = getName(config);
if (!name) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { CFBundleName: name });
}
exports.setName = setName;
//# sourceMappingURL=Name.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Name.js","sourceRoot":"","sources":["../../src/ios/Name.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,wDAA+D;AAGlD,QAAA,eAAe,GAAG,mCAAqB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAE3E,QAAA,QAAQ,GAAG,mCAAqB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAEnE,SAAgB,OAAO,CAAC,MAAgC;IACtD,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9D,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAC5B,YAA+C,EAC/C,EAAgD;QAAhD,EAAE,mBAAmB,OAA2B,EAAzB,+CAAY;IAEnC,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;QACpC,IAAI,GAAG,YAAY,CAAC;KACrB;SAAM;QACL,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;KAC9B;IAED,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,SAAS,KACZ,mBAAmB,EAAE,IAAI,IACzB;AACJ,CAAC;AAnBD,wCAmBC;AAED;;;GAGG;AACH,SAAgB,OAAO,CACrB,MAAgC,EAChC,EAAyC;QAAzC,EAAE,YAAY,OAA2B,EAAzB,wCAAY;IAE5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,SAAS,KACZ,YAAY,EAAE,IAAI,IAClB;AACJ,CAAC;AAdD,0BAcC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withDisplayName = createInfoPlistPlugin(setDisplayName, 'withDisplayName');\n\nexport const withName = createInfoPlistPlugin(setName, 'withName');\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\n/**\n * CFBundleDisplayName is used for most things: the name on the home screen, in\n * notifications, and others.\n */\nexport function setDisplayName(\n configOrName: Pick<ExpoConfig, 'name'> | string,\n { CFBundleDisplayName, ...infoPlist }: InfoPlist\n): InfoPlist {\n let name: string | null = null;\n if (typeof configOrName === 'string') {\n name = configOrName;\n } else {\n name = getName(configOrName);\n }\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleDisplayName: name,\n };\n}\n\n/**\n * CFBundleName is recommended to be 16 chars or less and is used in lists, eg:\n * sometimes on the App Store\n */\nexport function setName(\n config: Pick<ExpoConfig, 'name'>,\n { CFBundleName, ...infoPlist }: InfoPlist\n): InfoPlist {\n const name = getName(config);\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleName: name,\n };\n}\n"]}

View File

@ -0,0 +1,7 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist, InterfaceOrientation } from './IosConfig.types';
export declare const withOrientation: import("..").ConfigPlugin<void>;
export declare function getOrientation(config: Pick<ExpoConfig, 'orientation'>): "default" | "portrait" | "landscape" | null;
export declare const PORTRAIT_ORIENTATIONS: InterfaceOrientation[];
export declare const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[];
export declare function setOrientation(config: Pick<ExpoConfig, 'orientation'>, infoPlist: InfoPlist): InfoPlist;

View File

@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withOrientation = ios_plugins_1.createInfoPlistPlugin(setOrientation, 'withOrientation');
function getOrientation(config) {
var _a;
return (_a = config.orientation) !== null && _a !== void 0 ? _a : null;
}
exports.getOrientation = getOrientation;
exports.PORTRAIT_ORIENTATIONS = [
'UIInterfaceOrientationPortrait',
'UIInterfaceOrientationPortraitUpsideDown',
];
exports.LANDSCAPE_ORIENTATIONS = [
'UIInterfaceOrientationLandscapeLeft',
'UIInterfaceOrientationLandscapeRight',
];
function getUISupportedInterfaceOrientations(orientation) {
if (orientation === 'portrait') {
return exports.PORTRAIT_ORIENTATIONS;
}
else if (orientation === 'landscape') {
return exports.LANDSCAPE_ORIENTATIONS;
}
else {
return [...exports.PORTRAIT_ORIENTATIONS, ...exports.LANDSCAPE_ORIENTATIONS];
}
}
function setOrientation(config, infoPlist) {
const orientation = getOrientation(config);
return Object.assign(Object.assign({}, infoPlist), { UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation) });
}
exports.setOrientation = setOrientation;
//# sourceMappingURL=Orientation.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Orientation.js","sourceRoot":"","sources":["../../src/ios/Orientation.ts"],"names":[],"mappings":";;AAEA,wDAA+D;AAGlD,QAAA,eAAe,GAAG,mCAAqB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAExF,SAAgB,cAAc,CAAC,MAAuC;;IACpE,aAAO,MAAM,CAAC,WAAW,mCAAI,IAAI,CAAC;AACpC,CAAC;AAFD,wCAEC;AAEY,QAAA,qBAAqB,GAA2B;IAC3D,gCAAgC;IAChC,0CAA0C;CAC3C,CAAC;AAEW,QAAA,sBAAsB,GAA2B;IAC5D,qCAAqC;IACrC,sCAAsC;CACvC,CAAC;AAEF,SAAS,mCAAmC,CAAC,WAA0B;IACrE,IAAI,WAAW,KAAK,UAAU,EAAE;QAC9B,OAAO,6BAAqB,CAAC;KAC9B;SAAM,IAAI,WAAW,KAAK,WAAW,EAAE;QACtC,OAAO,8BAAsB,CAAC;KAC/B;SAAM;QACL,OAAO,CAAC,GAAG,6BAAqB,EAAE,GAAG,8BAAsB,CAAC,CAAC;KAC9D;AACH,CAAC;AAED,SAAgB,cAAc,CAC5B,MAAuC,EACvC,SAAoB;IAEpB,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE3C,uCACK,SAAS,KACZ,gCAAgC,EAAE,mCAAmC,CAAC,WAAW,CAAC,IAClF;AACJ,CAAC;AAVD,wCAUC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\n\nexport const withOrientation = createInfoPlistPlugin(setOrientation, 'withOrientation');\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"]}

29
node_modules/@expo/config-plugins/build/ios/Paths.d.ts generated vendored Normal file
View File

@ -0,0 +1,29 @@
interface ProjectFile<L extends string = string> {
path: string;
language: L;
contents: string;
}
export declare type AppDelegateProjectFile = ProjectFile<'objc' | 'swift'>;
export declare function getAppDelegate(projectRoot: string): AppDelegateProjectFile;
export declare function getSourceRoot(projectRoot: string): string;
export declare function findSchemePaths(projectRoot: string): string[];
export declare function findSchemeNames(projectRoot: string): string[];
export declare function getAllXcodeProjectPaths(projectRoot: string): string[];
/**
* Get the pbxproj for the given path
*/
export declare function getXcodeProjectPath(projectRoot: string): string;
export declare function getAllPBXProjectPaths(projectRoot: string): string[];
export declare function getPBXProjectPath(projectRoot: string): string;
export declare function getAllInfoPlistPaths(projectRoot: string): string[];
export declare function getInfoPlistPath(projectRoot: string): string;
export declare function getAllEntitlementsPaths(projectRoot: string): string[];
/**
* Get the entitlements file path if it exists.
*
* @param projectRoot
*/
export declare function getEntitlementsPath(projectRoot: string): string | null;
export declare function getSupportingPath(projectRoot: string): string;
export declare function getExpoPlistPath(projectRoot: string): string;
export {};

185
node_modules/@expo/config-plugins/build/ios/Paths.js generated vendored Normal file
View File

@ -0,0 +1,185 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = require("fs-extra");
const glob_1 = require("glob");
const path = __importStar(require("path"));
const errors_1 = require("../utils/errors");
const WarningAggregator = __importStar(require("../utils/warnings"));
const ignoredPaths = ['**/@(Carthage|Pods|node_modules)/**'];
function getAppDelegate(projectRoot) {
const [using, ...extra] = glob_1.sync('ios/*/AppDelegate.@(m|swift)', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths,
});
if (!using) {
throw new errors_1.UnexpectedError(`Could not locate a valid AppDelegate at root: "${projectRoot}"`);
}
if (extra.length) {
warnMultipleFiles({
tag: 'app-delegate',
fileName: 'AppDelegate',
projectRoot,
using,
extra,
});
}
const isSwift = using.match(/^.*\.(swift)$/);
return {
path: using,
contents: fs_extra_1.readFileSync(using, 'utf8'),
language: isSwift ? 'swift' : 'objc',
};
}
exports.getAppDelegate = getAppDelegate;
function getSourceRoot(projectRoot) {
const appDelegate = getAppDelegate(projectRoot);
return path.dirname(appDelegate.path);
}
exports.getSourceRoot = getSourceRoot;
function findSchemePaths(projectRoot) {
return glob_1.sync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths,
});
}
exports.findSchemePaths = findSchemePaths;
function findSchemeNames(projectRoot) {
const schemePaths = findSchemePaths(projectRoot);
return schemePaths.map(schemePath => path.basename(schemePath).split('.')[0]);
}
exports.findSchemeNames = findSchemeNames;
function getAllXcodeProjectPaths(projectRoot) {
const iosFolder = 'ios';
const pbxprojPaths = glob_1.sync('**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })
.filter(project => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder)
.sort(project => (path.dirname(project) === iosFolder ? -1 : 1))
// sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)
.sort();
if (!pbxprojPaths.length) {
throw new errors_1.UnexpectedError(`Failed to locate the ios/*.xcodeproj files relative to path "${projectRoot}".`);
}
return pbxprojPaths.map(value => path.join(projectRoot, value));
}
exports.getAllXcodeProjectPaths = getAllXcodeProjectPaths;
/**
* Get the pbxproj for the given path
*/
function getXcodeProjectPath(projectRoot) {
const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'xcodeproj',
fileName: '*.xcodeproj',
projectRoot,
using,
extra,
});
}
return using;
}
exports.getXcodeProjectPath = getXcodeProjectPath;
function getAllPBXProjectPaths(projectRoot) {
const projectPaths = getAllXcodeProjectPaths(projectRoot);
const paths = projectPaths
.map(value => path.join(value, 'project.pbxproj'))
.filter(value => fs_extra_1.pathExistsSync(value));
if (!paths.length) {
throw new errors_1.UnexpectedError(`Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path "${projectRoot}".`);
}
return paths;
}
exports.getAllPBXProjectPaths = getAllPBXProjectPaths;
function getPBXProjectPath(projectRoot) {
const [using, ...extra] = getAllPBXProjectPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'project-pbxproj',
fileName: 'project.pbxproj',
projectRoot,
using,
extra,
});
}
return using;
}
exports.getPBXProjectPath = getPBXProjectPath;
function getAllInfoPlistPaths(projectRoot) {
const paths = glob_1.sync('ios/*/Info.plist', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths,
}).sort(
// longer name means more suffixes, we want the shortest possible one to be first.
(a, b) => a.length - b.length);
if (!paths.length) {
throw new errors_1.UnexpectedError(`Failed to locate Info.plist files relative to path "${projectRoot}".`);
}
return paths;
}
exports.getAllInfoPlistPaths = getAllInfoPlistPaths;
function getInfoPlistPath(projectRoot) {
const [using, ...extra] = getAllInfoPlistPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'info-plist',
fileName: 'Info.plist',
projectRoot,
using,
extra,
});
}
return using;
}
exports.getInfoPlistPath = getInfoPlistPath;
function getAllEntitlementsPaths(projectRoot) {
const paths = glob_1.sync('ios/*/*.entitlements', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths,
});
return paths;
}
exports.getAllEntitlementsPaths = getAllEntitlementsPaths;
/**
* Get the entitlements file path if it exists.
*
* @param projectRoot
*/
function getEntitlementsPath(projectRoot) {
const [using, ...extra] = getAllEntitlementsPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'entitlements',
fileName: '*.entitlements',
projectRoot,
using,
extra,
});
}
return using !== null && using !== void 0 ? using : null;
}
exports.getEntitlementsPath = getEntitlementsPath;
function getSupportingPath(projectRoot) {
return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');
}
exports.getSupportingPath = getSupportingPath;
function getExpoPlistPath(projectRoot) {
const supportingPath = getSupportingPath(projectRoot);
return path.join(supportingPath, 'Expo.plist');
}
exports.getExpoPlistPath = getExpoPlistPath;
function warnMultipleFiles({ tag, fileName, projectRoot, using, extra, }) {
const usingPath = projectRoot ? path.relative(projectRoot, using) : using;
const extraPaths = projectRoot ? extra.map(v => path.relative(projectRoot, v)) : extra;
WarningAggregator.addWarningIOS(`paths-${tag}`, `Found multiple ${fileName} file paths, using "${usingPath}". Ignored paths: ${JSON.stringify(extraPaths)}`);
}
//# sourceMappingURL=Paths.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
import { ConfigPlugin } from '../Plugin.types';
import { InfoPlist } from './IosConfig.types';
/**
* Apply permissions and their respective descriptions to the iOS Info.plist.
* Providing a null description will remove the permission from the Info.plist.
*
* @param config
* @param permissions record of strings where the key matches Info.plist permissions and the values are the permission descriptions.
*/
export declare const withPermissions: ConfigPlugin<Record<string, string | null>>;
export declare function applyPermissions(permissions: Record<string, string | null>, infoPlist: Record<string, any>): InfoPlist;

View File

@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
/**
* Apply permissions and their respective descriptions to the iOS Info.plist.
* Providing a null description will remove the permission from the Info.plist.
*
* @param config
* @param permissions record of strings where the key matches Info.plist permissions and the values are the permission descriptions.
*/
exports.withPermissions = (config, permissions) => {
return ios_plugins_1.withInfoPlist(config, async (config) => {
config.modResults = applyPermissions(permissions, config.modResults);
return config;
});
};
function applyPermissions(permissions, infoPlist) {
const entries = Object.entries(permissions);
if (entries.length === 0) {
// TODO: Debug warn
// console.warn('[withPermissions] no permissions were provided');
}
for (const [permission, description] of entries) {
if (description == null) {
delete infoPlist[permission];
}
else {
const existingPermission = infoPlist[permission];
if (existingPermission && existingPermission !== description) {
// TODO: Debug warn
// console.warn(
// `[withPermissionsIos][conflict] permission "${permission}" is already defined in the Info.plist with description "${existingPermission}"`
// );
}
infoPlist[permission] = description;
}
}
return infoPlist;
}
exports.applyPermissions = applyPermissions;
//# sourceMappingURL=Permissions.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Permissions.js","sourceRoot":"","sources":["../../src/ios/Permissions.ts"],"names":[],"mappings":";;AACA,wDAAuD;AAGvD;;;;;;GAMG;AACU,QAAA,eAAe,GAAgD,CAC1E,MAAM,EACN,WAAW,EACX,EAAE;IACF,OAAO,2BAAa,CAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QAC1C,MAAM,CAAC,UAAU,GAAG,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,gBAAgB,CAC9B,WAA0C,EAC1C,SAA8B;IAE9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,mBAAmB;QACnB,kEAAkE;KACnE;IACD,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,OAAO,EAAE;QAC/C,IAAI,WAAW,IAAI,IAAI,EAAE;YACvB,OAAO,SAAS,CAAC,UAAU,CAAC,CAAC;SAC9B;aAAM;YACL,MAAM,kBAAkB,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;YACjD,IAAI,kBAAkB,IAAI,kBAAkB,KAAK,WAAW,EAAE;gBAC5D,mBAAmB;gBACnB,kBAAkB;gBAClB,gJAAgJ;gBAChJ,OAAO;aACR;YACD,SAAS,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC;SACrC;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAxBD,4CAwBC","sourcesContent":["import { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\n/**\n * Apply permissions and their respective descriptions to the iOS Info.plist.\n * Providing a null description will remove the permission from the Info.plist.\n *\n * @param config\n * @param permissions record of strings where the key matches Info.plist permissions and the values are the permission descriptions.\n */\nexport const withPermissions: ConfigPlugin<Record<string, string | null>> = (\n config,\n permissions\n) => {\n return withInfoPlist(config, async config => {\n config.modResults = applyPermissions(permissions, config.modResults);\n return config;\n });\n};\n\nexport function applyPermissions(\n permissions: Record<string, string | null>,\n infoPlist: Record<string, any>\n): InfoPlist {\n const entries = Object.entries(permissions);\n if (entries.length === 0) {\n // TODO: Debug warn\n // console.warn('[withPermissions] no permissions were provided');\n }\n for (const [permission, description] of entries) {\n if (description == null) {\n delete infoPlist[permission];\n } else {\n const existingPermission = infoPlist[permission];\n if (existingPermission && existingPermission !== description) {\n // TODO: Debug warn\n // console.warn(\n // `[withPermissionsIos][conflict] permission \"${permission}\" is already defined in the Info.plist with description \"${existingPermission}\"`\n // );\n }\n infoPlist[permission] = description;\n }\n }\n return infoPlist;\n}\n"]}

View File

@ -0,0 +1,7 @@
declare type ProvisioningProfileSettings = {
targetName?: string;
appleTeamId: string;
profileName: string;
};
declare function setProvisioningProfileForPbxproj(projectRoot: string, { targetName, profileName, appleTeamId }: ProvisioningProfileSettings): void;
export { setProvisioningProfileForPbxproj };

View File

@ -0,0 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const Xcodeproj_1 = require("./utils/Xcodeproj");
function setProvisioningProfileForPbxproj(projectRoot, { targetName, profileName, appleTeamId }) {
const project = Xcodeproj_1.getPbxproj(projectRoot);
const [nativeTargetId, nativeTarget] = targetName
? Xcodeproj_1.findNativeTargetByName(project, targetName)
: Xcodeproj_1.findFirstNativeTarget(project);
Xcodeproj_1.getBuildConfigurationForId(project, nativeTarget.buildConfigurationList)
.filter(([, item]) => item.buildSettings.PRODUCT_NAME)
.forEach(([, item]) => {
item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `"${profileName}"`;
item.buildSettings.DEVELOPMENT_TEAM = appleTeamId;
item.buildSettings.CODE_SIGN_IDENTITY = '"iPhone Distribution"';
item.buildSettings.CODE_SIGN_STYLE = 'Manual';
});
Object.entries(Xcodeproj_1.getProjectSection(project))
.filter(Xcodeproj_1.isNotComment)
.forEach(([, item]) => {
item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = appleTeamId;
item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';
});
fs_extra_1.default.writeFileSync(project.filepath, project.writeSync());
}
exports.setProvisioningProfileForPbxproj = setProvisioningProfileForPbxproj;
//# sourceMappingURL=ProvisioningProfile.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ProvisioningProfile.js","sourceRoot":"","sources":["../../src/ios/ProvisioningProfile.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAE1B,iDAS2B;AAQ3B,SAAS,gCAAgC,CACvC,WAAmB,EACnB,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAA+B;IAErE,MAAM,OAAO,GAAG,sBAAU,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,UAAU;QAC/C,CAAC,CAAC,kCAAsB,CAAC,OAAO,EAAE,UAAU,CAAC;QAC7C,CAAC,CAAC,iCAAqB,CAAC,OAAO,CAAC,CAAC;IAEnC,sCAA0B,CAAC,OAAO,EAAE,YAAY,CAAC,sBAAsB,CAAC;SACrE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAA4B,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;SAChF,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAA4B,EAAE,EAAE;QAC/C,IAAI,CAAC,aAAa,CAAC,8BAA8B,GAAG,IAAI,WAAW,GAAG,CAAC;QACvE,IAAI,CAAC,aAAa,CAAC,gBAAgB,GAAG,WAAW,CAAC;QAClD,IAAI,CAAC,aAAa,CAAC,kBAAkB,GAAG,uBAAuB,CAAC;QAChE,IAAI,CAAC,aAAa,CAAC,eAAe,GAAG,QAAQ,CAAC;IAChD,CAAC,CAAC,CAAC;IAEL,MAAM,CAAC,OAAO,CAAC,6BAAiB,CAAC,OAAO,CAAC,CAAC;SACvC,MAAM,CAAC,wBAAY,CAAC;SACpB,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAsB,EAAE,EAAE;QACzC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,eAAe,GAAG,WAAW,CAAC;QAC/E,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IAChF,CAAC,CAAC,CAAC;IAEL,kBAAE,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AAC1D,CAAC;AAEQ,4EAAgC","sourcesContent":["import fs from 'fs-extra';\n\nimport {\n ConfigurationSectionEntry,\n findFirstNativeTarget,\n findNativeTargetByName,\n getBuildConfigurationForId,\n getPbxproj,\n getProjectSection,\n isNotComment,\n ProjectSectionEntry,\n} from './utils/Xcodeproj';\n\ntype ProvisioningProfileSettings = {\n targetName?: string;\n appleTeamId: string;\n profileName: string;\n};\n\nfunction setProvisioningProfileForPbxproj(\n projectRoot: string,\n { targetName, profileName, appleTeamId }: ProvisioningProfileSettings\n): void {\n const project = getPbxproj(projectRoot);\n const [nativeTargetId, nativeTarget] = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n\n getBuildConfigurationForId(project, nativeTarget.buildConfigurationList)\n .filter(([, item]: ConfigurationSectionEntry) => item.buildSettings.PRODUCT_NAME)\n .forEach(([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `\"${profileName}\"`;\n item.buildSettings.DEVELOPMENT_TEAM = appleTeamId;\n item.buildSettings.CODE_SIGN_IDENTITY = '\"iPhone Distribution\"';\n item.buildSettings.CODE_SIGN_STYLE = 'Manual';\n });\n\n Object.entries(getProjectSection(project))\n .filter(isNotComment)\n .forEach(([, item]: ProjectSectionEntry) => {\n item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = appleTeamId;\n item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';\n });\n\n fs.writeFileSync(project.filepath, project.writeSync());\n}\n\nexport { setProvisioningProfileForPbxproj };\n"]}

View File

@ -0,0 +1,5 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withRequiresFullScreen: import("..").ConfigPlugin<void>;
export declare function getRequiresFullScreen(config: Pick<ExpoConfig, 'ios'>): boolean;
export declare function setRequiresFullScreen(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;

View File

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withRequiresFullScreen = ios_plugins_1.createInfoPlistPlugin(setRequiresFullScreen, 'withRequiresFullScreen');
// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK
// 34, but will change to `false` in a future SDK version. This note was copied
// over from IosNSBundle.
function getRequiresFullScreen(config) {
var _a;
// Yes, the property is called ios.requireFullScreen, without the s - not "requires"
// This is confusing indeed because the actual property name does have the s
if ((_a = config.ios) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('requireFullScreen')) {
return !!config.ios.requireFullScreen;
}
else {
return true;
}
}
exports.getRequiresFullScreen = getRequiresFullScreen;
// Whether requires full screen on iPad
function setRequiresFullScreen(config, infoPlist) {
return Object.assign(Object.assign({}, infoPlist), { UIRequiresFullScreen: getRequiresFullScreen(config) });
}
exports.setRequiresFullScreen = setRequiresFullScreen;
//# sourceMappingURL=RequiresFullScreen.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"RequiresFullScreen.js","sourceRoot":"","sources":["../../src/ios/RequiresFullScreen.ts"],"names":[],"mappings":";;AAEA,wDAA+D;AAGlD,QAAA,sBAAsB,GAAG,mCAAqB,CACzD,qBAAqB,EACrB,wBAAwB,CACzB,CAAC;AAEF,gFAAgF;AAChF,+EAA+E;AAC/E,yBAAyB;AACzB,SAAgB,qBAAqB,CAAC,MAA+B;;IACnE,oFAAoF;IACpF,4EAA4E;IAC5E,UAAI,MAAM,CAAC,GAAG,0CAAE,cAAc,CAAC,mBAAmB,GAAG;QACnD,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;KACvC;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AARD,sDAQC;AAED,uCAAuC;AACvC,SAAgB,qBAAqB,CACnC,MAA+B,EAC/B,SAAoB;IAEpB,uCACK,SAAS,KACZ,oBAAoB,EAAE,qBAAqB,CAAC,MAAM,CAAC,IACnD;AACJ,CAAC;AARD,sDAQC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withRequiresFullScreen = createInfoPlistPlugin(\n setRequiresFullScreen,\n 'withRequiresFullScreen'\n);\n\n// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK\n// 34, but will change to `false` in a future SDK version. This note was copied\n// over from IosNSBundle.\nexport function getRequiresFullScreen(config: Pick<ExpoConfig, 'ios'>) {\n // Yes, the property is called ios.requireFullScreen, without the s - not \"requires\"\n // This is confusing indeed because the actual property name does have the s\n if (config.ios?.hasOwnProperty('requireFullScreen')) {\n return !!config.ios.requireFullScreen;\n } else {\n return true;\n }\n}\n\n// Whether requires full screen on iPad\nexport function setRequiresFullScreen(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n return {\n ...infoPlist,\n UIRequiresFullScreen: getRequiresFullScreen(config),\n };\n}\n"]}

View File

@ -0,0 +1,11 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withScheme: import("..").ConfigPlugin<void>;
export declare function getScheme(config: {
scheme?: string | string[];
}): string[];
export declare function setScheme(config: Partial<Pick<ExpoConfig, 'scheme' | 'ios'>>, infoPlist: InfoPlist): InfoPlist;
export declare function appendScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist;
export declare function removeScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist;
export declare function hasScheme(scheme: string, infoPlist: InfoPlist): boolean;
export declare function getSchemesFromPlist(infoPlist: InfoPlist): string[];

89
node_modules/@expo/config-plugins/build/ios/Scheme.js generated vendored Normal file
View File

@ -0,0 +1,89 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withScheme = ios_plugins_1.createInfoPlistPlugin(setScheme, 'withScheme');
function getScheme(config) {
if (Array.isArray(config.scheme)) {
const validate = (value) => {
return typeof value === 'string';
};
return config.scheme.filter(validate);
}
else if (typeof config.scheme === 'string') {
return [config.scheme];
}
return [];
}
exports.getScheme = getScheme;
function setScheme(config, infoPlist) {
var _a, _b;
const scheme = [
...getScheme(config),
// @ts-ignore: TODO: ios.scheme is an unreleased -- harder to add to turtle v1.
...getScheme((_a = config.ios) !== null && _a !== void 0 ? _a : {}),
];
// Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.
if ((_b = config.ios) === null || _b === void 0 ? void 0 : _b.bundleIdentifier) {
scheme.push(config.ios.bundleIdentifier);
}
if (scheme.length === 0) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { CFBundleURLTypes: [{ CFBundleURLSchemes: scheme }] });
}
exports.setScheme = setScheme;
// TODO: update this to be idempotent!
function appendScheme(scheme, infoPlist) {
if (!scheme) {
return infoPlist;
}
const existingSchemes = infoPlist.CFBundleURLTypes;
return Object.assign(Object.assign({}, infoPlist), { CFBundleURLTypes: [
...(existingSchemes !== null && existingSchemes !== void 0 ? existingSchemes : []),
{
CFBundleURLSchemes: [scheme],
},
] });
}
exports.appendScheme = appendScheme;
function removeScheme(scheme, infoPlist) {
if (!scheme) {
return infoPlist;
}
// No need to remove if we don't have any
if (!infoPlist.CFBundleURLTypes) {
return infoPlist;
}
infoPlist.CFBundleURLTypes = infoPlist.CFBundleURLTypes.map(bundleUrlType => {
const index = bundleUrlType.CFBundleURLSchemes.indexOf(scheme);
if (index > -1) {
bundleUrlType.CFBundleURLSchemes.splice(index, 1);
if (bundleUrlType.CFBundleURLSchemes.length === 0) {
return undefined;
}
}
return bundleUrlType;
}).filter(Boolean);
return infoPlist;
}
exports.removeScheme = removeScheme;
function hasScheme(scheme, infoPlist) {
const existingSchemes = infoPlist.CFBundleURLTypes;
if (!Array.isArray(existingSchemes))
return false;
return existingSchemes.some(({ CFBundleURLSchemes: schemes }) => schemes.includes(scheme));
}
exports.hasScheme = hasScheme;
function getSchemesFromPlist(infoPlist) {
if (Array.isArray(infoPlist.CFBundleURLTypes)) {
return infoPlist.CFBundleURLTypes.reduce((schemes, { CFBundleURLSchemes }) => {
if (Array.isArray(CFBundleURLSchemes)) {
return [...schemes, ...CFBundleURLSchemes];
}
return schemes;
}, []);
}
return [];
}
exports.getSchemesFromPlist = getSchemesFromPlist;
//# sourceMappingURL=Scheme.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
import { ExpoConfig } from '@expo/config-types';
import { IosSplashScreenConfig } from '@expo/configure-splash-screen';
import { ConfigPlugin } from '../Plugin.types';
export declare const withSplashScreen: ConfigPlugin;
export declare function getSplashScreen(config: ExpoConfig): IosSplashScreenConfig | undefined;
export declare function setSplashScreenAsync(config: ExpoConfig, projectRoot: string): Promise<void>;

View File

@ -0,0 +1,53 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const configure_splash_screen_1 = require("@expo/configure-splash-screen");
const core_plugins_1 = require("../plugins/core-plugins");
const WarningAggregator = __importStar(require("../utils/warnings"));
exports.withSplashScreen = config => {
return core_plugins_1.withDangerousMod(config, [
'ios',
async (config) => {
await setSplashScreenAsync(config, config.modRequest.projectRoot);
return config;
},
]);
};
function getSplashScreen(config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
if (!config.splash && !((_a = config.ios) === null || _a === void 0 ? void 0 : _a.splash)) {
return;
}
const result = {
imageResizeMode: (_f = (_d = (_c = (_b = config.ios) === null || _b === void 0 ? void 0 : _b.splash) === null || _c === void 0 ? void 0 : _c.resizeMode) !== null && _d !== void 0 ? _d : (_e = config.splash) === null || _e === void 0 ? void 0 : _e.resizeMode) !== null && _f !== void 0 ? _f : configure_splash_screen_1.SplashScreenImageResizeMode.CONTAIN,
backgroundColor: (_l = (_j = (_h = (_g = config.ios) === null || _g === void 0 ? void 0 : _g.splash) === null || _h === void 0 ? void 0 : _h.backgroundColor) !== null && _j !== void 0 ? _j : (_k = config.splash) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : '#FFFFFF',
image: (_p = (_o = (_m = config.ios) === null || _m === void 0 ? void 0 : _m.splash) === null || _o === void 0 ? void 0 : _o.image) !== null && _p !== void 0 ? _p : (_q = config.splash) === null || _q === void 0 ? void 0 : _q.image,
};
return result;
}
exports.getSplashScreen = getSplashScreen;
async function setSplashScreenAsync(config, projectRoot) {
const splashScreenIsSupported = config.sdkVersion === '39.0.0' || config.sdkVersion === '40.0.0' || !config.sdkVersion;
if (!splashScreenIsSupported) {
WarningAggregator.addWarningIOS('splash', 'Unable to automatically configure splash screen. Please refer to the expo-splash-screen README for more information: https://github.com/expo/expo/tree/master/packages/expo-splash-screen');
return;
}
const splashConfig = getSplashScreen(config);
if (!splashConfig) {
return;
}
try {
await configure_splash_screen_1.configureIosSplashScreen(projectRoot, splashConfig);
}
catch (e) {
WarningAggregator.addWarningIOS('splash', e);
}
}
exports.setSplashScreenAsync = setSplashScreenAsync;
//# sourceMappingURL=SplashScreen.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"SplashScreen.js","sourceRoot":"","sources":["../../src/ios/SplashScreen.ts"],"names":[],"mappings":";;;;;;;;;AACA,2EAIuC;AAGvC,0DAA2D;AAC3D,qEAAuD;AAE1C,QAAA,gBAAgB,GAAiB,MAAM,CAAC,EAAE;IACrD,OAAO,+BAAgB,CAAC,MAAM,EAAE;QAC9B,KAAK;QACL,KAAK,EAAC,MAAM,EAAC,EAAE;YACb,MAAM,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAClE,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,eAAe,CAAC,MAAkB;;IAChD,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,QAAC,MAAM,CAAC,GAAG,0CAAE,MAAM,CAAA,EAAE;QACzC,OAAO;KACR;IAED,MAAM,MAAM,GAA0B;QACpC,eAAe,0BACb,MAAM,CAAC,GAAG,0CAAE,MAAM,0CAAE,UAAU,yCAC9B,MAAM,CAAC,MAAM,0CAAE,UAAU,mCACzB,qDAA2B,CAAC,OAAO;QACrC,eAAe,0BACb,MAAM,CAAC,GAAG,0CAAE,MAAM,0CAAE,eAAe,yCAAI,MAAM,CAAC,MAAM,0CAAE,eAAe,mCAAI,SAAS;QACpF,KAAK,oBAAE,MAAM,CAAC,GAAG,0CAAE,MAAM,0CAAE,KAAK,yCAAI,MAAM,CAAC,MAAM,0CAAE,KAAK;KACzD,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAhBD,0CAgBC;AAEM,KAAK,UAAU,oBAAoB,CAAC,MAAkB,EAAE,WAAmB;IAChF,MAAM,uBAAuB,GAC3B,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IACzF,IAAI,CAAC,uBAAuB,EAAE;QAC5B,iBAAiB,CAAC,aAAa,CAC7B,QAAQ,EACR,2LAA2L,CAC5L,CAAC;QACF,OAAO;KACR;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAE7C,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO;KACR;IACD,IAAI;QACF,MAAM,kDAAwB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;KAC3D;IAAC,OAAO,CAAC,EAAE;QACV,iBAAiB,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;KAC9C;AACH,CAAC;AArBD,oDAqBC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport {\n configureIosSplashScreen,\n IosSplashScreenConfig,\n SplashScreenImageResizeMode,\n} from '@expo/configure-splash-screen';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withDangerousMod } from '../plugins/core-plugins';\nimport * as WarningAggregator from '../utils/warnings';\n\nexport const withSplashScreen: ConfigPlugin = config => {\n return withDangerousMod(config, [\n 'ios',\n async config => {\n await setSplashScreenAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getSplashScreen(config: ExpoConfig): IosSplashScreenConfig | undefined {\n if (!config.splash && !config.ios?.splash) {\n return;\n }\n\n const result: IosSplashScreenConfig = {\n imageResizeMode:\n config.ios?.splash?.resizeMode ??\n config.splash?.resizeMode ??\n SplashScreenImageResizeMode.CONTAIN,\n backgroundColor:\n config.ios?.splash?.backgroundColor ?? config.splash?.backgroundColor ?? '#FFFFFF', // white\n image: config.ios?.splash?.image ?? config.splash?.image,\n };\n\n return result;\n}\n\nexport async function setSplashScreenAsync(config: ExpoConfig, projectRoot: string) {\n const splashScreenIsSupported =\n config.sdkVersion === '39.0.0' || config.sdkVersion === '40.0.0' || !config.sdkVersion;\n if (!splashScreenIsSupported) {\n WarningAggregator.addWarningIOS(\n 'splash',\n 'Unable to automatically configure splash screen. Please refer to the expo-splash-screen README for more information: https://github.com/expo/expo/tree/master/packages/expo-splash-screen'\n );\n return;\n }\n\n const splashConfig = getSplashScreen(config);\n\n if (!splashConfig) {\n return;\n }\n try {\n await configureIosSplashScreen(projectRoot, splashConfig);\n } catch (e) {\n WarningAggregator.addWarningIOS('splash', e);\n }\n}\n"]}

View File

@ -0,0 +1,33 @@
/// <reference types="xcode" />
import { ConfigPlugin, XcodeProject } from '../Plugin.types';
/**
* Ensure a Swift bridging header is created for the project.
* This helps fix problems related to using modules that are written in Swift (lottie, FBSDK).
*
* 1. Ensures the file exists given the project path.
* 2. Writes the file and links to Xcode as a resource file.
* 3. Sets the build configuration `SWIFT_OBJC_BRIDGING_HEADER = [PROJECT_NAME]-Bridging-Header.h`
*/
export declare const withSwiftBridgingHeader: ConfigPlugin;
export declare function ensureSwiftBridgingHeaderSetup({ projectRoot, project, }: {
projectRoot: string;
project: XcodeProject;
}): XcodeProject;
export declare function getDesignatedSwiftBridgingHeaderFileReference({ project, }: {
project: XcodeProject;
}): string | null;
/**
*
* @param bridgingHeader The bridging header filename ex: `ExpoAPIs-Bridging-Header.h`
* @returns
*/
export declare function linkBridgingHeaderFile({ project, bridgingHeader, }: {
project: XcodeProject;
bridgingHeader: string;
}): XcodeProject;
export declare function createBridgingHeaderFile({ projectRoot, projectName, project, bridgingHeader, }: {
project: XcodeProject;
projectName: string;
projectRoot: string;
bridgingHeader: string;
}): XcodeProject;

View File

@ -0,0 +1,120 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const ios_plugins_1 = require("../plugins/ios-plugins");
const Paths_1 = require("./Paths");
const Xcodeproj_1 = require("./utils/Xcodeproj");
const templateBridgingHeader = `//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
`;
/**
* Ensure a Swift bridging header is created for the project.
* This helps fix problems related to using modules that are written in Swift (lottie, FBSDK).
*
* 1. Ensures the file exists given the project path.
* 2. Writes the file and links to Xcode as a resource file.
* 3. Sets the build configuration `SWIFT_OBJC_BRIDGING_HEADER = [PROJECT_NAME]-Bridging-Header.h`
*/
exports.withSwiftBridgingHeader = config => {
return ios_plugins_1.withXcodeProject(config, config => {
config.modResults = ensureSwiftBridgingHeaderSetup({
project: config.modResults,
projectRoot: config.modRequest.projectRoot,
});
return config;
});
};
function ensureSwiftBridgingHeaderSetup({ projectRoot, project, }) {
// Only create a bridging header if using objective-c
if (shouldCreateSwiftBridgingHeader({ projectRoot, project })) {
const projectName = Xcodeproj_1.getProjectName(projectRoot);
const bridgingHeader = createBridgingHeaderFileName(projectName);
// Ensure a bridging header is created in the Xcode project.
project = createBridgingHeaderFile({
project,
projectName,
projectRoot,
bridgingHeader,
});
// Designate the newly created file as the Swift bridging header in the Xcode project.
project = linkBridgingHeaderFile({
project,
bridgingHeader: path_1.default.join(projectName, bridgingHeader),
});
}
return project;
}
exports.ensureSwiftBridgingHeaderSetup = ensureSwiftBridgingHeaderSetup;
function shouldCreateSwiftBridgingHeader({ projectRoot, project, }) {
// Only create a bridging header if the project is using in Objective C (AppDelegate is written in Objc).
const isObjc = Paths_1.getAppDelegate(projectRoot).language === 'objc';
return isObjc && !getDesignatedSwiftBridgingHeaderFileReference({ project });
}
/**
* @returns String matching the default name used when Xcode automatically creates a bridging header file.
*/
function createBridgingHeaderFileName(projectName) {
return `${projectName}-Bridging-Header.h`;
}
function getDesignatedSwiftBridgingHeaderFileReference({ project, }) {
const configurations = project.pbxXCBuildConfigurationSection();
// @ts-ignore
for (const { buildSettings } of Object.values(configurations || {})) {
// Guessing that this is the best way to emulate Xcode.
// Using `project.addToBuildSettings` modifies too many targets.
if (typeof (buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.PRODUCT_NAME) !== 'undefined') {
if (typeof buildSettings.SWIFT_OBJC_BRIDGING_HEADER === 'string' &&
buildSettings.SWIFT_OBJC_BRIDGING_HEADER) {
return buildSettings.SWIFT_OBJC_BRIDGING_HEADER;
}
}
}
return null;
}
exports.getDesignatedSwiftBridgingHeaderFileReference = getDesignatedSwiftBridgingHeaderFileReference;
/**
*
* @param bridgingHeader The bridging header filename ex: `ExpoAPIs-Bridging-Header.h`
* @returns
*/
function linkBridgingHeaderFile({ project, bridgingHeader, }) {
const configurations = project.pbxXCBuildConfigurationSection();
// @ts-ignore
for (const { buildSettings } of Object.values(configurations || {})) {
// Guessing that this is the best way to emulate Xcode.
// Using `project.addToBuildSettings` modifies too many targets.
if (typeof (buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.PRODUCT_NAME) !== 'undefined') {
buildSettings.SWIFT_OBJC_BRIDGING_HEADER = bridgingHeader;
}
}
return project;
}
exports.linkBridgingHeaderFile = linkBridgingHeaderFile;
function createBridgingHeaderFile({ projectRoot, projectName, project, bridgingHeader, }) {
const bridgingHeaderProjectPath = path_1.default.join(Paths_1.getSourceRoot(projectRoot), bridgingHeader);
if (!fs_extra_1.default.existsSync(bridgingHeaderProjectPath)) {
// Create the file
fs_extra_1.default.writeFileSync(bridgingHeaderProjectPath, templateBridgingHeader, 'utf8');
}
// This is non-standard, Xcode generates the bridging header in `/ios` which is kinda annoying.
// Instead, this'll generate the default header in the application code folder `/ios/myproject/`.
const filePath = `${projectName}/${bridgingHeader}`;
// Ensure the file is linked with Xcode resource files
if (!project.hasFile(filePath)) {
project = Xcodeproj_1.addResourceFileToGroup({
filepath: filePath,
groupName: projectName,
project,
// Not sure why, but this is how Xcode generates it.
isBuildFile: false,
});
}
return project;
}
exports.createBridgingHeaderFile = createBridgingHeaderFile;
//# sourceMappingURL=SwiftBridgingHeader.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
import { ExpoConfig } from '@expo/config-types';
import xcode from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
import { ExpoPlist } from './IosConfig.types';
declare type ExpoConfigUpdates = Pick<ExpoConfig, 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'>;
export declare enum Config {
ENABLED = "EXUpdatesEnabled",
CHECK_ON_LAUNCH = "EXUpdatesCheckOnLaunch",
LAUNCH_WAIT_MS = "EXUpdatesLaunchWaitMs",
RUNTIME_VERSION = "EXUpdatesRuntimeVersion",
SDK_VERSION = "EXUpdatesSDKVersion",
UPDATE_URL = "EXUpdatesURL",
RELEASE_CHANNEL = "EXUpdatesReleaseChannel"
}
export declare function getUpdateUrl(config: Pick<ExpoConfigUpdates, 'owner' | 'slug'>, username: string | null): string | null;
export declare function getRuntimeVersion(config: Pick<ExpoConfigUpdates, 'runtimeVersion'>): string | null;
export declare function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null;
export declare function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean;
export declare function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number;
export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>): 'NEVER' | 'ALWAYS';
export declare const withUpdates: ConfigPlugin<{
expoUsername: string | null;
}>;
export declare function setUpdatesConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist, username: string | null): ExpoPlist;
export declare function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist;
interface ShellScriptBuildPhase {
isa: 'PBXShellScriptBuildPhase';
name: string;
shellScript: string;
[key: string]: any;
}
export declare function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase;
export declare function ensureBundleReactNativePhaseContainsConfigurationScript(projectRoot: string, project: xcode.XcodeProject): xcode.XcodeProject;
export declare function isShellScriptBuildPhaseConfigured(projectRoot: string, project: xcode.XcodeProject): boolean;
export declare function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean;
export declare function isPlistConfigurationSynced(config: ExpoConfigUpdates, expoPlist: ExpoPlist, username: string | null): boolean;
export declare function isPlistVersionConfigurationSynced(config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>, expoPlist: ExpoPlist): boolean;
export {};

159
node_modules/@expo/config-plugins/build/ios/Updates.js generated vendored Normal file
View File

@ -0,0 +1,159 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path = __importStar(require("path"));
const resolve_from_1 = __importDefault(require("resolve-from"));
const ios_plugins_1 = require("../plugins/ios-plugins");
const CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';
var Config;
(function (Config) {
Config["ENABLED"] = "EXUpdatesEnabled";
Config["CHECK_ON_LAUNCH"] = "EXUpdatesCheckOnLaunch";
Config["LAUNCH_WAIT_MS"] = "EXUpdatesLaunchWaitMs";
Config["RUNTIME_VERSION"] = "EXUpdatesRuntimeVersion";
Config["SDK_VERSION"] = "EXUpdatesSDKVersion";
Config["UPDATE_URL"] = "EXUpdatesURL";
Config["RELEASE_CHANNEL"] = "EXUpdatesReleaseChannel";
})(Config = exports.Config || (exports.Config = {}));
function getUpdateUrl(config, username) {
const user = typeof config.owner === 'string' ? config.owner : username;
if (!user) {
return null;
}
return `https://exp.host/@${user}/${config.slug}`;
}
exports.getUpdateUrl = getUpdateUrl;
function getRuntimeVersion(config) {
return typeof config.runtimeVersion === 'string' ? config.runtimeVersion : null;
}
exports.getRuntimeVersion = getRuntimeVersion;
function getSDKVersion(config) {
return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;
}
exports.getSDKVersion = getSDKVersion;
function getUpdatesEnabled(config) {
var _a;
return ((_a = config.updates) === null || _a === void 0 ? void 0 : _a.enabled) !== false;
}
exports.getUpdatesEnabled = getUpdatesEnabled;
function getUpdatesTimeout(config) {
var _a, _b;
return (_b = (_a = config.updates) === null || _a === void 0 ? void 0 : _a.fallbackToCacheTimeout) !== null && _b !== void 0 ? _b : 0;
}
exports.getUpdatesTimeout = getUpdatesTimeout;
function getUpdatesCheckOnLaunch(config) {
var _a, _b;
if (((_a = config.updates) === null || _a === void 0 ? void 0 : _a.checkAutomatically) === 'ON_ERROR_RECOVERY') {
return 'NEVER';
}
else if (((_b = config.updates) === null || _b === void 0 ? void 0 : _b.checkAutomatically) === 'ON_LOAD') {
return 'ALWAYS';
}
return 'ALWAYS';
}
exports.getUpdatesCheckOnLaunch = getUpdatesCheckOnLaunch;
exports.withUpdates = (config, { expoUsername }) => {
return ios_plugins_1.withExpoPlist(config, config => {
config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);
return config;
});
};
function setUpdatesConfig(config, expoPlist, username) {
const newExpoPlist = Object.assign(Object.assign({}, expoPlist), { [Config.ENABLED]: getUpdatesEnabled(config), [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config), [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config) });
const updateUrl = getUpdateUrl(config, username);
if (updateUrl) {
newExpoPlist[Config.UPDATE_URL] = updateUrl;
}
else {
delete newExpoPlist[Config.UPDATE_URL];
}
return setVersionsConfig(config, newExpoPlist);
}
exports.setUpdatesConfig = setUpdatesConfig;
function setVersionsConfig(config, expoPlist) {
const newExpoPlist = Object.assign({}, expoPlist);
const runtimeVersion = getRuntimeVersion(config);
const sdkVersion = getSDKVersion(config);
if (runtimeVersion) {
delete newExpoPlist[Config.SDK_VERSION];
newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;
}
else if (sdkVersion) {
delete newExpoPlist[Config.RUNTIME_VERSION];
newExpoPlist[Config.SDK_VERSION] = sdkVersion;
}
else {
delete newExpoPlist[Config.SDK_VERSION];
delete newExpoPlist[Config.RUNTIME_VERSION];
}
return newExpoPlist;
}
exports.setVersionsConfig = setVersionsConfig;
function formatConfigurationScriptPath(projectRoot) {
const buildScriptPath = resolve_from_1.default.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);
if (!buildScriptPath) {
throw new Error("Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.");
}
const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);
return process.platform === 'win32' ? relativePath.replace(/\\/g, '/') : relativePath;
}
function getBundleReactNativePhase(project) {
const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase;
const bundleReactNative = Object.values(shellScriptBuildPhase).find(buildPhase => buildPhase.name === '"Bundle React Native code and images"');
if (!bundleReactNative) {
throw new Error(`Couldn't find a build phase "Bundle React Native code and images"`);
}
return bundleReactNative;
}
exports.getBundleReactNativePhase = getBundleReactNativePhase;
function ensureBundleReactNativePhaseContainsConfigurationScript(projectRoot, project) {
const bundleReactNative = getBundleReactNativePhase(project);
const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);
if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {
// check if there's already another path to create-manifest-ios.sh
// this might be the case for monorepos
if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {
bundleReactNative.shellScript = bundleReactNative.shellScript.replace(new RegExp(`(\\\\n)(\\.\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`), '');
}
bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(/"$/, '')}${buildPhaseShellScriptPath}\\n"`;
}
return project;
}
exports.ensureBundleReactNativePhaseContainsConfigurationScript = ensureBundleReactNativePhaseContainsConfigurationScript;
function isShellScriptBuildPhaseConfigured(projectRoot, project) {
const bundleReactNative = getBundleReactNativePhase(project);
const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);
return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);
}
exports.isShellScriptBuildPhaseConfigured = isShellScriptBuildPhaseConfigured;
function isPlistConfigurationSet(expoPlist) {
return Boolean(expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion));
}
exports.isPlistConfigurationSet = isPlistConfigurationSet;
function isPlistConfigurationSynced(config, expoPlist, username) {
return (getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&
getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&
getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&
getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&
isPlistVersionConfigurationSynced(config, expoPlist));
}
exports.isPlistConfigurationSynced = isPlistConfigurationSynced;
function isPlistVersionConfigurationSynced(config, expoPlist) {
var _a, _b;
const expectedRuntimeVersion = getRuntimeVersion(config);
const expectedSdkVersion = getSDKVersion(config);
const currentRuntimeVersion = (_a = expoPlist.EXUpdatesRuntimeVersion) !== null && _a !== void 0 ? _a : null;
const currentSdkVersion = (_b = expoPlist.EXUpdatesSDKVersion) !== null && _b !== void 0 ? _b : null;
return (currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === expectedRuntimeVersion);
}
exports.isPlistVersionConfigurationSynced = isPlistVersionConfigurationSynced;
//# sourceMappingURL=Updates.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withUserInterfaceStyle: import("..").ConfigPlugin<void>;
export declare function getUserInterfaceStyle(config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>): string | null;
export declare function setUserInterfaceStyle(config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>, { UIUserInterfaceStyle, ...infoPlist }: InfoPlist): InfoPlist;

View File

@ -0,0 +1,42 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withUserInterfaceStyle = ios_plugins_1.createInfoPlistPlugin(setUserInterfaceStyle, 'withUserInterfaceStyle');
function getUserInterfaceStyle(config) {
var _a, _b, _c;
return (_c = (_b = (_a = config.ios) === null || _a === void 0 ? void 0 : _a.userInterfaceStyle) !== null && _b !== void 0 ? _b : config.userInterfaceStyle) !== null && _c !== void 0 ? _c : null;
}
exports.getUserInterfaceStyle = getUserInterfaceStyle;
function setUserInterfaceStyle(config, _a) {
var { UIUserInterfaceStyle } = _a, infoPlist = __rest(_a, ["UIUserInterfaceStyle"]);
const userInterfaceStyle = getUserInterfaceStyle(config);
const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);
if (!style) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { UIUserInterfaceStyle: style });
}
exports.setUserInterfaceStyle = setUserInterfaceStyle;
function mapUserInterfaceStyleForInfoPlist(userInterfaceStyle) {
switch (userInterfaceStyle) {
case 'light':
return 'Light';
case 'dark':
return 'Dark';
case 'automatic':
return 'Automatic';
}
return null;
}
//# sourceMappingURL=UserInterfaceStyle.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"UserInterfaceStyle.js","sourceRoot":"","sources":["../../src/ios/UserInterfaceStyle.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,wDAA+D;AAGlD,QAAA,sBAAsB,GAAG,mCAAqB,CACzD,qBAAqB,EACrB,wBAAwB,CACzB,CAAC;AAEF,SAAgB,qBAAqB,CACnC,MAAsD;;IAEtD,yBAAO,MAAM,CAAC,GAAG,0CAAE,kBAAkB,mCAAI,MAAM,CAAC,kBAAkB,mCAAI,IAAI,CAAC;AAC7E,CAAC;AAJD,sDAIC;AAED,SAAgB,qBAAqB,CACnC,MAAsD,EACtD,EAAiD;QAAjD,EAAE,oBAAoB,OAA2B,EAAzB,gDAAY;IAEpC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,iCAAiC,CAAC,kBAAkB,CAAC,CAAC;IAEpE,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,SAAS,KACZ,oBAAoB,EAAE,KAAK,IAC3B;AACJ,CAAC;AAfD,sDAeC;AAED,SAAS,iCAAiC,CACxC,kBAAiC;IAEjC,QAAQ,kBAAkB,EAAE;QAC1B,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;KACtB;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceStyle } from './IosConfig.types';\n\nexport const withUserInterfaceStyle = createInfoPlistPlugin(\n setUserInterfaceStyle,\n 'withUserInterfaceStyle'\n);\n\nexport function getUserInterfaceStyle(\n config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>\n): string | null {\n return config.ios?.userInterfaceStyle ?? config.userInterfaceStyle ?? null;\n}\n\nexport function setUserInterfaceStyle(\n config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>,\n { UIUserInterfaceStyle, ...infoPlist }: InfoPlist\n): InfoPlist {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);\n\n if (!style) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n UIUserInterfaceStyle: style,\n };\n}\n\nfunction mapUserInterfaceStyleForInfoPlist(\n userInterfaceStyle: string | null\n): InterfaceStyle | null {\n switch (userInterfaceStyle) {\n case 'light':\n return 'Light';\n case 'dark':\n return 'Dark';\n case 'automatic':\n return 'Automatic';\n }\n\n return null;\n}\n"]}

View File

@ -0,0 +1,5 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withUsesNonExemptEncryption: import("..").ConfigPlugin<void>;
export declare function getUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>): boolean | null;
export declare function setUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>, { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist): InfoPlist;

View File

@ -0,0 +1,31 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withUsesNonExemptEncryption = ios_plugins_1.createInfoPlistPlugin(setUsesNonExemptEncryption, 'withUsesNonExemptEncryption');
function getUsesNonExemptEncryption(config) {
var _a, _b, _c;
return (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.ios) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.usesNonExemptEncryption) !== null && _c !== void 0 ? _c : null;
}
exports.getUsesNonExemptEncryption = getUsesNonExemptEncryption;
function setUsesNonExemptEncryption(config, _a) {
var { ITSAppUsesNonExemptEncryption } = _a, infoPlist = __rest(_a, ["ITSAppUsesNonExemptEncryption"]);
const usesNonExemptEncryption = getUsesNonExemptEncryption(config);
// Make no changes if the key is left blank
if (usesNonExemptEncryption === null) {
return infoPlist;
}
return Object.assign(Object.assign({}, infoPlist), { ITSAppUsesNonExemptEncryption: usesNonExemptEncryption });
}
exports.setUsesNonExemptEncryption = setUsesNonExemptEncryption;
//# sourceMappingURL=UsesNonExemptEncryption.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"UsesNonExemptEncryption.js","sourceRoot":"","sources":["../../src/ios/UsesNonExemptEncryption.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,wDAA+D;AAGlD,QAAA,2BAA2B,GAAG,mCAAqB,CAC9D,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;AAEF,SAAgB,0BAA0B,CAAC,MAA+B;;IACxE,yBAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,0CAAE,MAAM,0CAAE,uBAAuB,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAFD,gEAEC;AAED,SAAgB,0BAA0B,CACxC,MAA+B,EAC/B,EAA0D;QAA1D,EAAE,6BAA6B,OAA2B,EAAzB,yDAAY;IAE7C,MAAM,uBAAuB,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAEnE,2CAA2C;IAC3C,IAAI,uBAAuB,KAAK,IAAI,EAAE;QACpC,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,SAAS,KACZ,6BAA6B,EAAE,uBAAuB,IACtD;AACJ,CAAC;AAfD,gEAeC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withUsesNonExemptEncryption = createInfoPlistPlugin(\n setUsesNonExemptEncryption,\n 'withUsesNonExemptEncryption'\n);\n\nexport function getUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>) {\n return config?.ios?.config?.usesNonExemptEncryption ?? null;\n}\n\nexport function setUsesNonExemptEncryption(\n config: Pick<ExpoConfig, 'ios'>,\n { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist\n): InfoPlist {\n const usesNonExemptEncryption = getUsesNonExemptEncryption(config);\n\n // Make no changes if the key is left blank\n if (usesNonExemptEncryption === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n ITSAppUsesNonExemptEncryption: usesNonExemptEncryption,\n };\n}\n"]}

View File

@ -0,0 +1,8 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withVersion: import("..").ConfigPlugin<void>;
export declare const withBuildNumber: import("..").ConfigPlugin<void>;
export declare function getVersion(config: Pick<ExpoConfig, 'version'>): string;
export declare function setVersion(config: Pick<ExpoConfig, 'version'>, infoPlist: InfoPlist): InfoPlist;
export declare function getBuildNumber(config: Pick<ExpoConfig, 'ios'>): string;
export declare function setBuildNumber(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;

23
node_modules/@expo/config-plugins/build/ios/Version.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ios_plugins_1 = require("../plugins/ios-plugins");
exports.withVersion = ios_plugins_1.createInfoPlistPlugin(setVersion, 'withVersion');
exports.withBuildNumber = ios_plugins_1.createInfoPlistPlugin(setBuildNumber, 'withBuildNumber');
function getVersion(config) {
return config.version || '0.0.0';
}
exports.getVersion = getVersion;
function setVersion(config, infoPlist) {
return Object.assign(Object.assign({}, infoPlist), { CFBundleShortVersionString: getVersion(config) });
}
exports.setVersion = setVersion;
function getBuildNumber(config) {
var _a;
return ((_a = config.ios) === null || _a === void 0 ? void 0 : _a.buildNumber) ? config.ios.buildNumber : '1';
}
exports.getBuildNumber = getBuildNumber;
function setBuildNumber(config, infoPlist) {
return Object.assign(Object.assign({}, infoPlist), { CFBundleVersion: getBuildNumber(config) });
}
exports.setBuildNumber = setBuildNumber;
//# sourceMappingURL=Version.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Version.js","sourceRoot":"","sources":["../../src/ios/Version.ts"],"names":[],"mappings":";;AAEA,wDAA+D;AAGlD,QAAA,WAAW,GAAG,mCAAqB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAG,mCAAqB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAExF,SAAgB,UAAU,CAAC,MAAmC;IAC5D,OAAO,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC;AACnC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,MAAmC,EAAE,SAAoB;IAClF,uCACK,SAAS,KACZ,0BAA0B,EAAE,UAAU,CAAC,MAAM,CAAC,IAC9C;AACJ,CAAC;AALD,gCAKC;AAED,SAAgB,cAAc,CAAC,MAA+B;;IAC5D,OAAO,OAAA,MAAM,CAAC,GAAG,0CAAE,WAAW,EAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,cAAc,CAAC,MAA+B,EAAE,SAAoB;IAClF,uCACK,SAAS,KACZ,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,IACvC;AACJ,CAAC;AALD,wCAKC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nexport const withVersion = createInfoPlistPlugin(setVersion, 'withVersion');\n\nexport const withBuildNumber = createInfoPlistPlugin(setBuildNumber, 'withBuildNumber');\n\nexport function getVersion(config: Pick<ExpoConfig, 'version'>) {\n return config.version || '0.0.0';\n}\n\nexport function setVersion(config: Pick<ExpoConfig, 'version'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleShortVersionString: getVersion(config),\n };\n}\n\nexport function getBuildNumber(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.buildNumber ? config.ios.buildNumber : '1';\n}\n\nexport function setBuildNumber(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleVersion: getBuildNumber(config),\n };\n}\n"]}

View File

@ -0,0 +1,31 @@
/// <reference types="xcode" />
import { ConfigPlugin, XcodeProject } from '../Plugin.types';
/**
* Create a build source file and link it to Xcode.
*
* @param config
* @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.
* @param props.contents file contents to write.
* @param props.overwrite should the contents overwrite any existing file in the same location on disk.
* @returns
*/
export declare const withBuildSourceFile: ConfigPlugin<{
filePath: string;
contents: string;
overwrite?: boolean;
}>;
/**
* Add a source file to the Xcode project and write it to the file system.
*
* @param nativeProjectRoot absolute path to the native app root `user/app/ios`
* @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`
* @param fileContents string file contents to write to the `filePath`
* @param overwrite should write file even if one already exists
*/
export declare function createBuildSourceFile({ project, nativeProjectRoot, filePath, fileContents, overwrite, }: {
project: XcodeProject;
nativeProjectRoot: string;
filePath: string;
fileContents: string;
overwrite?: boolean;
}): XcodeProject;

View File

@ -0,0 +1,59 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const ios_plugins_1 = require("../plugins/ios-plugins");
const Xcodeproj_1 = require("./utils/Xcodeproj");
/**
* Create a build source file and link it to Xcode.
*
* @param config
* @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.
* @param props.contents file contents to write.
* @param props.overwrite should the contents overwrite any existing file in the same location on disk.
* @returns
*/
exports.withBuildSourceFile = (config, { filePath, contents, overwrite }) => {
return ios_plugins_1.withXcodeProject(config, config => {
const projectName = Xcodeproj_1.getProjectName(config.modRequest.projectRoot);
config.modResults = createBuildSourceFile({
project: config.modResults,
nativeProjectRoot: config.modRequest.platformProjectRoot,
fileContents: contents,
filePath: path_1.default.join(projectName, filePath),
overwrite,
});
return config;
});
};
/**
* Add a source file to the Xcode project and write it to the file system.
*
* @param nativeProjectRoot absolute path to the native app root `user/app/ios`
* @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`
* @param fileContents string file contents to write to the `filePath`
* @param overwrite should write file even if one already exists
*/
function createBuildSourceFile({ project, nativeProjectRoot, filePath, fileContents, overwrite, }) {
const absoluteFilePath = path_1.default.join(nativeProjectRoot, filePath);
if (overwrite || !fs_extra_1.default.existsSync(absoluteFilePath)) {
// Create the file
fs_extra_1.default.writeFileSync(absoluteFilePath, fileContents, 'utf8');
}
// `myapp`
const groupName = path_1.default.dirname(filePath);
// Ensure the file is linked with Xcode resource files
if (!project.hasFile(filePath)) {
project = Xcodeproj_1.addBuildSourceFileToGroup({
filepath: filePath,
groupName,
project,
});
}
return project;
}
exports.createBuildSourceFile = createBuildSourceFile;
//# sourceMappingURL=XcodeProjectFile.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"XcodeProjectFile.js","sourceRoot":"","sources":["../../src/ios/XcodeProjectFile.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAGxB,wDAA0D;AAC1D,iDAA8E;AAE9E;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAI3B,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IACjD,OAAO,8BAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QACvC,MAAM,WAAW,GAAG,0BAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAElE,MAAM,CAAC,UAAU,GAAG,qBAAqB,CAAC;YACxC,OAAO,EAAE,MAAM,CAAC,UAAU;YAC1B,iBAAiB,EAAE,MAAM,CAAC,UAAU,CAAC,mBAAmB;YACxD,YAAY,EAAE,QAAQ;YACtB,QAAQ,EAAE,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;YAC1C,SAAS;SACV,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,SAAS,GAOV;IACC,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IAChE,IAAI,SAAS,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACjD,kBAAkB;QAClB,kBAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;KAC1D;IAED,UAAU;IACV,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEzC,sDAAsD;IACtD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC9B,OAAO,GAAG,qCAAyB,CAAC;YAClC,QAAQ,EAAE,QAAQ;YAClB,SAAS;YACT,OAAO;SACR,CAAC,CAAC;KACJ;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AA/BD,sDA+BC","sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\n\nimport { ConfigPlugin, XcodeProject } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\nimport { addBuildSourceFileToGroup, getProjectName } from './utils/Xcodeproj';\n\n/**\n * Create a build source file and link it to Xcode.\n *\n * @param config\n * @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.\n * @param props.contents file contents to write.\n * @param props.overwrite should the contents overwrite any existing file in the same location on disk.\n * @returns\n */\nexport const withBuildSourceFile: ConfigPlugin<{\n filePath: string;\n contents: string;\n overwrite?: boolean;\n}> = (config, { filePath, contents, overwrite }) => {\n return withXcodeProject(config, config => {\n const projectName = getProjectName(config.modRequest.projectRoot);\n\n config.modResults = createBuildSourceFile({\n project: config.modResults,\n nativeProjectRoot: config.modRequest.platformProjectRoot,\n fileContents: contents,\n filePath: path.join(projectName, filePath),\n overwrite,\n });\n return config;\n });\n};\n\n/**\n * Add a source file to the Xcode project and write it to the file system.\n *\n * @param nativeProjectRoot absolute path to the native app root `user/app/ios`\n * @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`\n * @param fileContents string file contents to write to the `filePath`\n * @param overwrite should write file even if one already exists\n */\nexport function createBuildSourceFile({\n project,\n nativeProjectRoot,\n filePath,\n fileContents,\n overwrite,\n}: {\n project: XcodeProject;\n nativeProjectRoot: string;\n filePath: string;\n fileContents: string;\n overwrite?: boolean;\n}): XcodeProject {\n const absoluteFilePath = path.join(nativeProjectRoot, filePath);\n if (overwrite || !fs.existsSync(absoluteFilePath)) {\n // Create the file\n fs.writeFileSync(absoluteFilePath, fileContents, 'utf8');\n }\n\n // `myapp`\n const groupName = path.dirname(filePath);\n\n // Ensure the file is linked with Xcode resource files\n if (!project.hasFile(filePath)) {\n project = addBuildSourceFileToGroup({\n filepath: filePath,\n groupName,\n project,\n });\n }\n return project;\n}\n"]}

29
node_modules/@expo/config-plugins/build/ios/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,29 @@
import * as AdMob from './AdMob';
import * as Branch from './Branch';
import * as BuildScheme from './BuildScheme';
import * as BundleIdentifier from './BundleIdentifier';
import * as CustomInfoPlistEntries from './CustomInfoPlistEntries';
import * as DeviceFamily from './DeviceFamily';
import * as Entitlements from './Entitlements';
import * as Facebook from './Facebook';
import * as Google from './Google';
import * as Icons from './Icons';
import { ExpoPlist, InfoPlist } from './IosConfig.types';
import * as Locales from './Locales';
import * as Maps from './Maps';
import * as Name from './Name';
import * as Orientation from './Orientation';
import * as Paths from './Paths';
import * as Permissions from './Permissions';
import * as ProvisioningProfile from './ProvisioningProfile';
import * as RequiresFullScreen from './RequiresFullScreen';
import * as Scheme from './Scheme';
import * as SplashScreen from './SplashScreen';
import * as SwiftBridgingHeader from './SwiftBridgingHeader';
import * as Updates from './Updates';
import * as UserInterfaceStyle from './UserInterfaceStyle';
import * as UsesNonExemptEncryption from './UsesNonExemptEncryption';
import * as Version from './Version';
import * as XcodeProjectFile from './XcodeProjectFile';
import * as XcodeUtils from './utils/Xcodeproj';
export { AdMob, Branch, BuildScheme, BundleIdentifier, CustomInfoPlistEntries, DeviceFamily, Entitlements, Facebook, Google, Maps, Icons, Locales, SplashScreen, InfoPlist, ExpoPlist, Name, Orientation, Paths, ProvisioningProfile, Permissions, RequiresFullScreen, Scheme, SwiftBridgingHeader, Updates, UserInterfaceStyle, UsesNonExemptEncryption, Version, XcodeProjectFile, XcodeUtils, };

64
node_modules/@expo/config-plugins/build/ios/index.js generated vendored Normal file
View File

@ -0,0 +1,64 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const AdMob = __importStar(require("./AdMob"));
exports.AdMob = AdMob;
const Branch = __importStar(require("./Branch"));
exports.Branch = Branch;
const BuildScheme = __importStar(require("./BuildScheme"));
exports.BuildScheme = BuildScheme;
const BundleIdentifier = __importStar(require("./BundleIdentifier"));
exports.BundleIdentifier = BundleIdentifier;
const CustomInfoPlistEntries = __importStar(require("./CustomInfoPlistEntries"));
exports.CustomInfoPlistEntries = CustomInfoPlistEntries;
const DeviceFamily = __importStar(require("./DeviceFamily"));
exports.DeviceFamily = DeviceFamily;
const Entitlements = __importStar(require("./Entitlements"));
exports.Entitlements = Entitlements;
const Facebook = __importStar(require("./Facebook"));
exports.Facebook = Facebook;
const Google = __importStar(require("./Google"));
exports.Google = Google;
const Icons = __importStar(require("./Icons"));
exports.Icons = Icons;
const Locales = __importStar(require("./Locales"));
exports.Locales = Locales;
const Maps = __importStar(require("./Maps"));
exports.Maps = Maps;
const Name = __importStar(require("./Name"));
exports.Name = Name;
const Orientation = __importStar(require("./Orientation"));
exports.Orientation = Orientation;
const Paths = __importStar(require("./Paths"));
exports.Paths = Paths;
const Permissions = __importStar(require("./Permissions"));
exports.Permissions = Permissions;
const ProvisioningProfile = __importStar(require("./ProvisioningProfile"));
exports.ProvisioningProfile = ProvisioningProfile;
const RequiresFullScreen = __importStar(require("./RequiresFullScreen"));
exports.RequiresFullScreen = RequiresFullScreen;
const Scheme = __importStar(require("./Scheme"));
exports.Scheme = Scheme;
const SplashScreen = __importStar(require("./SplashScreen"));
exports.SplashScreen = SplashScreen;
const SwiftBridgingHeader = __importStar(require("./SwiftBridgingHeader"));
exports.SwiftBridgingHeader = SwiftBridgingHeader;
const Updates = __importStar(require("./Updates"));
exports.Updates = Updates;
const UserInterfaceStyle = __importStar(require("./UserInterfaceStyle"));
exports.UserInterfaceStyle = UserInterfaceStyle;
const UsesNonExemptEncryption = __importStar(require("./UsesNonExemptEncryption"));
exports.UsesNonExemptEncryption = UsesNonExemptEncryption;
const Version = __importStar(require("./Version"));
exports.Version = Version;
const XcodeProjectFile = __importStar(require("./XcodeProjectFile"));
exports.XcodeProjectFile = XcodeProjectFile;
const XcodeUtils = __importStar(require("./utils/Xcodeproj"));
exports.XcodeUtils = XcodeUtils;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ios/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAiC;AAiC/B,sBAAK;AAhCP,iDAAmC;AAiCjC,wBAAM;AAhCR,2DAA6C;AAiC3C,kCAAW;AAhCb,qEAAuD;AAiCrD,4CAAgB;AAhClB,iFAAmE;AAiCjE,wDAAsB;AAhCxB,6DAA+C;AAiC7C,oCAAY;AAhCd,6DAA+C;AAiC7C,oCAAY;AAhCd,qDAAuC;AAiCrC,4BAAQ;AAhCV,iDAAmC;AAiCjC,wBAAM;AAhCR,+CAAiC;AAkC/B,sBAAK;AAhCP,mDAAqC;AAiCnC,0BAAO;AAhCT,6CAA+B;AA8B7B,oBAAI;AA7BN,6CAA+B;AAmC7B,oBAAI;AAlCN,2DAA6C;AAmC3C,kCAAW;AAlCb,+CAAiC;AAmC/B,sBAAK;AAlCP,2DAA6C;AAoC3C,kCAAW;AAnCb,2EAA6D;AAkC3D,kDAAmB;AAjCrB,yEAA2D;AAmCzD,gDAAkB;AAlCpB,iDAAmC;AAmCjC,wBAAM;AAlCR,6DAA+C;AAyB7C,oCAAY;AAxBd,2EAA6D;AAkC3D,kDAAmB;AAjCrB,mDAAqC;AAkCnC,0BAAO;AAjCT,yEAA2D;AAkCzD,gDAAkB;AAjCpB,mFAAqE;AAkCnE,0DAAuB;AAjCzB,mDAAqC;AAkCnC,0BAAO;AAjCT,qEAAuD;AAkCrD,4CAAgB;AAjClB,8DAAgD;AAkC9C,gCAAU","sourcesContent":["import * as AdMob from './AdMob';\nimport * as Branch from './Branch';\nimport * as BuildScheme from './BuildScheme';\nimport * as BundleIdentifier from './BundleIdentifier';\nimport * as CustomInfoPlistEntries from './CustomInfoPlistEntries';\nimport * as DeviceFamily from './DeviceFamily';\nimport * as Entitlements from './Entitlements';\nimport * as Facebook from './Facebook';\nimport * as Google from './Google';\nimport * as Icons from './Icons';\nimport { ExpoPlist, InfoPlist } from './IosConfig.types';\nimport * as Locales from './Locales';\nimport * as Maps from './Maps';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as ProvisioningProfile from './ProvisioningProfile';\nimport * as RequiresFullScreen from './RequiresFullScreen';\nimport * as Scheme from './Scheme';\nimport * as SplashScreen from './SplashScreen';\nimport * as SwiftBridgingHeader from './SwiftBridgingHeader';\nimport * as Updates from './Updates';\nimport * as UserInterfaceStyle from './UserInterfaceStyle';\nimport * as UsesNonExemptEncryption from './UsesNonExemptEncryption';\nimport * as Version from './Version';\nimport * as XcodeProjectFile from './XcodeProjectFile';\nimport * as XcodeUtils from './utils/Xcodeproj';\n\n// We can change this to export * as X with TypeScript 3.8+\n// https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#export-star-as-namespace-syntax\n// .. but we should wait for this to be the default VSCode version.\nexport {\n AdMob,\n Branch,\n BuildScheme,\n BundleIdentifier,\n CustomInfoPlistEntries,\n DeviceFamily,\n Entitlements,\n Facebook,\n Google,\n Maps,\n Icons,\n Locales,\n SplashScreen,\n InfoPlist,\n ExpoPlist,\n Name,\n Orientation,\n Paths,\n ProvisioningProfile,\n Permissions,\n RequiresFullScreen,\n Scheme,\n SwiftBridgingHeader,\n Updates,\n UserInterfaceStyle,\n UsesNonExemptEncryption,\n Version,\n XcodeProjectFile,\n XcodeUtils,\n};\n"]}

View File

@ -0,0 +1,76 @@
import { ExpoConfig } from '@expo/config-types';
import xcode, { PBXFile, PBXGroup, PBXNativeTarget, PBXProject, XCBuildConfiguration, XCConfigurationList, XcodeProject } from 'xcode';
export declare type ProjectSectionEntry = [string, PBXProject];
export declare type NativeTargetSection = Record<string, PBXNativeTarget>;
export declare type NativeTargetSectionEntry = [string, PBXNativeTarget];
export declare type ConfigurationLists = Record<string, XCConfigurationList>;
export declare type ConfigurationListEntry = [string, XCConfigurationList];
export declare type ConfigurationSectionEntry = [string, XCBuildConfiguration];
export declare function getProjectName(projectRoot: string): string;
export declare function getHackyProjectName(projectRoot: string, config: ExpoConfig): string;
/**
* Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
export declare function addResourceFileToGroup({ filepath, groupName, isBuildFile, project, }: {
filepath: string;
groupName: string;
isBuildFile?: boolean;
project: XcodeProject;
}): XcodeProject;
/**
* Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
export declare function addBuildSourceFileToGroup({ filepath, groupName, project, }: {
filepath: string;
groupName: string;
project: XcodeProject;
}): XcodeProject;
export declare function addFileToGroupAndLink({ filepath, groupName, project, addFileToProject, }: {
filepath: string;
groupName: string;
project: XcodeProject;
addFileToProject: (props: {
file: PBXFile;
project: XcodeProject;
}) => void;
}): XcodeProject;
export declare function getApplicationNativeTarget({ project, projectName, }: {
project: XcodeProject;
projectName: string;
}): {
uuid: string;
target: xcode.PBXNativeTarget;
};
/**
* Add a framework to the default app native target.
*
* @param projectName Name of the PBX project.
* @param framework String ending in `.framework`, i.e. `StoreKit.framework`
*/
export declare function addFramework({ project, projectName, framework, }: {
project: XcodeProject;
projectName: string;
framework: string;
}): unknown;
export declare function ensureGroupRecursively(project: XcodeProject, filepath: string): PBXGroup | null;
/**
* Get the pbxproj for the given path
*/
export declare function getPbxproj(projectRoot: string): XcodeProject;
/**
* Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.
*
* @param project
*/
export declare function getProductName(project: XcodeProject): string;
export declare function getProjectSection(project: XcodeProject): Record<string, xcode.PBXProject> & Record<string, string>;
export declare function getNativeTargets(project: XcodeProject): NativeTargetSectionEntry[];
export declare function findFirstNativeTarget(project: XcodeProject): NativeTargetSectionEntry;
export declare function findNativeTargetByName(project: XcodeProject, targetName: string): NativeTargetSectionEntry;
export declare function getXCConfigurationListEntries(project: XcodeProject): ConfigurationListEntry[];
export declare function getBuildConfigurationForId(project: XcodeProject, configurationListId: string): ConfigurationSectionEntry[];
export declare function isBuildConfig([, sectionItem]: ConfigurationSectionEntry): boolean;
export declare function isNotTestHost([, sectionItem]: ConfigurationSectionEntry): boolean;
export declare function isNotComment([key]: ConfigurationSectionEntry | ProjectSectionEntry | ConfigurationListEntry | NativeTargetSectionEntry): boolean;

View File

@ -0,0 +1,263 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path = __importStar(require("path"));
const xcode_1 = __importDefault(require("xcode"));
const pbxFile_1 = __importDefault(require("xcode/lib/pbxFile"));
const errors_1 = require("../../utils/errors");
const warnings_1 = require("../../utils/warnings");
const Paths = __importStar(require("../Paths"));
function getProjectName(projectRoot) {
const sourceRoot = Paths.getSourceRoot(projectRoot);
return path.basename(sourceRoot);
}
exports.getProjectName = getProjectName;
// TODO: come up with a better solution for using app.json expo.name in various places
function sanitizedName(name) {
return name
.replace(/[\W_]+/g, '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '');
}
// TODO: it's silly and kind of fragile that we look at app config to determine
// the ios project paths. Overall this function needs to be revamped, just a
// placeholder for now! Make this more robust when we support applying config
// at any time (currently it's only applied on eject).
function getHackyProjectName(projectRoot, config) {
// Attempt to get the current ios folder name (apply).
try {
return getProjectName(projectRoot);
}
catch (_a) {
// If no iOS project exists then create a new one (eject).
const projectName = config.name;
errors_1.assert(projectName, 'Your project needs a name in app.json/app.config.js.');
return sanitizedName(projectName);
}
}
exports.getHackyProjectName = getHackyProjectName;
function createProjectFileForGroup({ filepath, group }) {
const file = new pbxFile_1.default(filepath);
const conflictingFile = group.children.find(child => child.comment === file.basename);
if (conflictingFile) {
// This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.
// Not much we can do here since it might be a conflicting file.
return null;
}
return file;
}
/**
* Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
function addResourceFileToGroup({ filepath, groupName,
// Should add to `PBXBuildFile Section`
isBuildFile, project, }) {
return addFileToGroupAndLink({
filepath,
groupName,
project,
addFileToProject({ project, file }) {
project.addToPbxFileReferenceSection(file);
if (isBuildFile) {
project.addToPbxBuildFileSection(file);
}
project.addToPbxResourcesBuildPhase(file);
},
});
}
exports.addResourceFileToGroup = addResourceFileToGroup;
/**
* Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
function addBuildSourceFileToGroup({ filepath, groupName, project, }) {
return addFileToGroupAndLink({
filepath,
groupName,
project,
addFileToProject({ project, file }) {
project.addToPbxFileReferenceSection(file);
project.addToPbxBuildFileSection(file);
project.addToPbxSourcesBuildPhase(file);
},
});
}
exports.addBuildSourceFileToGroup = addBuildSourceFileToGroup;
// TODO(brentvatne): I couldn't figure out how to do this with an existing
// higher level function exposed by the xcode library, but we should find out how to do
// that and replace this with it
function addFileToGroupAndLink({ filepath, groupName, project, addFileToProject, }) {
const group = pbxGroupByPathOrAssert(project, groupName);
const file = createProjectFileForGroup({ filepath, group });
if (!file) {
// This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.
// Not much we can do here since it might be a conflicting file.
warnings_1.addWarningIOS('ios-xcode-project', `Skipped adding duplicate file "${filepath}" to PBXGroup named "${groupName}"`);
return project;
}
file.uuid = project.generateUuid();
file.fileRef = project.generateUuid();
addFileToProject({ project, file });
group.children.push({
value: file.fileRef,
comment: file.basename,
});
return project;
}
exports.addFileToGroupAndLink = addFileToGroupAndLink;
function getApplicationNativeTarget({ project, projectName, }) {
const applicationNativeTarget = project.getTarget('com.apple.product-type.application');
errors_1.assert(applicationNativeTarget, `Couldn't locate application PBXNativeTarget in '.xcodeproj' file.`);
errors_1.assert(String(applicationNativeTarget.target.name) === projectName, `Application native target name mismatch. Expected ${projectName}, but found ${applicationNativeTarget.target.name}.`);
return applicationNativeTarget;
}
exports.getApplicationNativeTarget = getApplicationNativeTarget;
/**
* Add a framework to the default app native target.
*
* @param projectName Name of the PBX project.
* @param framework String ending in `.framework`, i.e. `StoreKit.framework`
*/
function addFramework({ project, projectName, framework, }) {
const target = getApplicationNativeTarget({ project, projectName });
return project.addFramework(framework, { target: target.uuid });
}
exports.addFramework = addFramework;
function splitPath(path) {
// TODO: Should we account for other platforms that may not use `/`
return path.split('/');
}
const findGroup = (group, name) => {
if (!group) {
return undefined;
}
return group.children.find(group => group.comment === name);
};
function findGroupInsideGroup(project, group, name) {
var _a;
const foundGroup = findGroup(group, name);
if (foundGroup) {
return (_a = project.getPBXGroupByKey(foundGroup.value)) !== null && _a !== void 0 ? _a : null;
}
return null;
}
function pbxGroupByPathOrAssert(project, path) {
const { firstProject } = project.getFirstProject();
let group = project.getPBXGroupByKey(firstProject.mainGroup);
const components = splitPath(path);
for (const name of components) {
const nextGroup = findGroupInsideGroup(project, group, name);
if (nextGroup) {
group = nextGroup;
}
else {
break;
}
}
if (!group) {
throw Error(`Xcode PBXGroup with name "${path}" could not be found in the Xcode project.`);
}
return group;
}
function ensureGroupRecursively(project, filepath) {
const components = splitPath(filepath);
const hasChild = (group, name) => group.children.find(({ comment }) => comment === name);
const { firstProject } = project.getFirstProject();
let topMostGroup = project.getPBXGroupByKey(firstProject.mainGroup);
for (const pathComponent of components) {
if (topMostGroup && !hasChild(topMostGroup, pathComponent)) {
topMostGroup.children.push({
comment: pathComponent,
value: project.pbxCreateGroup(pathComponent, '""'),
});
}
topMostGroup = project.pbxGroupByName(pathComponent);
}
return topMostGroup !== null && topMostGroup !== void 0 ? topMostGroup : null;
}
exports.ensureGroupRecursively = ensureGroupRecursively;
/**
* Get the pbxproj for the given path
*/
function getPbxproj(projectRoot) {
const projectPath = Paths.getPBXProjectPath(projectRoot);
const project = xcode_1.default.project(projectPath);
project.parseSync();
return project;
}
exports.getPbxproj = getPbxproj;
/**
* Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.
*
* @param project
*/
function getProductName(project) {
var _a, _b;
let productName = project.productName;
if (productName === '$(TARGET_NAME)') {
const targetName = (_b = (_a = project.getFirstTarget()) === null || _a === void 0 ? void 0 : _a.firstTarget) === null || _b === void 0 ? void 0 : _b.productName;
productName = targetName !== null && targetName !== void 0 ? targetName : project.productName;
}
return productName;
}
exports.getProductName = getProductName;
function getProjectSection(project) {
return project.pbxProjectSection();
}
exports.getProjectSection = getProjectSection;
function getNativeTargets(project) {
const section = project.pbxNativeTargetSection();
return Object.entries(section).filter(isNotComment);
}
exports.getNativeTargets = getNativeTargets;
function findFirstNativeTarget(project) {
const { targets } = Object.values(getProjectSection(project))[0];
const target = targets[0].value;
const nativeTargets = getNativeTargets(project);
return nativeTargets.find(([key]) => key === target);
}
exports.findFirstNativeTarget = findFirstNativeTarget;
function findNativeTargetByName(project, targetName) {
const nativeTargets = getNativeTargets(project);
return nativeTargets.find(([, i]) => i.name === targetName || i.name === `"${targetName}"`);
}
exports.findNativeTargetByName = findNativeTargetByName;
function getXCConfigurationListEntries(project) {
const lists = project.pbxXCConfigurationList();
return Object.entries(lists).filter(isNotComment);
}
exports.getXCConfigurationListEntries = getXCConfigurationListEntries;
function getBuildConfigurationForId(project, configurationListId) {
const configurationListEntries = getXCConfigurationListEntries(project);
const [, configurationList] = configurationListEntries.find(([key]) => key === configurationListId);
const buildConfigurations = configurationList.buildConfigurations.map(i => i.value);
return Object.entries(project.pbxXCBuildConfigurationSection())
.filter(isNotComment)
.filter(isBuildConfig)
.filter(isNotTestHost)
.filter(([key]) => buildConfigurations.includes(key));
}
exports.getBuildConfigurationForId = getBuildConfigurationForId;
function isBuildConfig([, sectionItem]) {
return sectionItem.isa === 'XCBuildConfiguration';
}
exports.isBuildConfig = isBuildConfig;
function isNotTestHost([, sectionItem]) {
return !sectionItem.buildSettings.TEST_HOST;
}
exports.isNotTestHost = isNotTestHost;
function isNotComment([key]) {
return !key.endsWith(`_comment`);
}
exports.isNotComment = isNotComment;
//# sourceMappingURL=Xcodeproj.js.map

File diff suppressed because one or more lines are too long