Open pratthama-appdesk opened 4 years ago
Hi! You can take a look at this repo for an exemple of using Apollo Android with ViewModels: https://github.com/BoD/apollo-graphql-android-sample
Hi! You can take a look at this repo for an exemple of using Apollo Android with ViewModels: https://github.com/BoD/apollo-graphql-android-sample
I don't think that's what I am looking for. There are a lot of tutorials to implement Rest api with Retrofit using Coroutines, Livedata and MVVM architecture with repository pattern but no tutorials for Apollo. Is there something similar for apollo?
I'm not aware of anything like this unfortunately. Apollo is a way access your API like Retrofit so swapping out the retrofit Service with an ApolloClient should be close enough to the end result. Can you share a good tutorial for retrofit and I'll look into how that would work with Apollo?
I'm not aware of anything like this unfortunately. Apollo is a way access your API like Retrofit so swapping out the retrofit Service with an ApolloClient should be close enough to the end result. Can you share a good tutorial for retrofit and I'll look into how that would work with Apollo?
Hi, here is a very good and perfect implementation of everything i talked about https://blog.mindorks.com/using-retrofit-with-kotlin-coroutines-in-android Thanks for your help.
Any update on this?
Apollo provides implementation for the networking layer for GraphQL API the same way as Retrofit provides implementation for networking layer for REST API. So technically if you replace anything related to the Retrofit with Apollo in the article you provided as a sample, you will get what you are looking for.
Apollo provides implementation for the networking layer for GraphQL API the same way as Retrofit provides implementation for networking layer for REST API. So technically if you replace anything related to the Retrofit with Apollo in the article you provided as a sample, you will get what you are looking for.
The implementation for retrofit and apollo is really different and I don't think you can just replace Retrofit stuff with Apollo with exact same structure If you guys can provide an example that would be really helpful. The major concern with respect to the article is the Interface that has been set up since Apollo doesn't use annotations for end points and queries how to set that up? Thanks
Any help?
Note: I'm new to android development.
I made a data access layer for apollo in an android app based on work done by my colleague with setting up a Room database (we're replacing the room implementation with apollo), as well as the code samples hosted here: https://github.com/apollographql/apollo-android/tree/master/samples/kotlin-sample
the repository I linked has been a great resource, and they do have code examples for coroutines as well (I went with rxJava).
As for your specific question about interfaces, I'm guessing they are similar to android's Room db interfaces -- I replaced those with abstract classes for every model we're tracking. I needed to use abstract classes because I "plug in" the correct datasource in the viewModel on runtime, extending them from a base abstract class.
I hope that these are enough pointers to get you started.
Hi, I also would love the official apollo android guide to follow googles recommended design patterns. Is there any reason as to why the apollo guide is not using LiveData?
Hi @jorgenfaunaapp sorry for the hugeee delay! There's no specific reason not to include more documentation and guides. The main one is that all this takes a lot of time and it's a tradeoff between writing new features, maintaining the library vs writing documentation. There are a few different architectures out there and every team has its preferences. If you add other dimensions into the mix like compose vs views, RxJava vs Coroutines, etc... covering everything and keeping everything up to date is a huge task.
That being said, documentation is hugely important and we'll make a pass at the tutorial and samples for the upcoming 3.0 release. Certainly updating to new architectural patterns and jetpack compose along the way
We're also happy to link any community samples. If you have a repo with your preferred architecture or a blog post that helped you, feel free to send it so we can review it and include it in the docs.
Hi, Any update on the docs? @martinbonnin PS: Am using v3 of apollo
Hi, is there any guide on how to implement apollo with mvvm architecture using coroutines?