Skip to content

Commit

Permalink
fix: handle location command as case insensitive (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored Dec 4, 2023
1 parent 0a9b22b commit fa060a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/extensions/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ async function setAccess (simctl, udid, bundleId, permissionsMapping) {
if (!PERMISSIONS_APPLIED_VIA_SIMCTL.includes(serviceName)) {
wixPermissions[serviceName] = permissionsMapping[serviceName];
} else {
switch (permissionsMapping[serviceName]) {
// xcrun simctl privacy expects to be lower case while AppleSimulatorUtils is upper case.
// To keep the compatibility, we should convert here to lower case explicitly.
switch (_.toLower(permissionsMapping[serviceName])) {
case STATUS.YES:
grantPermissions.push(serviceName);
break;
Expand Down
2 changes: 1 addition & 1 deletion test/functional/simulator-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('advanced features', function () {
it('should set and get with simctrl privacy command', async function () {
// no exceptions
await expect(sim.setPermission('com.apple.Maps', 'location', 'yes')).not.to.be.rejected;
await expect(sim.setPermission('com.apple.Maps', 'location', 'no')).not.to.be.rejected;
await expect(sim.setPermission('com.apple.Maps', 'location', 'NO')).not.to.be.rejected;
await expect(sim.setPermission('com.apple.Maps', 'location', 'unset')).not.to.be.rejected;
await expect(sim.setPermission('com.apple.Maps', 'location', 'unsupported')).to.be.rejected;
});
Expand Down

0 comments on commit fa060a4

Please sign in to comment.