Skip to content

Commit a1f802e

Browse files
chore: Deprecate touch actions (#1569)
1 parent ac1729f commit a1f802e

File tree

7 files changed

+52
-3
lines changed

7 files changed

+52
-3
lines changed

src/main/java/io/appium/java_client/PerformsTouchActions.java

+16-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
import java.util.List;
2323
import java.util.Map;
2424

25+
/**
26+
* Touch actions are deprecated.
27+
* Please use W3C Actions instead or the corresponding
28+
* extension methods for the driver (if available).
29+
* Check
30+
* - https://www.youtube.com/watch?v=oAJ7jwMNFVU
31+
* - https://appiumpro.com/editions/30-ios-specific-touch-action-methods
32+
* - https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
33+
* for more details.
34+
*/
35+
@Deprecated
36+
@SuppressWarnings({"unchecked", "rawtypes"})
2537
public interface PerformsTouchActions extends ExecutesMethod {
2638
/**
2739
* Performs a chain of touch actions, which together can be considered an
@@ -36,6 +48,7 @@ public interface PerformsTouchActions extends ExecutesMethod {
3648
* touch actions to perform
3749
* @return the same touch action object
3850
*/
51+
@Deprecated
3952
default TouchAction performTouchAction(TouchAction touchAction) {
4053
Map<String, List<Object>> parameters = touchAction.getParameters();
4154
execute(PERFORM_TOUCH_ACTION, parameters);
@@ -53,9 +66,10 @@ default TouchAction performTouchAction(TouchAction touchAction) {
5366
*
5467
* @param multiAction the MultiTouchAction object to perform.
5568
*/
56-
default void performMultiTouchAction(MultiTouchAction multiAction) {
69+
@Deprecated
70+
default MultiTouchAction performMultiTouchAction(MultiTouchAction multiAction) {
5771
Map<String, List<Object>> parameters = multiAction.getParameters();
5872
execute(PERFORM_MULTI_TOUCH, parameters);
59-
multiAction.clearActions();
73+
return multiAction.clearActions();
6074
}
6175
}

src/main/java/io/appium/java_client/TouchAction.java

+10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,17 @@
4242
* action.press(element).waitAction(300).moveTo(element1).release().perform();
4343
* Calling perform() sends the action command to the Mobile Driver. Otherwise,
4444
* more and more actions can be chained.
45+
*
46+
* Touch actions are deprecated.
47+
* Please use W3C Actions instead or the corresponding
48+
* extension methods for the driver (if available).
49+
* Check
50+
* - https://www.youtube.com/watch?v=oAJ7jwMNFVU
51+
* - https://appiumpro.com/editions/30-ios-specific-touch-action-methods
52+
* - https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
53+
* for more details.
4554
*/
55+
@Deprecated
4656
public class TouchAction<T extends TouchAction<T>> implements PerformsActions<T> {
4757

4858
protected ImmutableList.Builder<ActionParameter> parameterBuilder;

src/main/java/io/appium/java_client/android/AndroidTouchAction.java

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
import io.appium.java_client.TouchAction;
2121

2222

23+
/**
24+
* Touch actions are deprecated.
25+
* Please use W3C Actions instead or the corresponding
26+
* extension methods for the driver (if available).
27+
* Check
28+
* - https://www.youtube.com/watch?v=oAJ7jwMNFVU
29+
* - https://appiumpro.com/editions/30-ios-specific-touch-action-methods
30+
* - https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
31+
* for more details.
32+
*/
33+
@Deprecated
2334
public class AndroidTouchAction extends TouchAction<AndroidTouchAction> {
2435

2536
public AndroidTouchAction(PerformsTouchActions performsTouchActions) {

src/main/java/io/appium/java_client/ios/IOSDriver.java

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454

5555
/**
5656
* iOS driver implementation.
57-
*
5857
*/
5958
public class IOSDriver extends AppiumDriver implements
6059
SupportsContextSwitching,

src/main/java/io/appium/java_client/ios/IOSTouchAction.java

+11
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222
import io.appium.java_client.touch.offset.ElementOption;
2323
import io.appium.java_client.touch.offset.PointOption;
2424

25+
/**
26+
* Touch actions are deprecated.
27+
* Please use W3C Actions instead or the corresponding
28+
* extension methods for the driver (if available).
29+
* Check
30+
* - https://www.youtube.com/watch?v=oAJ7jwMNFVU
31+
* - https://appiumpro.com/editions/30-ios-specific-touch-action-methods
32+
* - https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
33+
* for more details.
34+
*/
35+
@Deprecated
2536
public class IOSTouchAction extends TouchAction<IOSTouchAction> {
2637

2738
public IOSTouchAction(PerformsTouchActions performsTouchActions) {

src/main/java/io/appium/java_client/mac/Mac2Driver.java

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package io.appium.java_client.mac;
1818

1919
import io.appium.java_client.AppiumDriver;
20+
import io.appium.java_client.PerformsTouchActions;
2021
import io.appium.java_client.remote.AutomationName;
2122
import io.appium.java_client.screenrecording.CanRecordScreen;
2223
import io.appium.java_client.service.local.AppiumDriverLocalService;
@@ -38,6 +39,7 @@
3839
* @since Appium 1.20.0
3940
*/
4041
public class Mac2Driver extends AppiumDriver implements
42+
PerformsTouchActions,
4143
CanRecordScreen {
4244
private static final String PLATFORM_NAME = Platform.MAC.name();
4345
private static final String AUTOMATION_NAME = AutomationName.MAC2;

src/main/java/io/appium/java_client/windows/WindowsDriver.java

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import io.appium.java_client.AppiumDriver;
2020
import io.appium.java_client.HidesKeyboardWithKeyName;
21+
import io.appium.java_client.PerformsTouchActions;
2122
import io.appium.java_client.remote.AutomationName;
2223
import io.appium.java_client.screenrecording.CanRecordScreen;
2324
import io.appium.java_client.service.local.AppiumDriverLocalService;
@@ -30,6 +31,7 @@
3031
import java.net.URL;
3132

3233
public class WindowsDriver extends AppiumDriver implements
34+
PerformsTouchActions,
3335
PressesKeyCode,
3436
HidesKeyboardWithKeyName,
3537
CanRecordScreen {

0 commit comments

Comments
 (0)