pressHardwareButton method

  1. @override
Future<void> pressHardwareButton(
  1. HardwareButton button
)
override

Implementation

@override
Future<void> pressHardwareButton(HardwareButton button) async {
  switch (button) {
    case HardwareButton.home || HardwareButton.lock || HardwareButton.volumeUp || HardwareButton.volumeDown:
      await _call({'cmd': 'button', 'name': button.name});
    case HardwareButton.back:
      await _edgeDrag(0, 0.5, 0.62, 0.5);
    case HardwareButton.appSwitcher:
      await _call({'cmd': 'button', 'name': 'home'});
      await _call({'cmd': 'button', 'name': 'home'});
    case HardwareButton.unlock:
      final status = await phoneStatus(udid);
      if (status?['passcodeRequired'] == true) {
        throw BackendFailure(
            GlintErrorKind.notOnThisDevice, 'the iPhone has a passcode, which only its owner can enter',
            nextSteps: const ['ask the user to unlock the phone, then retry'], data: const {'ability': 'unlock'});
      }
      await _call({'cmd': 'button', 'name': 'lock'});
      await Future<void>.delayed(const Duration(milliseconds: 700));
      await _edgeDrag(0.5, 0.92, 0.5, 0.3, ms: 300);
  }
}