Skip to content

Commit

Permalink
feat: add DidShowContinuousPathIntroduction 1 for iOS 15 (#315)
Browse files Browse the repository at this point in the history
* feat: add DidShowContinuousPathIntroduction 1 for iOS 15

* extract as a method

* append comment

* rename, define DOMAIN_KEYBOARD_PREFERENCE

* move the call after boot
  • Loading branch information
KazuCocoa committed Dec 1, 2021
1 parent 8410dd8 commit 0244908
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/simulator-xcode-9.js
Expand Up @@ -14,6 +14,7 @@ const SIMULATOR_SHUTDOWN_TIMEOUT = 15 * 1000;
const startupLock = new AsyncLock();
const preferencesPlistGuard = new AsyncLock();
const ENROLLMENT_NOTIFICATION_RECEIVER = 'com.apple.BiometricKit.enrollmentChanged';
const DOMAIN_KEYBOARD_PREFERENCES = 'com.apple.keyboard.preferences';

class SimulatorXcode9 extends SimulatorXcode8 {
constructor (udid, xcodeVersion) {
Expand Down Expand Up @@ -162,6 +163,22 @@ class SimulatorXcode9 extends SimulatorXcode8 {
await this.waitForBoot(opts.startupTimeout);
log.info(`Simulator with UDID ${this.udid} booted in ${timer.getDuration().asSeconds.toFixed(3)}s`);
}

await this.disableKeyboardIntroduction();
}

/**
* Disable keyboard tutorial as 'com.apple.keyboard.preferences' domain via 'defaults' command.
*/
async disableKeyboardIntroduction () {
const argChunks = generateDefaultsCommandArgs({
// To disable 'DidShowContinuousPathIntroduction' for iOS 15+ simulators since changing the preference via WDA
// does not work on them. Lower than the versions also can have this preference, but nothing happen.
DidShowContinuousPathIntroduction: 1
}, true);
await B.all(argChunks.map((args) => this.simctl.spawnProcess([
'defaults', 'write', DOMAIN_KEYBOARD_PREFERENCES, ...args
])));
}

/***
Expand Down

0 comments on commit 0244908

Please sign in to comment.