Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#102 FIX #772

Merged
merged 4 commits into from Nov 25, 2017
Merged

#102 FIX #772

merged 4 commits into from Nov 25, 2017

Conversation

TikhomirovSergey
Copy link
Contributor

Change list

  • MissingParameterException was removed
  • some code improvements in MultiTouchAction. Now it will throw IllegalArgumentException when no action is defined.

#102

Types of changes

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@mykola-mokhnach
Copy link
Contributor

  • 💯 for picking up issues that have been waiting for three years in the backlog 👍

performsTouchActions.performMultiTouchAction(this);
} else if (size == 1) {
} else {
//android doesn't like having multi-touch actions with only a single TouchAction...
performsTouchActions.performTouchAction(actions.build().get(0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps touchActions.get(0) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. Will improve soon

List<TouchAction> touchActions = actions.build();
checkArgument(touchActions.size() > 0,
"MultiTouch action must have at least one TouchAction added before it can be performed");
if (touchActions.size() > 1) {
performsTouchActions.performMultiTouchAction(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can returns this immediately here, so then else block is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mykola-mokhnach
I can't understand how to do it

performsTouchActions.performMultiTouchAction(this);

is void

performsTouchActions.performTouchAction(touchActions.get(0));

returns TouchAction

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        if (touchActions.size() > 1) {
            performsTouchActions.performMultiTouchAction(this);
            return this;
        }
        //android doesn't like having multi-touch actions with only a single TouchAction...
        performsTouchActions.performTouchAction(touchActions.get(0));
        return this;

touchActions.forEach(action -> {
listOfActionChains.add(action.getParameters().get("actions"));
});
touchActions.forEach(action ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not to replace it with something like ImmutableList.Builder<Object> listOfActionChains = ImmutableList.copyOf(touchActions.stream().map(x -> x.getParameters().get("actions"))); ?

@TikhomirovSergey
Copy link
Contributor Author

TikhomirovSergey commented Nov 24, 2017

@mykola-mokhnach There is one more change.
Yes. There is some legacy (from Java 7 times) code which still can be here. Sometimes it is difficult to see it because of force of habit :)
@SrinivasanTarget your rewiev is is also valuable.

@appium appium deleted a comment Nov 25, 2017
Copy link
Member

@SrinivasanTarget SrinivasanTarget left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TikhomirovSergey TikhomirovSergey merged commit 8798102 into appium:master Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants