This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getTasks() { | |
noteslist.clear() | |
Log.e(TAG, "inside getTasks") | |
Log.e(TAG, " getActiveCallsCount : ${Utils.getApolloClient(this)?.activeCallsCount()}") | |
apolloStore = Utils.getApolloClient(this)?.apolloStore()!! | |
Log.e(TAG, " apolloStore : ${Utils.getApolloClient(this)?.apolloStore()}") | |
val client = Utils.getApolloClient(this)?.query( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getTasks() { | |
noteslist.clear() | |
Log.e(TAG, "inside getTasks") | |
Log.e(TAG, " getActiveCallsCount : ${Utils.getApolloClient(this)?.activeCallsCount()}") | |
apolloStore = Utils.getApolloClient(this)?.apolloStore()!! | |
Log.e(TAG, " apolloStore : ${Utils.getApolloClient(this)?.apolloStore()}") | |
val client: ApolloCall<AllTasksQuery.Data> = Utils.getApolloClient(this)?.query( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AllTasksQuery.builder()?.build()?.let { | |
// Utils?.getApolloClient(this)?.query(it) | |
// ?.responseFetcher(ApolloResponseFetchers.CACHE_FIRST) | |
// ?.enqueue(object : ApolloCall.Callback<AllTasksQuery.Data>() { | |
// override fun onFailure(e: ApolloException) { | |
// e.printStackTrace() | |
// Log.e(TAG, "----$e ") | |
// } | |
// | |
// override fun onResponse(response: Response<AllTasksQuery.Data>) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun ApolloCall<Any>.offQueue( | |
apolloClient: ApolloClient, | |
mutation: com.apollographql.apollo.api.Mutation<Operation.Data, Operation.Data, Operation.Variables>, | |
callback: ApolloCall.Callback<Any> | |
) { | |
if (Offline.isNetwork()) { | |
this.enqueue(callback) | |
} else { | |
val operation =this.operation() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies{ | |
implementation 'org.aerogear.offix:offix:0.1.0' | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.aerogear.offix</groupId> | |
<artifactId>offix</artifactId> | |
<version>0.1.0</version> | |
<type>pom</type> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a mutation object | |
val mutation = UpdateCurrentTaskMutation.builder().id(id).title(title).version(version).build() | |
//Create an object of apolloCall | |
val client = apolloClient.mutate(mutation)?.refetchQueries(apolloQueryWatcher?.operation()?.name()) | |
//Create a callback object of type ResponseCallback | |
val customCallback = object : ResponseCallback { | |
override fun onSuccess(response: Response<Any>) { | |
//Perform UI bindings accordingly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a mutation object | |
Mutation mutation = UpdateCurrentTaskMutation.builder().id(id).title(title).version(version).build(); | |
//Create an object of apolloCall | |
ApolloMutationCall<UpdateCurrentTaskMutation.Data> client = apolloClient.mutate(mutation) | |
.refetchQueries(apolloQueryWatcher.operation().name()); | |
//Create a callback object of type ResponseCallback | |
ResponseCallback customCallback = new ResponseCallback(){ | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleWorker(context: Context, workParameters: WorkerParameters) : OffixWorker(context, workParameters) { | |
override fun doWork(): Result { | |
/* | |
getListOfMutations() returns the list of mutations stored in database in the library. | |
It's present in the parent class, i.e OffixWorker. | |
*/ | |
val listOfMutations = getListOfMutations() | |
//get the mutation one by one from list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleWorker extends OffixWorker{ | |
public doWork(){ | |
/* getListOfMutations() returns the list of mutations stored in database in the library. | |
It's present in the parent class, i.e OffixWorker. | |
*/ | |
List<Mutation> listOfMutations=getListOfMutations(); | |
//get the mutation one by one from list. |