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

[WIP] Restructure app to use a data manager #232

Closed
wants to merge 36 commits into from

Conversation

therajanmaurya
Copy link
Member

This is a major restructure and refactor of the project. Right now, the organization of making API calls via Retrofit is not nicely organized.

I've added a new layer for managing all the data sources, whether it be Retrofit making calls, or retrieving from the database or caching. This is aimed towards organizing the app in an MVP style architecture. This also follows the Observer pattern by the help of RxAndroid.

References: https://github.com/ribot/android-boilerplate

To-do:

  • Added new classes (data manager, presenters, etc.)
  • Adding reactive code
  • Moving Retrofit calls into the data manager
  • Decoupling Model and Presenter (MVP)
  • Updating Retrofit 1.9 to Retrofit 2.0 (Working on This)
  • Using otto event bus to publish events and subscribing to streams.
  • Unit tests (maybe)
  • Docs

/cc @edcable @fomenkoo @ishan1604

…sBar finishes when When All details Response comes using Counter Variable
@fomenkoo
Copy link
Contributor

Hi Rajan,

Basically your PR is failing.

From my opinion, you should at least discuss such a huge architecture change with mentors first.
The current project architecture is still far away from being complete, and even this difficult for most of the students!
Using RxJava is ok, but changing to MVP will take a project to very difficult level.

*Regarding boilerplate you have choose: *

https://github.com/ribot/android-boilerplate - this boilerplate was updated several month ago, and it seems it may be abandoned soon.

Android N, and new Jack compiler will bring official Java 8 support, and a ton of new architecture boilerplates :)

Regarding your commit
That's too much to review http://prntscr.com/ah0kgh :)

You did a great job, but I think we should discuss it within project contributors, and implement it step-by-step (in case you can explain pros and cons of this architecture) :)

@therajanmaurya
Copy link
Member Author

Thanks @fomenkoo ,

My PR was failing because during implementing rxAndroid their was two or more class depending ApiManager Services. which i am changing, so doing git continuously each and every step and fixing the rxAndroid code with layer in every class that's why PR was failing.

Sorry, I did this without discussion. but we can talk about this.

I am pointing some issues on which I have working and some have been implemented:

  • Project needs something more classes architecture like for handling Retrofit Request in separate class this will make code readability high and fast to contribute into the project and debugging will be easy.

Solution :[I have done this by implementing MVP Structure. Here I changed only shifting the Retrofit Request into the Presenter Class and Remaining are same.]

  • Now Project using Networking Library Retrofit 1.9.0 , 1.9.0 version is very old and it had many bugs that have been fixed by Square and Now released Retrofit 2.0 stable version that have running efficiency much more with very less time failure and fast.

Now The project is on the good stage with Thousand Lines of code so its very difficult to shift Retrofit 1.9 to Retrofit 2.0 because in present condition Retrofit Request is handling in every View Classes many times, so its difficult to change Retrofit 1.9.0 API Request code with Retrofit 2.0.0 because both have different architecture like creating Service style have changed , many of Classes name and its working changed and Many new feature added.
if we Directly change the Retrofit 1.9 to 2.0, in the View Classes, so the debugging code and removing Errors will take much more time.

Solution :[For this I have used RxAndroid in View's Presenter Class that wiring the code in the flow with and making the Retrofit Request in out side the main Thread. and the most important feature it contains that support Retrofit 1.9 and 2.0 with same coding style and with same methods and code, so after implementing the RxAndroid Observable Pattern we can easily shift Retrofit 1.9 to 2.0 by changing the few lines in the classes BaseApiManager, APIEndpint and ApiManager. like changing Service Creation and some littles others]

  • After implementing MVP it's very easy to me, to look the Views classes and fixing the listener and handling the Progressbar(not creating multiple times) and app is currently working fine.

I have fixed : Client List Scrolling and Refresh and load more and other please look.

We can discuss. I am waiting for you reply.

Please Reply @fomenkoo

@therajanmaurya
Copy link
Member Author

Implemented Reference PR : #284 and #286

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.

None yet

2 participants