3030#import " XCUIElement+FBIsVisible.h"
3131#import " XCUIElementQuery.h"
3232#import " FBUnattachedAppLauncher.h"
33+ #import " sys/utsname.h"
3334
3435@implementation FBCustomCommands
3536
@@ -56,7 +57,21 @@ + (NSArray *)routes
5657 [[FBRoute GET: @" /wda/batteryInfo" ] respondWithTarget: self action: @selector (handleGetBatteryInfo: )],
5758#endif
5859 [[FBRoute POST: @" /wda/pressButton" ] respondWithTarget: self action: @selector (handlePressButtonCommand: )],
60+
61+ // modified start tag
62+ [[FBRoute POST: @" /wda/pressButton" ].withoutSession respondWithTarget: self action: @selector (handlePressButtonCommand: )],
63+ // end tag
64+
5965 [[FBRoute POST: @" /wda/performIoHidEvent" ] respondWithTarget: self action: @selector (handlePeformIOHIDEvent: )],
66+
67+ // modified start tag
68+ [[FBRoute POST: @" /wda/performIoHidEvent" ].withoutSession respondWithTarget: self action: @selector (handlePeformIOHIDEvent: )],
69+ [[FBRoute POST: @" /wda/tap" ] respondWithTarget: self action: @selector (handleDeviceTap: )],
70+ [[FBRoute POST: @" /wda/tap" ].withoutSession respondWithTarget: self action: @selector (handleDeviceTap: )],
71+ [[FBRoute POST: @" /wda/swipe" ] respondWithTarget: self action: @selector (handleDeviceSwipe: )],
72+ [[FBRoute POST: @" /wda/swipe" ].withoutSession respondWithTarget: self action: @selector (handleDeviceSwipe: )],
73+ // end tag
74+
6075 [[FBRoute POST: @" /wda/expectNotification" ] respondWithTarget: self action: @selector (handleExpectNotification: )],
6176 [[FBRoute POST: @" /wda/siri/activate" ] respondWithTarget: self action: @selector (handleActivateSiri: )],
6277 [[FBRoute POST: @" /wda/apps/launchUnattached" ].withoutSession respondWithTarget: self action: @selector (handleLaunchUnattachedApp: )],
@@ -285,6 +300,34 @@ + (NSDictionary *)processArguments:(XCUIApplication *)app
285300 return FBResponseWithOK ();
286301}
287302
303+ // modified start tag
304+ + (id <FBResponsePayload>)handleDeviceTap : (FBRouteRequest *)request
305+ {
306+ CGFloat x = [request.arguments[@" x" ] doubleValue ];
307+ CGFloat y = [request.arguments[@" y" ] doubleValue ];
308+ CGFloat duration = [request.arguments[@" duration" ] doubleValue ];
309+ [XCUIDevice.sharedDevice
310+ fb_synthTapWithX: x
311+ y: y duration: duration];
312+
313+ return FBResponseWithOK ();
314+ }
315+
316+ + (id <FBResponsePayload>)handleDeviceSwipe : (FBRouteRequest *)request
317+ {
318+ CGFloat fromX = [request.arguments[@" fromX" ] doubleValue ];
319+ CGFloat fromY = [request.arguments[@" fromY" ] doubleValue ];
320+ CGFloat toX = [request.arguments[@" toX" ] doubleValue ];
321+ CGFloat toY = [request.arguments[@" toY" ] doubleValue ];
322+ CGFloat delay = [request.arguments[@" delay" ] doubleValue ];
323+ [XCUIDevice.sharedDevice
324+ fb_synthSwipe: fromX
325+ fromY: fromY toX: toX toY: toY delay: delay];
326+
327+ return FBResponseWithOK ();
328+ }
329+ // modified end tag
330+
288331+ (id <FBResponsePayload>)handleLaunchUnattachedApp : (FBRouteRequest *)request
289332{
290333 NSString *bundle = (NSString *)request.arguments [@" bundleId" ];
0 commit comments