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

Add wrappers for Android logcat broadcaster #858

Merged
merged 9 commits into from
Apr 13, 2018

Conversation

mykola-mokhnach
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach commented Apr 2, 2018

Change list

Added basic classes to support web sockets interaction in general and to interact with logcat messages broadcaster that has been implemented for Android server.

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 Author

@KazuCocoa FYI

/**
* @return The list of web socket message handlers.
*/
List<T> messageHandlers();
Copy link

Choose a reason for hiding this comment

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

messageHandlers() -> getMessageHandlers()

/**
* This is the basic interface for all web socket message handlers.
*/
public interface MessagesHandler {
Copy link

Choose a reason for hiding this comment

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

It's strange that messages handler can not handle messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, I'll make it generic

* @param reason connection close reason
*/
@OnClose
public void onClose(Session session, CloseReason reason) {
Copy link

Choose a reason for hiding this comment

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

session parameter is never used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is used in connect

Copy link

Choose a reason for hiding this comment

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

@OnClose
public void onClose(CloseReason reason) {

@mykola-mokhnach
Copy link
Contributor Author

I was also thinking about having separate callbacks for each event instead of interface implementation, which is more Java 8'ish. for example:

Instead of

          driver.addLogcatListener(new MessagesHandler<String>() {
                @Override
                public void onMessage(String message) {
                    messageSemaphore.release();
                }

                @Override
                public void onConnected() {
                    connectedSemaphore.release();
                }

                @Override
                public void onDisconnected() {
                    // ignore
                }

                @Override
                public void onError(Throwable cause) {
                    // ignore
                }
            });

it might look like

driver.addLogcatMessageListener(this::onMessage);
driver.addLogcatErrorListener(this::onError);

@mykola-mokhnach
Copy link
Contributor Author

Make sure the hotfix appium/appium#10496 is merged to appium server before testing this PR locally

@SrinivasanTarget
Copy link
Member

@mykola-mokhnach Unfortunately there is a conflict. Can you please resolve this? I will get this in.

… into ws

# Conflicts:
#	src/main/java/io/appium/java_client/android/AndroidDriver.java
@mykola-mokhnach
Copy link
Contributor Author

@SrinivasanTarget The conflict is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants