-
Notifications
You must be signed in to change notification settings - Fork 0
Code quality feedback #2
Description
-
These methods are pretty identical, can move to a helper function that takes the URI as a param
Jitterr/app/src/main/java/com/codepath/apps/restclienttemplate/JitterClient.java
Lines 61 to 99 in 5c9a4c9
public void publishTweet(String tweetContent, JsonHttpResponseHandler handler) { String apiUrl = getApiUrl("statuses/update.json"); // Can specify query string params directly or through RequestParams. RequestParams params = new RequestParams(); params.put("status", tweetContent); client.post(apiUrl, params, "", handler); } public void favoriteTweet(String tweetId, JsonHttpResponseHandler handler) { String apiUrl = getApiUrl("favorites/create.json"); // Can specify query string params directly or through RequestParams. RequestParams params = new RequestParams(); params.put("id", tweetId); client.post(apiUrl, params, "", handler); } public void unfavoriteTweet(String tweetId, JsonHttpResponseHandler handler) { String apiUrl = getApiUrl("favorites/destroy.json"); // Can specify query string params directly or through RequestParams. RequestParams params = new RequestParams(); params.put("id", tweetId); client.post(apiUrl, params, "", handler); } public void retweetTweet(String tweetId, JsonHttpResponseHandler handler) { String apiUrl = getApiUrl("statuses/retweet/" + tweetId + ".json"); // Can specify query string params directly or through RequestParams. RequestParams params = new RequestParams(); params.put("id", tweetId); client.post(apiUrl, params, "", handler); } public void unretweetTweet(String tweetId, JsonHttpResponseHandler handler) { String apiUrl = getApiUrl("statuses/unretweet/" + tweetId + ".json"); // Can specify query string params directly or through RequestParams. RequestParams params = new RequestParams(); params.put("id", tweetId); client.post(apiUrl, params, "", handler); } -
It's great to have a lot of comments for ambiguous parts of code. For clear descriptive lines, feel free to remove comment:
Jitterr/app/src/main/java/com/codepath/apps/restclienttemplate/TweetAdapter.java
Lines 156 to 157 in 5c9a4c9
// if not favorited if (!tweet.isFavorited) {
Jitterr/app/src/main/java/com/codepath/apps/restclienttemplate/TweetAdapter.java
Line 173 in 5c9a4c9
tweet.isFavorited = true; // Set to true -
Feel free to remove debugging logs. Or if it's important signal log, maybe remove "hopefully" =) . I explained about logs this week after you already committed this code, so no worries.
Jitterr/app/src/main/java/com/codepath/apps/restclienttemplate/TweetAdapter.java
Line 162 in 5c9a4c9
Log.i("adapter", "Tweet favorited hopefully"); -
Great job providing descriptive commit names! Instead of listing "Finished required features and the following stretch features:... ", better to just name the feature you are adding, for readability.