Shopify / mobile-buy-sdk-android

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using their credit card.
MIT License
214 stars 137 forks source link

Issue with migration to 4.0.0 #638

Open singamcet opened 4 years ago

singamcet commented 4 years ago

Hi, Currently, i am using sdk : 3.2.3 and my code is : `call.enqueue(new GraphCall.Callback() {

        @Override
        public void onResponse(@NonNull GraphResponse<Storefront.Mutation> response) {
        }

        @Override
        public void onFailure(@NonNull GraphError error) {
        }
    });`

I an updating the version to sdk 4.0.0 and i am getting error like error: cannot find symbol graphCall.enqueue(new GraphCall.Callback<Storefront.QueryRoot>() { ^ symbol: class Callback location: interface GraphCall

How can i call graphCall.enqueue() function to getting results as like my previous code Please let me know, what changes to done Thanks in advance

MatthewYork commented 4 years ago

Hi! I believe this is close to the proper call and response unwrap approach for 4.0.0

client.queryGraph(yourQuery()).enqueue { graphResponse ->
            when (graphResponse) {
                is GraphCallResult.Failure -> {
                    //handle error
                }
                is GraphCallResult.Success -> {
                    val responseData = graphResponse.response.data
                }
            }
        }