public <D extends Mutation.Data, T, V extends Mutation.Variables> void retryConflictMutation(@Nonnull Mutation<D, T, V> mutation, String uniqueIdentifierForOriginalMutation) { //Remove callback from map. This will return null for persistent offline mutations InterceptorCallback callback = (InterceptorCallback) callbackMapForInMemoryMutations.remove(uniqueIdentifierForOriginalMutation); if (callback != null ) { //Put the callback in with the mutation.toString() as the key. This will be picked up to route the the mutation results // back to the callback later. Log.d(TAG, "Proceeding with retry for inMemory offline mutation [" + uniqueIdentifierForOriginalMutation + "]"); callbackMapForInMemoryMutations.put(mutation.toString(), callback); } else { // put in details of persistent mutation. //TODO: Check if this logic is required. Log.d(TAG, "Proceeding with retry for persistent offline mutation [" + uniqueIdentifierForOriginalMutation + "]"); if (persistentOfflineMutationObjectMap.isEmpty()) { Log.d(TAG, "Populating mutations map."); persistentOfflineMutationObjectMap.putAll(appSyncOfflineMutationManager.persistentOfflineMutationManager.persistentOfflineMutationObjectMap); } PersistentOfflineMutationObject object = persistentOfflineMutationObjectMap.remove(uniqueIdentifierForOriginalMutation); persistentOfflineMutationObjectMap.put(mutation.toString(), object); } appSyncClient.mutate(mutation, true).enqueue(null); }
/** * <p>Adds provided {@link AppSyncMutationCall} that is currently in progress.</p> * * <p><b>Note</b>: This method needs to be called right before an apolloCall is executed.</p> */ void registerMutationCall(@Nonnull AppSyncMutationCall appSyncMutationCall) { checkNotNull(appSyncMutationCall, "appSyncMutationCall == null"); OperationName operationName = appSyncMutationCall.operation().name(); registerCall(activeMutationCalls, operationName, appSyncMutationCall); }
CreatePostMutation addPostMutation = CreatePostMutation.builder().input(createPostInput).build(); client.mutate(addPostMutation, expected) .enqueue(new GraphQLCall.Callback<CreatePostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<CreatePostMutation.Data> response) {
/** * <p>Adds provided {@link AppSyncMutationCall} that is currently in progress.</p> * * <p><b>Note</b>: This method needs to be called right before an apolloCall is executed.</p> */ void registerMutationCall(@Nonnull AppSyncMutationCall appSyncMutationCall) { checkNotNull(appSyncMutationCall, "appSyncMutationCall == null"); OperationName operationName = appSyncMutationCall.operation().name(); registerCall(activeMutationCalls, operationName, appSyncMutationCall); }
.id(p.id()) .build(); ClientFactory.getInstance(view.getContext()).mutate(deletePostMutation).enqueue(new GraphQLCall.Callback<DeletePostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<DeletePostMutation.Data> response) {
/** * <p>Removes provided {@link AppSyncMutationCall} that finished his execution, if it is found, else throws an * {@link AssertionError}.</p> * * If the removal operation is successful and no active running calls are found, then the registered * {@link ApolloCallTracker#idleResourceCallback} is invoked. * * <p><b>Note</b>: This method needs to be called right after an apolloCall is completed (whether successful or * failed).</p> */ void unregisterMutationCall(@Nonnull AppSyncMutationCall appSyncMutationCall) { checkNotNull(appSyncMutationCall, "appSyncMutationCall == null"); OperationName operationName = appSyncMutationCall.operation().name(); unregisterCall(activeMutationCalls, operationName, appSyncMutationCall); }
.enqueue(new GraphQLCall.Callback<CreateArticleMutation.Data>() { @Override public void onResponse(@Nonnull Response<CreateArticleMutation.Data> response) {
/** * <p>Removes provided {@link AppSyncMutationCall} that finished his execution, if it is found, else throws an * {@link AssertionError}.</p> * * If the removal operation is successful and no active running calls are found, then the registered * {@link ApolloCallTracker#idleResourceCallback} is invoked. * * <p><b>Note</b>: This method needs to be called right after an apolloCall is completed (whether successful or * failed).</p> */ void unregisterMutationCall(@Nonnull AppSyncMutationCall appSyncMutationCall) { checkNotNull(appSyncMutationCall, "appSyncMutationCall == null"); OperationName operationName = appSyncMutationCall.operation().name(); unregisterCall(activeMutationCalls, operationName, appSyncMutationCall); }
call1.enqueue(new GraphQLCall.Callback<AddPostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<AddPostMutation.Data> response) { call2.enqueue(new GraphQLCall.Callback<AddPostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<AddPostMutation.Data> response) {
.enqueue(new GraphQLCall.Callback<UpdateArticleMutation.Data>() { @Override public void onResponse(@Nonnull Response<UpdateArticleMutation.Data> response) {
.enqueue(new GraphQLCall.Callback<UpdateArticleMutation.Data>() { @Override public void onResponse(@Nonnull Response<UpdateArticleMutation.Data> response) {
.build()) .build(); ClientFactory.getInstance(view.getContext()).mutate(updatePostMutation).enqueue(new GraphQLCall.Callback<UpdatePostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<UpdatePostMutation.Data> response) {
.build(); ClientFactory.getInstance(view.getContext()).mutate(updatePostMutation).enqueue(new GraphQLCall.Callback<UpdatePostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<UpdatePostMutation.Data> response) {
final AppSyncMutationCall call = awsAppSyncClient.mutate(addPostMutation, expected); call.enqueue(new GraphQLCall.Callback<AddPostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<AddPostMutation.Data> response) {
.enqueue(new GraphQLCall.Callback<UpdateArticleMutation.Data>() { @Override public void onResponse(@Nonnull Response<UpdateArticleMutation.Data> response) {
AppSyncMutationCall call = awsAppSyncClient.mutate(addPostMutation, expected); call.enqueue(new GraphQLCall.Callback<AddPostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<AddPostMutation.Data> response) {
awsAppSyncClient .mutate(updatePostMutation, expected) .enqueue(new GraphQLCall.Callback<UpdatePostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<UpdatePostMutation.Data> response) {
.enqueue(new GraphQLCall.Callback<CreateArticleMutation.Data>() { @Override public void onResponse(@Nonnull Response<CreateArticleMutation.Data> response) {
awsAppSyncClient .mutate(updatePostMutation, expected) .enqueue(new GraphQLCall.Callback<UpdatePostMutation.Data>() { @Override public void onResponse(@Nonnull final Response<UpdatePostMutation.Data> response) {
.enqueue(new GraphQLCall.Callback<CreateArticle2Mutation.Data>() { @Override public void onResponse(@Nonnull Response<CreateArticle2Mutation.Data> response) {