Skip to content

Commit

Permalink
fix: udid reference in setAccess (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Dec 19, 2022
1 parent e18a4d0 commit 73d12a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/extensions/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@ async function execWix (args) {
/**
* Sets permissions for the given application
*
* @param {string} udid - udid of the target simulator device.
* @param {string} bundleId - bundle identifier of the target application.
* @param {Object} permissionsMapping - An object, where keys ar service names
* and values are corresponding state values. See https://github.com/wix/AppleSimulatorUtils
* for more details on available service names and statuses.
* @throws {Error} If there was an error while changing permissions.
*/
async function setAccess (bundleId, permissionsMapping) {
async function setAccess (udid, bundleId, permissionsMapping) {
const permissionsArg = _.toPairs(permissionsMapping)
.map((x) => `${x[0]}=${formatStatus(x[1])}`)
.join(',');
return await execWix([
'--byId', this.udid,
'--byId', udid,
'--bundle', bundleId,
'--setPermissions', permissionsArg,
]);
Expand Down Expand Up @@ -148,7 +149,7 @@ extensions.setPermission = async function setPermission (bundleId, permission, v
*/
extensions.setPermissions = async function setPermissions (bundleId, permissionsMapping) {
log.debug(`Setting access for '${bundleId}': ${JSON.stringify(permissionsMapping, null, 2)}`);
await setAccess(bundleId, permissionsMapping);
await setAccess(this.udid, bundleId, permissionsMapping);
};

/**
Expand Down

0 comments on commit 73d12a4

Please sign in to comment.