Closed Lavanyagaur22 closed 5 years ago
@harshithdwivedi @wtrocki WDYT?
in onSchedule why don't we return the Mutation object instead and let the user do whatever they want.
They would probably don't know how to get access to the variables or the values provided in mutation. I mean just for their simplicity, we can return mutation too, no harm. But user has the need of only the variables stored in it and not the entire mutation obj, so..
@harshithdwivedi For now, I am returning mutation object then.
Yep
Late to the party, but @harshithdwivedi made a really nice comment. I would prefer mutation. In fact we can allow people to reschedule operation if they get entire mutation object.
Guys.. How about we do different path.. Instead of passing this interface to enqueue we can..
I think this may just make thins much more clean and simple to end users. We can finally have some place to hold the data instead of using singletons and static fields.
Many different things. I think we are extending client anyway so let;s do it properly. WDYT?
Above is just a suggestion.
- Extend ApolloClient
@wtrocki We can't do this as ApolloClient is a final class. That's why we can't make an OffixClient sort of thing which extends ApolloClient.
That's why we have 2 options left, either take the client from the user or make a new one in our library. For now, we are taking it from the user. We are not extending it. In this case the user can create a client according to his needs. I think let's first do this with callbacks and then we can go back to the board and think about a different approach for this?
@wtrocki @harshithdwivedi WDYT?
Description
We can modify the
enqueue
method of the Offix file in such a way that it will now take 2 parameters,mutation
object and a custom interface which can be of the typeOffix Interface
.This interface will have 2 methods:
onSuccess()
andonSchedule()
.In the
enqueue
method we can create a minimal object ofApolloCall.Callback
and in it'sonFailure()
we can set error data and the mutation's valueMap( json ) in the custom interface'sonSchedule()
and in it'sonResponse ()
we can simply set the json string response (which we get from the server) in theonSuccess()
of that callback.In this way, the user can do the UI bindings according to their needs. And also if the network is not there, they can still perform UI bindings with the help of the mutation value map variables provided to them in thr onSuccess() method of the custom Interface.