Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CompanionLib/Utility/FBiOSTargetProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ @implementation FBiOSTargetProvider
}
id<FBSimulatorLifecycleCommands> lifecycle = (id<FBSimulatorLifecycleCommands>) target;
if (![lifecycle conformsToProtocol:@protocol(FBSimulatorLifecycleCommands)]) {
return [FBFuture futureWithResult:target];;
return [FBFuture futureWithResult:target];
}

if (FBXcodeConfiguration.isXcode12_5OrGreater) {
Expand Down
1 change: 0 additions & 1 deletion FBControlCore/Utility/FBArchiveOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ typedef NS_ENUM(NSUInteger, FBCompressionFormat) {
To confirm that the stream has been correctly written, the caller should check the exit code of the returned task upon completion.

@param path the path to archive.
@param queue the queue to do work on
@param logger the logger to log to.
@return a Future containing a task with an NSInputStream attached to stdout.
*/
Expand Down
4 changes: 2 additions & 2 deletions FBSimulatorControl.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
AA0CA38720643CCF00347424 /* FBCrashLogCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0CA38620643C6800347424 /* FBCrashLogCommands.h */; settings = {ATTRIBUTES = (Public, ); }; };
AA111CCE1BBE7C5A0054AFDD /* CoreSimulatorDoubles.m in Sources */ = {isa = PBXBuildFile; fileRef = AA111CCD1BBE7C5A0054AFDD /* CoreSimulatorDoubles.m */; };
AA1174B21CEA17DB00EB699E /* FBApplicationCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA1174B11CEA17DB00EB699E /* FBApplicationCommands.h */; settings = {ATTRIBUTES = (Public, ); }; };
AA1174B61CEA183F00EB699E /* FBSimulatorApplicationCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA1174B41CEA183F00EB699E /* FBSimulatorApplicationCommands.h */; };
AA1174B61CEA183F00EB699E /* FBSimulatorApplicationCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA1174B41CEA183F00EB699E /* FBSimulatorApplicationCommands.h */; settings = {ATTRIBUTES = (Public, ); }; };
AA1174B71CEA183F00EB699E /* FBSimulatorApplicationCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = AA1174B51CEA183F00EB699E /* FBSimulatorApplicationCommands.m */; };
AA11EDF9272C44410055D6D1 /* FBFileContainerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11EDF8272C44410055D6D1 /* FBFileContainerTests.m */; };
AA12D5441CE1086300CCD944 /* FBTestReporterAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = AA12D5421CE1086300CCD944 /* FBTestReporterAdapter.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -128,7 +128,7 @@
AA3C18441D5DE47D00419EAA /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA3C18431D5DE47D00419EAA /* CoreImage.framework */; };
AA3E44401F14AE2C00F333D2 /* FBDeviceApplicationCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA3E443E1F14AE2C00F333D2 /* FBDeviceApplicationCommands.h */; };
AA3E44411F14AE2C00F333D2 /* FBDeviceApplicationCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = AA3E443F1F14AE2C00F333D2 /* FBDeviceApplicationCommands.m */; };
AA3EA8531F31B20D003FBDC1 /* FBSimulatorFileCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA3EA8511F31B20D003FBDC1 /* FBSimulatorFileCommands.h */; };
AA3EA8531F31B20D003FBDC1 /* FBSimulatorFileCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = AA3EA8511F31B20D003FBDC1 /* FBSimulatorFileCommands.h */; settings = {ATTRIBUTES = (Public, ); }; };
AA3EA8541F31B20D003FBDC1 /* FBSimulatorFileCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = AA3EA8521F31B20D003FBDC1 /* FBSimulatorFileCommands.m */; };
AA3EA8561F31B494003FBDC1 /* FBSimulatorApplicationDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA3EA8551F31B494003FBDC1 /* FBSimulatorApplicationDataTests.m */; };
AA3FD04D1C876E4F001093CA /* FBSimulatorLaunchTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA3FD03D1C876E4F001093CA /* FBSimulatorLaunchTests.m */; };
Expand Down
1 change: 1 addition & 0 deletions FBSimulatorControl/FBSimulatorControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import <FBSimulatorControl/FBSimulator+Private.h>
#import <FBSimulatorControl/FBSimulator.h>
#import <FBSimulatorControl/FBSimulatorAccessibilityCommands.h>
#import <FBSimulatorControl/FBSimulatorApplicationCommands.h>
#import <FBSimulatorControl/FBSimulatorBootConfiguration.h>
#import <FBSimulatorControl/FBSimulatorConfiguration+CoreSimulator.h>
#import <FBSimulatorControl/FBSimulatorConfiguration.h>
Expand Down
68 changes: 68 additions & 0 deletions idb/cli/commands/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,71 @@ async def run_with_client(self, args: Namespace, client: Client) -> None:
duration=args.duration,
delta=args.delta,
)


class ArrowUpCommand(ClientCommand):
@property
def description(self) -> str:
return "Press arrow up key for navigation"

