Skip to content

Commit 25c8978

Browse files
Merge pull request #56 from appium/master
Fork Sync: Update from parent repository
2 parents 1ad9436 + 925f358 commit 25c8978

File tree

5 files changed

+165
-97
lines changed

5 files changed

+165
-97
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## [6.0.0](https://github.com/appium/WebDriverAgent/compare/v5.15.8...v6.0.0) (2024-01-31)
2+
3+
4+
### ⚠ BREAKING CHANGES
5+
6+
* The /wda/tap/:uuid endpoint has been replaced by /wda/element/:uuid/tap and /wda/tap ones
7+
8+
### Features
9+
10+
* Add coordinate-based APIs for gesture calls ([#843](https://github.com/appium/WebDriverAgent/issues/843)) ([feda373](https://github.com/appium/WebDriverAgent/commit/feda373b6147d3e87b29dceb871887c77febe76b))
11+
112
## [5.15.8](https://github.com/appium/WebDriverAgent/compare/v5.15.7...v5.15.8) (2024-01-24)
213

314

WebDriverAgentLib/Categories/XCUIElement+FBSwiping.h

+14
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,18 @@ NS_ASSUME_NONNULL_BEGIN
2222

2323
@end
2424

25+
#if !TARGET_OS_TV
26+
@interface XCUICoordinate (FBSwiping)
27+
28+
/**
29+
* Performs swipe gesture on the coordinate
30+
*
31+
* @param direction Swipe direction. The following values are supported: up, down, left and right
32+
* @param velocity Swipe speed in pixels per second
33+
*/
34+
- (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity;
35+
36+
@end
37+
#endif
38+
2539
NS_ASSUME_NONNULL_END

WebDriverAgentLib/Categories/XCUIElement+FBSwiping.m

+27-10
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,46 @@
1212
#import "FBLogger.h"
1313
#import "XCUIElement.h"
1414

15-
@implementation XCUIElement (FBSwiping)
16-
17-
- (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity
18-
{
15+
void swipeWithDirection(NSObject *target, NSString *direction, NSNumber* _Nullable velocity) {
1916
double velocityValue = .0;
2017
if (nil != velocity) {
2118
velocityValue = [velocity doubleValue];
2219
}
2320

2421
if (velocityValue > 0) {
25-
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"swipe%@WithVelocity:", direction.lowercaseString.capitalizedString]);
26-
NSMethodSignature *signature = [self methodSignatureForSelector:selector];
22+
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"swipe%@WithVelocity:",
23+
direction.lowercaseString.capitalizedString]);
24+
NSMethodSignature *signature = [target methodSignatureForSelector:selector];
2725
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
2826
[invocation setSelector:selector];
2927
[invocation setArgument:&velocityValue atIndex:2];
30-
[invocation invokeWithTarget:self];
28+
[invocation invokeWithTarget:target];
3129
} else {
32-
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"swipe%@", direction.lowercaseString.capitalizedString]);
33-
NSMethodSignature *signature = [self methodSignatureForSelector:selector];
30+
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"swipe%@",
31+
direction.lowercaseString.capitalizedString]);
32+
NSMethodSignature *signature = [target methodSignatureForSelector:selector];
3433
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
3534
[invocation setSelector:selector];
36-
[invocation invokeWithTarget:self];
35+
[invocation invokeWithTarget:target];
3736
}
3837
}
3938

39+
@implementation XCUIElement (FBSwiping)
40+
41+
- (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity
42+
{
43+
swipeWithDirection(self, direction, velocity);
44+
}
45+
46+
@end
47+
48+
#if !TARGET_OS_TV
49+
@implementation XCUICoordinate (FBSwiping)
50+
51+
- (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity
52+
{
53+
swipeWithDirection(self, direction, velocity);
54+
}
55+
4056
@end
57+
#endif

0 commit comments

Comments
 (0)