Skip to content

Commit

Permalink
Show more types of issue events
Browse files Browse the repository at this point in the history
  • Loading branch information
jonan committed Dec 22, 2016
2 parents 73491fc + 24ce2f6 commit f0cc732
Show file tree
Hide file tree
Showing 18 changed files with 607 additions and 419 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

## [Unreleased]

### Added
- Show more issue events.

### Fixed
- Fix crash that occurred when opening a pull request with reviews.
- Some minor improvements.

## [ForkHub v1.2.5] - 2016-12-16

### Added
Expand Down Expand Up @@ -149,6 +158,7 @@

- Last official GitHub release

[Unreleased]: https://github.com/jonan/ForkHub/compare/ForkHub-v1.2.5...master
[ForkHub v1.2.5]: https://github.com/jonan/ForkHub/compare/ForkHub-v1.2.4...ForkHub-v1.2.5
[ForkHub v1.2.4]: https://github.com/jonan/ForkHub/compare/ForkHub-v1.2.3...ForkHub-v1.2.4
[ForkHub v1.2.3]: https://github.com/jonan/ForkHub/compare/ForkHub-v1.2.2...ForkHub-v1.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class RequestConfiguration implements okhttp3.Interceptor {

private static final String HEADER_USER_AGENT = "ForkHub/2.0";
private static final String HEADER_ACCEPT = "application/vnd.github.v3.html+json";
private static final String HEADER_ACCEPT = "application/vnd.github.v3.full+json";

private final Provider<GitHubAccount> accountProvider;

Expand Down
26 changes: 26 additions & 0 deletions app/src/main/java/com/github/mobile/api/model/CommitAuthor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2016 Jon Ander Peñalba
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.mobile.api.model;

import java.util.Date;

public class CommitAuthor {
public String name;

public String email;

public Date date;
}
4 changes: 4 additions & 0 deletions app/src/main/java/com/github/mobile/api/model/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
public class Issue {
public long id;

public Repository repository;

public String url;

public String html_url;
Expand All @@ -39,6 +41,8 @@ public class Issue {

public User assignee;

public List<User> assignees;

public Milestone milestone;

public boolean locked;
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/com/github/mobile/api/model/LineComment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2016 Jon Ander Peñalba
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.mobile.api.model;

import java.util.Date;

public class LineComment {
public long id;

public User user;

public String body_html;

public Date created_at;

public Date updated_at;
}
26 changes: 26 additions & 0 deletions app/src/main/java/com/github/mobile/api/model/ReferenceSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2016 Jon Ander Peñalba
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.mobile.api.model;

import java.util.Date;

public class ReferenceSource {
public String type;

public Issue issue;

public Date date;
}
8 changes: 5 additions & 3 deletions app/src/main/java/com/github/mobile/api/model/Repository.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import com.squareup.moshi.Json;

import java.util.Date;

public class Repository {
public long id;

Expand All @@ -34,11 +36,11 @@ public class Repository {
@Json(name = "fork")
public boolean is_fork;

public String created_at;
public Date created_at;

public String updated_at;
public Date updated_at;

public String pushed_at;
public Date pushed_at;

public String homepage;

Expand Down
36 changes: 36 additions & 0 deletions app/src/main/java/com/github/mobile/api/model/TimelineEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/
package com.github.mobile.api.model;

import org.eclipse.egit.github.core.Comment;

import java.util.Date;
import java.util.List;

public class TimelineEvent {
public static final String EVENT_ASSIGNED = "assigned";
Expand All @@ -36,6 +39,8 @@ public class TimelineEvent {
public static final String EVENT_RENAMED = "renamed";
public static final String EVENT_REOPENED = "reopened";
public static final String EVENT_REVIEWED = "reviewed";
public static final String EVENT_REVIEW_REQUESTED = "review_requested";
public static final String EVENT_REVIEW_REQUEST_REMOVED = "review_request_removed";
public static final String EVENT_SUBSCRIBED = "subscribed";
public static final String EVENT_UNASSIGNED = "unassigned";
public static final String EVENT_UNLABELED = "unlabeled";
Expand All @@ -46,19 +51,50 @@ public class TimelineEvent {

public User actor;

public CommitAuthor author;

public CommitAuthor committer;

public List<LineComment> comments;

public ReferenceSource source;

public User review_requester;

public User requested_reviewer;

public String commit_id;

public String sha;

public String message;

public String event;

public Date created_at;

public Date updated_at;

public String body;

public String body_html;

public Label label;

public User assignee;

public Milestone milestone;

public Rename rename;

public Comment getOldCommentModel() {
Comment comment = new Comment();
comment.setCreatedAt(created_at);
comment.setUpdatedAt(updated_at);
comment.setBody(body);
comment.setBodyHtml(body_html);
comment.setId(id);
comment.setUser(actor.getOldUserModel());
return comment;
}
}
32 changes: 30 additions & 2 deletions app/src/main/java/com/github/mobile/api/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import com.squareup.moshi.Json;

import java.util.Date;

public class User {
public static final String TYPE_USER = "User";
public static final String TYPE_ORGANIZATION = "Organization";
Expand Down Expand Up @@ -55,9 +57,9 @@ public class User {

public int following;

public String created_at;
public Date created_at;

public String updated_at;
public Date updated_at;

public int total_private_repos;

Expand All @@ -70,4 +72,30 @@ public class User {
public int collaborators;

public Plan plan;

public org.eclipse.egit.github.core.User getOldUserModel() {
org.eclipse.egit.github.core.User user = new org.eclipse.egit.github.core.User();
user.setId((int) id);
user.setLogin(login);
user.setAvatarUrl(avatar_url);
user.setType(type);
user.setName(name);
user.setCompany(company);
user.setBlog(blog);
user.setLocation(location);
user.setEmail(email);
user.setHireable(is_hireable);
user.setBio(bio);
user.setPublicRepos(public_repos);
user.setPublicGists(public_gists);
user.setFollowers(followers);
user.setFollowing(following);
user.setCreatedAt(created_at);
user.setTotalPrivateRepos(total_private_repos);
user.setOwnedPrivateRepos(owned_private_repos);
user.setPrivateGists(private_gists);
user.setDiskUsage(disk_usage);
user.setCollaborators(collaborators);
return user;
}
}
23 changes: 4 additions & 19 deletions app/src/main/java/com/github/mobile/core/issue/FullIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@
import com.github.mobile.api.model.TimelineEvent;
import com.github.mobile.api.model.ReactionSummary;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.egit.github.core.Comment;
import org.eclipse.egit.github.core.Issue;

/**
* Issue model with comments
*/
public class FullIssue extends ArrayList<Comment> implements Serializable {

private static final long serialVersionUID = 4586476132467323827L;
public class FullIssue {

private final Issue issue;

Expand All @@ -43,23 +38,13 @@ public class FullIssue extends ArrayList<Comment> implements Serializable {
*
* @param issue
* @param reactions
* @param comments
* @param events
*/
public FullIssue(final Issue issue, final ReactionSummary reactions,
final Collection<Comment> comments, final Collection<TimelineEvent> events) {
super(comments);

this.events = events;
this.reactions = reactions;
final Collection<TimelineEvent> events) {
this.issue = issue;
}

/**
* Create empty wrapper
*/
public FullIssue() {
this.issue = null;
this.reactions = reactions;
this.events = events;
}

/**
Expand Down
Loading

0 comments on commit f0cc732

Please sign in to comment.