@property
def name(self) -> str:
return "arrow-up"

def add_parser_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument("--duration", help="Press duration", type=float)
super().add_parser_arguments(parser)

async def run_with_client(self, args: Namespace, client: Client) -> None:
await client.key(keycode=82, duration=args.duration)


class ArrowDownCommand(ClientCommand):
@property
def description(self) -> str:
return "Press arrow down key for navigation"

@property
def name(self) -> str:
return "arrow-down"

def add_parser_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument("--duration", help="Press duration", type=float)
super().add_parser_arguments(parser)

async def run_with_client(self, args: Namespace, client: Client) -> None:
await client.key(keycode=81, duration=args.duration)


class ArrowLeftCommand(ClientCommand):
@property
def description(self) -> str:
return "Press arrow left key for navigation"

@property
def name(self) -> str:
return "arrow-left"

def add_parser_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument("--duration", help="Press duration", type=float)
super().add_parser_arguments(parser)

async def run_with_client(self, args: Namespace, client: Client) -> None:
await client.key(keycode=80, duration=args.duration)


class ArrowRightCommand(ClientCommand):
@property
def description(self) -> str:
return "Press arrow right key for navigation"

@property
def name(self) -> str:
return "arrow-right"

def add_parser_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument("--duration", help="Press duration", type=float)
super().add_parser_arguments(parser)

async def run_with_client(self, args: Namespace, client: Client) -> None:
await client.key(keycode=79, duration=args.duration)
8 changes: 8 additions & 0 deletions idb/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
from idb.cli.commands.focus import FocusCommand
from idb.cli.commands.framework import FrameworkInstallCommand
from idb.cli.commands.hid import (
ArrowDownCommand,
ArrowLeftCommand,
ArrowRightCommand,
ArrowUpCommand,
ButtonCommand,
KeyCommand,
KeySequenceCommand,
Expand Down Expand Up @@ -256,6 +260,10 @@ async def gen_main(cmd_input: list[str] | None = None) -> SysExitArg:
KeyCommand(),
KeySequenceCommand(),
SwipeCommand(),
ArrowUpCommand(),
ArrowDownCommand(),
ArrowLeftCommand(),
ArrowRightCommand(),
],
),
CommandGroup(
Expand Down
16 changes: 16 additions & 0 deletions idb/common/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@ def text_to_events(text: str) -> list[HIDEvent]:
return events


def arrow_up_to_events(duration: float | None = None) -> list[HIDEvent]:
return key_press_to_events(keycode=82, duration=duration)


def arrow_down_to_events(duration: float | None = None) -> list[HIDEvent]:
return key_press_to_events(keycode=81, duration=duration)


def arrow_left_to_events(duration: float | None = None) -> list[HIDEvent]:
return key_press_to_events(keycode=80, duration=duration)


def arrow_right_to_events(duration: float | None = None) -> list[HIDEvent]:
return key_press_to_events(keycode=79, duration=duration)


async def iterator_to_async_iterator(
events: Iterable[HIDEvent],
) -> AsyncIterator[HIDEvent]:
Expand Down
16 changes: 16 additions & 0 deletions idb/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,22 @@ async def debugserver_status(self) -> list[str] | None:
async def text(self, text: str) -> None:
return

@abstractmethod
async def arrow_up(self, duration: float | None = None) -> None:
return

@abstractmethod
async def arrow_down(self, duration: float | None = None) -> None:
return

@abstractmethod
async def arrow_left(self, duration: float | None = None) -> None:
return

@abstractmethod
async def arrow_right(self, duration: float | None = None) -> None:
return

@abstractmethod
async def hid(self, event_iterator: AsyncIterable[HIDEvent]) -> None:
pass
Expand Down
20 changes: 20 additions & 0 deletions idb/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
from idb.common.format import json_format_debugger_info
from idb.common.gzip import drain_gzip_decompress, gunzip
from idb.common.hid import (
arrow_down_to_events,
arrow_left_to_events,
arrow_right_to_events,
arrow_up_to_events,
button_press_to_events,
iterator_to_async_iterator,
key_press_to_events,
Expand Down Expand Up @@ -873,6 +877,22 @@ async def key(self, keycode: int, duration: float | None = None) -> None:
async def text(self, text: str) -> None:
await self.send_events(text_to_events(text))

@log_and_handle_exceptions("hid")
async def arrow_up(self, duration: float | None = None) -> None:
await self.send_events(arrow_up_to_events(duration))

@log_and_handle_exceptions("hid")
async def arrow_down(self, duration: float | None = None) -> None:
await self.send_events(arrow_down_to_events(duration))

@log_and_handle_exceptions("hid")
async def arrow_left(self, duration: float | None = None) -> None:
await self.send_events(arrow_left_to_events(duration))

@log_and_handle_exceptions("hid")
async def arrow_right(self, duration: float | None = None) -> None:
await self.send_events(arrow_right_to_events(duration))

@log_and_handle_exceptions("hid")
async def swipe(
self,
Expand Down