Search in sources :

Example 1 with MarkdownService

use of com.meisolsson.githubsdk.service.misc.MarkdownService in project gh4a by slapperwan.

the class ReleaseInfoActivity method loadBody.

private void loadBody() {
    final Single<Optional<String>> htmlSingle;
    if (TextUtils.isEmpty(mRelease.body())) {
        htmlSingle = Single.just(Optional.absent());
    } else {
        MarkdownService service = ServiceFactory.get(MarkdownService.class, false);
        RequestMarkdown request = RequestMarkdown.builder().context(mRepoOwner + "/" + mRepoName).mode("gfm").text(mRelease.body()).build();
        htmlSingle = service.renderMarkdown(request).map(ApiHelpers::throwOnFailure).map(Optional::of);
    }
    mBodySubscription = htmlSingle.compose(makeLoaderSingle(ID_LOADER_BODY, false)).subscribe(this::fillNotes, this::handleLoadFailure);
}
Also used : RequestMarkdown(com.meisolsson.githubsdk.model.request.RequestMarkdown) Optional(com.gh4a.utils.Optional) ApiHelpers(com.gh4a.utils.ApiHelpers) MarkdownService(com.meisolsson.githubsdk.service.misc.MarkdownService)

Aggregations

ApiHelpers (com.gh4a.utils.ApiHelpers)1 Optional (com.gh4a.utils.Optional)1 RequestMarkdown (com.meisolsson.githubsdk.model.request.RequestMarkdown)1 MarkdownService (com.meisolsson.githubsdk.service.misc.MarkdownService)1