Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
additionalKeychainGroups.push(this.config.customKeychainGroup);
}
const infoPlist = path.join(this.config.appdir, 'Info.plist');
const plistData = plist.readFileSync(infoPlist);
if (this.config.bundleIdKeychainGroup) {
if (typeof this.config.bundleid === 'string') {
additionalKeychainGroups.push(this.config.bundleid);
} else {
const bundleid = plistData['CFBundleIdentifier'];
additionalKeychainGroups.push(bundleid);
}
}
if (this.config.osversion !== undefined) {
// DTPlatformVersion
plistData['MinimumOSVersion'] = this.config.osversion;
plist.writeFileSync(infoPlist, plistData);
}
if (additionalKeychainGroups.length > 0) {
const newGroups = additionalKeychainGroups.map(group => `${teamId}.${group}`);
const groups = entMacho['keychain-access-groups'];
if (typeof groups === 'undefined') {
entMacho['keychain-access-groups'] = newGroups;
} else {
groups.push(...newGroups);
}
changed = true;
}
if (changed || this.config.entry) {
const newEntitlementsFile = file + '.entitlements';
let newEntitlements = (appId && teamId && this.config.entry)
? defaultEntitlements(appId, teamId)
: (this.config.entitlement)
if (this.config.bundleIdKeychainGroup) {
if (typeof this.config.bundleid === 'string') {
additionalKeychainGroups.push(this.config.bundleid);
} else {
const infoPlist = path.join(this.config.appdir, 'Info.plist');
const plistData = plist.readFileSync(infoPlist);
const bundleid = plistData['CFBundleIdentifier'];
additionalKeychainGroups.push(bundleid);
}
}
if (this.config.osversion !== undefined) {
const infoPlist = path.join(this.config.appdir, 'Info.plist');
const plistData = plist.readFileSync(infoPlist);
plistData['MinimumOSVersion'] = this.config.osversion;
// DTPlatformVersion
plist.writeFileSync(infoPlist, plistData);
}
if (additionalKeychainGroups.length > 0) {
const newGroups = additionalKeychainGroups.map(group => `${teamId}.${group}`);
const groups = entMacho['keychain-access-groups'];
if (typeof groups === 'undefined') {
entMacho['keychain-access-groups'] = newGroups;
} else {
groups.push(...newGroups);
}
changed = true;
}
if (changed || this.config.entry) {
const newEntitlementsFile = file + '.entitlements';
let newEntitlements = (appId && teamId && this.config.entry)
? defaultEntitlements(appId, teamId)
: (this.config.entitlement)
private writeInfoPlist(infoPlistValues: I18nEntries) {
const resourceFilePath = path.join(this.appResourcesDirectoryPath, "Info.plist");
if (!fs.existsSync(resourceFilePath)) {
this.logger.warn(`'${resourceFilePath}' doesn't exists: unable to set default language`);
return this;
}
const data = plist.readFileSync(resourceFilePath);
let resourceChanged = false;
infoPlistValues.forEach((value, key) => {
if (!data.hasOwnProperty(key) || data[key] !== value) {
data[key] = value;
resourceChanged = true;
}
});
if (resourceChanged) {
plist.writeFileSync(resourceFilePath, data);
}
}
}
data['NSAppTransportSecurity'] = {};
}
data['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true;
changed = true;
}
if (forceFamily) {
if (performForceFamily(data, emit)) {
changed = true;
}
}
if (bundleid) {
setBundleId(data, bundleid);
changed = true;
}
if (changed) {
plist.writeFileSync(file, data);
}
}
data['NSAppTransportSecurity'] = {};
}
data['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true;
changed = true;
}
if (this.config.forceFamily) {
if (this.performForceFamily(data)) {
changed = true;
}
}
if (bundleid) {
this.setBundleId(file, data, bundleid);
changed = true;
}
if (changed) {
plist.writeFileSync(file, data);
}
next();
}
var options = { shellPath: '/bin/sh', shellScript: podsPath + '/Fabric/run ' + apiKey + ' ' + apiSecret };
var buildPhase = xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Configure Fabric', xcodeProject.getFirstTarget().uuid, options).buildPhase;
$logger.trace('Written Xcode project');
fs.writeFileSync(projectPath, xcodeProject.writeSync());
var appPlist = plist.readFileSync(plistPath);
plist.Fabric = {
APIKey: apiKey,
Kits: [{
KitInfo: '',
KiteName: 'Crashlytics'
}, {
KitInfo: '',
KiteName: 'Answers'
}]
}
plist.writeFileSync(plistPath, appPlist);
$logger.trace('Written Info plist');
resolve();
} else if (platform == 'windows') {
//TODO PRs gladly accepted :P
reject();
}
} catch (e) {
$logger.error('Unknown error during prepare fabric', e);
reject();
}
} else if (!hasFabricJSONFile) {
$logger.error('Please create a fabric.json file in the root!');
reject();
} else {
$logger.trace("Native project not prepared.");
resolve();