Skip to content

Commit

Permalink
Support to toggle the hardware keyboard
Browse files Browse the repository at this point in the history
Summary:
`FBSimulatorBridge` is gone in Xcode 12.5. The Simulator app now uses
`[SimDevice setHardwareKeyboardEnabled:keyboardType:error:]`, and that's what the companion is using here too.

Reviewed By: lawrencelomax

Differential Revision: D29358177

fbshipit-source-id: 42a079b65ec8063e0970697cb22f978dfcf006ff
  • Loading branch information
fgasperij authored and facebook-github-bot committed Jun 28, 2021
1 parent f3a1143 commit f436b92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions FBSimulatorControl/Commands/FBSimulatorSettingsCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ - (instancetype)initWithSimulator:(FBSimulator *)simulator

- (FBFuture<NSNull *> *)setHardwareKeyboardEnabled:(BOOL)enabled
{
if ([self.simulator.device respondsToSelector:(@selector(setHardwareKeyboardEnabled:keyboardType:error:))]) {
return [FBFuture onQueue:self.simulator.workQueue resolve:^ FBFuture<NSNull *> * () {
NSError *error = nil;
[self.simulator.device setHardwareKeyboardEnabled:enabled keyboardType:0 error:&error];

return FBFuture.empty;
}];
}

return [[self.simulator
connectToBridge]
onQueue:self.simulator.workQueue fmap:^ FBFuture<NSNull *> * (FBSimulatorBridge *bridge) {
Expand Down
1 change: 1 addition & 0 deletions PrivateHeaders/CoreSimulator/SimDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
- (BOOL)setActiveIDSRelayDevice:(id)arg1 error:(id *)arg2;
- (BOOL)disconnectIDSRelayToDevice:(id)arg1 error:(id *)arg2;
- (BOOL)connectIDSRelayToDevice:(id)arg1 disconnectMonitorPort:(unsigned int *)arg2 error:(id *)arg3;
- (id)setHardwareKeyboardEnabled:(_Bool)arg2 keyboardType:(unsigned char)arg2 error:(NSError **)arg3;

// In Xcode 12, this replaces SimulatorBridge related accessibility requests .

Expand Down

0 comments on commit f436b92

Please sign in to comment.