Search in sources :

Example 1 with IssueState

use of com.meisolsson.githubsdk.model.IssueState in project PocketHub by pockethub.

the class EditStateTask method edit.

/**
 * Edit state of issue.
 *
 * @param close
 * @return this task
 */
public EditStateTask edit(boolean close) {
    int message = close ? R.string.closing_issue : R.string.reopening_issue;
    IssueState state = close ? IssueState.Closed : IssueState.Open;
    try {
        store.changeState(repository, issueNumber, state).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).compose(RxProgress.bindToLifecycle(activity, message)).as(AutoDisposeUtils.bindToLifecycle(activity)).subscribe(observer);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return this;
}
Also used : IssueState(com.meisolsson.githubsdk.model.IssueState)

Example 2 with IssueState

use of com.meisolsson.githubsdk.model.IssueState in project PocketHub by pockethub.

the class EditStateTask method subscribe.

@Override
public void subscribe(ObservableEmitter<Issue> emitter) throws Exception {
    try {
        IssueState state = close ? IssueState.closed : IssueState.open;
        emitter.onNext(store.changeState(repositoryId, issueNumber, state));
        emitter.onComplete();
    } catch (IOException e) {
        emitter.onError(e);
    }
}
Also used : IssueState(com.meisolsson.githubsdk.model.IssueState) IOException(java.io.IOException)

Aggregations

IssueState (com.meisolsson.githubsdk.model.IssueState)2 IOException (java.io.IOException)1