DisqusResponse postComment(String token, String threadId, String parentID, String message) { String result = disqusMethods.postComment(token, threadId, parentID, message); Log.d("DisqusDetails", result); if (result.contains("\"code\":18")) // Credentials are bad: possibly expired token return new DisqusResponse(false, 18); else if (result.contains("\"code\":12")) // Not authorized: possibly null token return new DisqusResponse(false, 12); else return new DisqusResponse(true, -1); }
AccessToken refreshAccessToken(String refreshToken) { String tokenJson = disqusMethods.refreshAccessToken(refreshToken); Log.d( "DisqusDetails", tokenJson); // Issue here with code 18 and 12 (12 was from saving a bad token) if (tokenJson != null) return AccessToken.parseAccessToken(tokenJson); return null; }
// LIST_POSTS Disqus: two internet requests to load comments // TEMP: Until we don't need a separate call to get thread id (b/c we already have it from using // primarily JSON for articles, return both comments and thread id. // Used only by DisqusGetComments in background TempCommentsAndThreadId getComments(String s, boolean justRefresh) { String threadId = s; // Request 1 if (!justRefresh) { HttpDetails.ThreadIdPair threadIdPair = httpMethods.getMsoThreadId(s); // If Request 1 fails, either error 1 or 2 if (threadIdPair.code != 0) return new TempCommentsAndThreadId(null, null, threadIdPair.code); threadId = threadIdPair.threadId; } // Request 2 (Pure http request) String commentsJson = disqusMethods.getCommentsJson(threadId); if (commentsJson != null) return new TempCommentsAndThreadId(Comments.parseCommentsArray(commentsJson), threadId, 0); else return new TempCommentsAndThreadId(null, threadId, 3); }
boolean deleteComment(String token, String postId) { return disqusMethods.deleteComment(token, postId); }
AccessToken getAccessToken(String code) { String tokenJson = disqusMethods.getAccessTokenFromCode(code); if (tokenJson != null) return AccessToken.parseAccessToken(tokenJson); return null; }