mirror of
				https://github.com/KokaKiwi/BarInsta
				synced 2025-10-31 11:35:34 +00:00 
			
		
		
		
	Fix comment replies cursor
This commit is contained in:
		
							parent
							
								
									e6b791bd4d
								
							
						
					
					
						commit
						bcec6d373c
					
				| @ -185,8 +185,9 @@ public class CommentsViewerViewModel extends ViewModel { | |||||||
|             list = getPrevList(replyList); |             list = getPrevList(replyList); | ||||||
|         } |         } | ||||||
|         replyList.postValue(Resource.loading(list)); |         replyList.postValue(Resource.loading(list)); | ||||||
|         if (isLoggedIn.getValue()) { |         final Boolean isLoggedInValue = isLoggedIn.getValue(); | ||||||
|             commentService.fetchChildComments(postId, commentId, rootCursor, rcb); |         if (isLoggedInValue != null && isLoggedInValue) { | ||||||
|  |             commentService.fetchChildComments(postId, commentId, repliesCursor, rcb); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         final Call<String> request = graphQLService.fetchComments(commentId, false, repliesCursor); |         final Call<String> request = graphQLService.fetchComments(commentId, false, repliesCursor); | ||||||
| @ -224,8 +225,8 @@ public class CommentsViewerViewModel extends ViewModel { | |||||||
|                         builder.add(commentModel); |                         builder.add(commentModel); | ||||||
|                     } |                     } | ||||||
|                     callback.onSuccess(root ? |                     callback.onSuccess(root ? | ||||||
|                             new CommentsFetchResponse(count, endCursor, builder.build()) : |                                        new CommentsFetchResponse(count, endCursor, builder.build()) : | ||||||
|                             new ChildCommentsFetchResponse(count, endCursor, builder.build())); |                                        new ChildCommentsFetchResponse(count, endCursor, builder.build())); | ||||||
|                 } catch (Exception e) { |                 } catch (Exception e) { | ||||||
|                     Log.e(TAG, "onResponse", e); |                     Log.e(TAG, "onResponse", e); | ||||||
|                     callback.onFailure(e); |                     callback.onFailure(e); | ||||||
|  | |||||||
| @ -79,7 +79,6 @@ public class CommentService extends BaseService { | |||||||
|         request.enqueue(new Callback<CommentsFetchResponse>() { |         request.enqueue(new Callback<CommentsFetchResponse>() { | ||||||
|             @Override |             @Override | ||||||
|             public void onResponse(@NonNull final Call<CommentsFetchResponse> call, @NonNull final Response<CommentsFetchResponse> response) { |             public void onResponse(@NonNull final Call<CommentsFetchResponse> call, @NonNull final Response<CommentsFetchResponse> response) { | ||||||
|                 if (callback == null) return; |  | ||||||
|                 final CommentsFetchResponse cfr = response.body(); |                 final CommentsFetchResponse cfr = response.body(); | ||||||
|                 if (cfr == null) callback.onFailure(new Exception("response is empty")); |                 if (cfr == null) callback.onFailure(new Exception("response is empty")); | ||||||
|                 callback.onSuccess(cfr); |                 callback.onSuccess(cfr); | ||||||
| @ -102,7 +101,6 @@ public class CommentService extends BaseService { | |||||||
|         request.enqueue(new Callback<ChildCommentsFetchResponse>() { |         request.enqueue(new Callback<ChildCommentsFetchResponse>() { | ||||||
|             @Override |             @Override | ||||||
|             public void onResponse(@NonNull final Call<ChildCommentsFetchResponse> call, @NonNull final Response<ChildCommentsFetchResponse> response) { |             public void onResponse(@NonNull final Call<ChildCommentsFetchResponse> call, @NonNull final Response<ChildCommentsFetchResponse> response) { | ||||||
|                 if (callback == null) return; |  | ||||||
|                 final ChildCommentsFetchResponse cfr = response.body(); |                 final ChildCommentsFetchResponse cfr = response.body(); | ||||||
|                 if (cfr == null) callback.onFailure(new Exception("response is empty")); |                 if (cfr == null) callback.onFailure(new Exception("response is empty")); | ||||||
|                 callback.onSuccess(cfr); |                 callback.onSuccess(cfr); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user