Skip to content

Commit

Permalink
Retrieve VoiceOver version (via macOS version)
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike committed May 14, 2024
1 parent bbd1383 commit ea80e6a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions lib/modules/macos/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,38 @@

'use strict';

const child_process = require('child_process');

const { v4: uuid } = require('uuid');

/**
* @returns {Promise<string>}
*/
const getMacOSVersion = async () => {
return new Promise((resolve, reject) => {
child_process.exec('sw_vers -productVersion', (error, stdout, stderr) => {
if (error) {
reject(new Error(stderr));
return;
}
resolve(stdout.trim());
});
});
};

const newSession = /** @type {ATDriverModules.SessionNewSession} */ (
(websocket, params) => {
async (websocket, params) => {
// TODO: match requested capabilities
// const { capabilities } = params;
websocket.sessionId = uuid();

return {
sessionId: websocket.sessionId,
capabilities: {
atName: 'Voiceover',
atVersion: 'TODO',
// The ARIA-AT Community Group considers the MacOS version identifier
// to be an accurate identifier for the VoiceOver screen reader.
atVersion: await getMacOSVersion(),
platformName: 'macos',
},
};
Expand Down

0 comments on commit ea80e6a

Please sign in to comment.