Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RxJava conversion #387

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

Merged
merged 16 commits into from Aug 1, 2016
Merged

RxJava conversion #387

merged 16 commits into from Aug 1, 2016

Conversation

pvanassen
Copy link
Contributor

Hi all,

After the first Future based implementation for async and throttling, this is the same but based on Observables. I don't know if this fits into the already existing attempt to move to RxJava. Because it again is set up transparently it may be a good start.

This is PR for concideration. No hard feelings if it won't be merged.

@pvanassen
Copy link
Contributor Author

Unfortunately I cannot see the merge conflict.

@Grover-c13
Copy link
Owner

Probably the changes i made to the Map class

@pvanassen
Copy link
Contributor Author

Yup, merging them now

@@ -0,0 +1,28 @@
package com.pokegoapi.util;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add license header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, didn't run Checkstyle yet. First prio, solve merge issue. Will fix headers right after that. Likely more is wrong/missing

@pvanassen
Copy link
Contributor Author

@Grover-c13 If this branch does't get merged, I noticed you added a DummyFuture, but you can also use com.pokegoapi.util.FutureWrapper#just, doing exactly the same.

@Grover-c13
Copy link
Owner

oh ty will remember

@@ -457,7 +458,7 @@ protected CatchItemResult handle(ByteString result) throws RemoteServerException
* @throws RemoteServerException if the server failed to respond
*/
public CatchItemResult useItem(ItemId item) throws LoginFailedException, RemoteServerException {
return useItemAsync(item).toBlocking();
return AsyncHelper.toBlocking(useItemAsync(item));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Async helper could also return a observable transformer. So that compose(AsyncHelper.toBlocker()) would be Cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How's a transformer going to help in this situation? The goal is to unwrap the Observable and handle all RuntimeExceptions to throw their checked versions. A transformer will return another Observable, which is exactly not what I need or am I missing some other usage of a transformer?

Copy link
Collaborator

@FabianTerhorst FabianTerhorst Aug 1, 2016

Choose a reason for hiding this comment

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

Are you sure that a transformer will not return a modified version of the observable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like a transformer can´t change the type of a observable to this isn´t possible right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see what you mean now. Extend observable and return that. That would be nice indeed

@pvanassen pvanassen changed the title RxJava conversion [DONT MERGE] RxJava conversion Jul 31, 2016
esac

# Attempt to set APP_HOME
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gradlew script was updated somehow, is this an issue?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think its because you changed the gradle wrapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must have been my IDE. Nothing intentionally. I will revert it

@pvanassen pvanassen changed the title [DONT MERGE] RxJava conversion RxJava conversion Jul 31, 2016
@Grover-c13
Copy link
Owner

@mashurex when youre around can i get your opinion on this

@mashurex
Copy link
Contributor

mashurex commented Aug 1, 2016

I think this shows promise. I've gotten Observables working in my branch but I don't like the direction I've headed. Also, I've gotten swamped and it's going to take me too long to make this conversion- I think we should go with this and I'll pitch in on it and kill my PR.

@pvanassen
Copy link
Contributor Author

I've tested this branch and it works just as good as the current Development branch.

@Grover-c13
Copy link
Owner

Well merge after 0.3

@pvanassen
Copy link
Contributor Author

Maybe it's possibe to merge it into another branch in this repo? Keeping this branch up to date is quite some work :)

@FabianTerhorst
Copy link
Collaborator

I will wait until this is merged before i refactor the modules.

@FabianTerhorst
Copy link
Collaborator

@Grover-c13 can you merge this now?

@Grover-c13 Grover-c13 merged commit 4f85be1 into Grover-c13:Development Aug 1, 2016
@Grover-c13
Copy link
Owner

merged to dev

@FabianTerhorst
Copy link
Collaborator

should i start the new branch now or merge the other prs first?

@Grover-c13
Copy link
Owner

the other PR's have conflicts and i dont want to deal with that right now due to some unrelated issues going from dev to master <_<

They are minor anyway

@pvanassen pvanassen deleted the rxjava branch August 2, 2016 08:31
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.

4 participants