use of io.plaidapp.data.api.designernews.model.StoryResponse in project sbt-android by scala-android.
the class UpvoteStoryService method handleActionUpvote.
private void handleActionUpvote(long storyId) {
if (storyId == 0l)
return;
DesignerNewsPrefs designerNewsPrefs = DesignerNewsPrefs.get(this);
if (!designerNewsPrefs.isLoggedIn()) {
// TODO prompt for login
return;
}
DesignerNewsService designerNewsService = new RestAdapter.Builder().setEndpoint(DesignerNewsService.ENDPOINT).setRequestInterceptor(new ClientAuthInterceptor(designerNewsPrefs.getAccessToken(), BuildConfig.DESIGNER_NEWS_CLIENT_ID)).build().create(DesignerNewsService.class);
designerNewsService.upvoteStory(storyId, "", new Callback<StoryResponse>() {
@Override
public void success(StoryResponse storyResponse, Response response) {
int newVotesCount = storyResponse.story.vote_count;
// TODO report success
}
@Override
public void failure(RetrofitError error) {
// TODO report failure
}
});
}
Aggregations