Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function prepareIosOpts (opts) {
opts.backendRetries = 4;
opts.withoutDelay = !opts.nativeInstrumentsLib;
opts.reset = !opts.noReset;
opts.initialOrientation = opts.deviceOrientation ||
opts.orientation ||
'PORTRAIT';
opts.useRobot = opts.robotPort > 0;
opts.robotUrl = opts.useRobot ?
`http://${opts.robotAddress}:${opts.robotPort}` : null;
if (opts.locationServicesAuthorized && !opts.bundleId) {
throw new Error('You must set the bundleId cap if using locationServicesEnabled');
}
opts.platformVersion = opts.platformVersion || await xcode.getMaxIOSSDK();
let pv = parseFloat(opts.platformVersion);
if (pv < 8) {
logger.warn(`iOS version ${opts.platformVersion} support has been ` +
`deprecated and will be removed in a future version of ` +
`Appium.`);
}
opts.localizableStringsDir = opts.localizableStringsDir || 'en.lproj';
opts.autoAcceptAlerts = _.isNull(opts.autoAcceptAlerts) || _.isUndefined(opts.autoAcceptAlerts) ? false : opts.autoAcceptAlerts;
opts.autoDismissAlerts = _.isNull(opts.autoDismissAlerts) || _.isUndefined(opts.autoDismissAlerts) ? false : opts.autoDismissAlerts;
if ((opts.browserName || '').toLowerCase() === 'safari' ||
(opts.app || '').toLowerCase() === 'safari' ||
(opts.bundleId || '').toLowerCase() === SAFARI_BUNDLE) {
// preparing a safari session
if (opts.udid) {
// on a real device
async function getAndCheckIosSdkVersion () {
try {
return await xcode.getMaxIOSSDK();
} catch (err) {
log.errorAndThrow(`Could not determine iOS SDK version: ${err.message}`);
}
}
async function buildAll () {
logger.info('Building SafariLauncher');
let sdkVer = await xcode.getMaxIOSSDK();
for (let sdk of sdks) {
let fullSdk = sdk + sdkVer;
await buildApp(SAFARI_LAUNCHER_REPO, fullSdk);
}
logger.info('Finished building SafariLauncher');
}
async function cleanAll () {
logger.info('Cleaning SafariLauncher');
let sdkVer = await xcode.getMaxIOSSDK();
for (let sdk of sdks) {
let fullSdk = sdk + sdkVer;
await cleanApp(SAFARI_LAUNCHER_REPO, fullSdk);
}
await fs.rimraf(SAFARI_LAUNCHER_DIR);
logger.info('Finished cleaning SafariLauncher');
}
async function getAndCheckIosSdkVersion () {
let versionNumber;
try {
versionNumber = await xcode.getMaxIOSSDK();
} catch (err) {
logger.error('Could not determine iOS SDK version');
throw err;
}
return versionNumber;
}