Search in sources :

Example 1 with Triplet

use of com.gh4a.utils.Triplet in project gh4a by slapperwan.

the class PullRequestActivity method load.

private void load(boolean force) {
    PullRequestService prService = ServiceFactory.get(PullRequestService.class, force);
    IssueService issueService = ServiceFactory.get(IssueService.class, force);
    Single<PullRequest> prSingle = prService.getPullRequest(mRepoOwner, mRepoName, mPullRequestNumber).map(ApiHelpers::throwOnFailure);
    Single<Issue> issueSingle = issueService.getIssue(mRepoOwner, mRepoName, mPullRequestNumber).map(ApiHelpers::throwOnFailure);
    Single<Boolean> isCollaboratorSingle = SingleFactory.isAppUserRepoCollaborator(mRepoOwner, mRepoName, force);
    Single.zip(issueSingle, prSingle, isCollaboratorSingle, Triplet::create).compose(makeLoaderSingle(0, force)).subscribe(result -> {
        mIssue = result.first;
        mPullRequest = result.second;
        mIsCollaborator = result.third;
        fillHeader();
        setContentShown(true);
        invalidateTabs();
        updateFabVisibility();
        supportInvalidateOptionsMenu();
        if (mInitialPage >= 0 && mInitialPage < TITLES.length) {
            getPager().setCurrentItem(mInitialPage);
            mInitialPage = -1;
        }
    }, this::handleLoadFailure);
}
Also used : PullRequestService(com.meisolsson.githubsdk.service.pull_request.PullRequestService) IssueService(com.meisolsson.githubsdk.service.issues.IssueService) Issue(com.meisolsson.githubsdk.model.Issue) Triplet(com.gh4a.utils.Triplet) PullRequest(com.meisolsson.githubsdk.model.PullRequest) EditPullRequest(com.meisolsson.githubsdk.model.request.pull_request.EditPullRequest) ApiHelpers(com.gh4a.utils.ApiHelpers)

Aggregations

ApiHelpers (com.gh4a.utils.ApiHelpers)1 Triplet (com.gh4a.utils.Triplet)1 Issue (com.meisolsson.githubsdk.model.Issue)1 PullRequest (com.meisolsson.githubsdk.model.PullRequest)1 EditPullRequest (com.meisolsson.githubsdk.model.request.pull_request.EditPullRequest)1 IssueService (com.meisolsson.githubsdk.service.issues.IssueService)1 PullRequestService (com.meisolsson.githubsdk.service.pull_request.PullRequestService)1