Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
imurchie committed Aug 12, 2018
1 parent a051110 commit 3626d22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 5 additions & 6 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { plist } from 'appium-support';
import path from 'path';
import log from './logger';
import semver from 'semver';
import B from 'bluebird';


// returns path to plist based on id for plist.
Expand Down Expand Up @@ -61,11 +62,9 @@ async function plistPaths (sim, identifier) {
}

async function updateSettings (sim, plist, updates) {
let updated = false;
for (let path of await plistPaths(sim, plist)) {
updated = await update(path, updates) || updated;
}
return updated;
return await B.reduce(await plistPaths(sim, plist), async function reducer (updated, path) {
return await update(path, updates) || updated;
}, false);
}

// update a plist file, located at pathToPlist
Expand Down Expand Up @@ -166,7 +165,7 @@ async function updateSafariUserSettings (sim, settingSet) {
newUserSettings.safariForceFraudWarning = !settingSet.WarnAboutFraudulentWebsites;
}

if (_.size(newUserSettings) === 0) {
if (_.isEmpty(newUserSettings)) {
return false;
}

Expand Down
3 changes: 1 addition & 2 deletions lib/simulator-xcode-6.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,7 @@ class SimulatorXcode6 extends EventEmitter {
*/
async updateSafariSettings (updates) {
let updated = await settings.updateSafariUserSettings(this, updates);
updated = await settings.updateSettings(this, 'mobileSafari', updates) || updated;
return updated;
return await settings.updateSettings(this, 'mobileSafari', updates) || updated;
}

/**
Expand Down

0 comments on commit 3626d22

Please sign in to comment.