Search in sources :

Example 6 with CommentRequestModel

use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.

the class GistCommentsPresenter method onHandleComment.

@Override
public void onHandleComment(@NonNull String text, @Nullable Bundle bundle, String gistId) {
    CommentRequestModel model = new CommentRequestModel();
    model.setBody(text);
    manageDisposable(RxHelper.getObservable(RestProvider.getGistService(isEnterprise()).createGistComment(gistId, model)).doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))).subscribe(comment -> sendToView(view -> view.onAddNewComment(comment)), throwable -> {
        onError(throwable);
        sendToView(GistCommentsMvp.View::hideBlockingProgress);
    }));
}
Also used : Comment(com.fastaccess.data.dao.model.Comment) BundleConstant(com.fastaccess.helper.BundleConstant) CommentRequestModel(com.fastaccess.data.dao.CommentRequestModel) Bundle(android.os.Bundle) Login(com.fastaccess.data.dao.model.Login) RestProvider(com.fastaccess.provider.rest.RestProvider) BaseMvp(com.fastaccess.ui.base.mvp.BaseMvp) TextUtils(android.text.TextUtils) NonNull(android.support.annotation.NonNull) ArrayList(java.util.ArrayList) RxHelper(com.fastaccess.helper.RxHelper) R(com.fastaccess.R) PopupMenu(android.widget.PopupMenu) View(android.view.View) Nullable(android.support.annotation.Nullable) BasePresenter(com.fastaccess.ui.base.mvp.presenter.BasePresenter) CommentRequestModel(com.fastaccess.data.dao.CommentRequestModel)

Example 7 with CommentRequestModel

use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.

the class IssueTimelinePresenter method onHandleComment.

@Override
public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
    if (getView() == null)
        return;
    Issue issue = getView().getIssue();
    if (issue != null) {
        if (bundle == null) {
            CommentRequestModel commentRequestModel = new CommentRequestModel();
            commentRequestModel.setBody(text);
            manageDisposable(RxHelper.getObservable(RestProvider.getIssueService(isEnterprise()).createIssueComment(issue.getLogin(), issue.getRepoId(), issue.getNumber(), commentRequestModel)).doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))).subscribe(comment -> sendToView(view -> view.addNewComment(TimelineModel.constructComment(comment))), throwable -> {
                onError(throwable);
                sendToView(IssueTimelineMvp.View::onHideBlockingProgress);
            }));
        }
    }
}
Also used : Comment(com.fastaccess.data.dao.model.Comment) GenericEvent(com.fastaccess.data.dao.timeline.GenericEvent) Bundle(android.os.Bundle) SourceModel(com.fastaccess.data.dao.timeline.SourceModel) ActivityHelper(com.fastaccess.helper.ActivityHelper) Getter(lombok.Getter) TimelineModel(com.fastaccess.data.dao.TimelineModel) CommentsHelper(com.fastaccess.provider.timeline.CommentsHelper) Uri(android.net.Uri) InputHelper(com.fastaccess.helper.InputHelper) NonNull(android.support.annotation.NonNull) Issue(com.fastaccess.data.dao.model.Issue) CreateIssueActivity(com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity) SchemeParser(com.fastaccess.provider.scheme.SchemeParser) ArrayList(java.util.ArrayList) RxHelper(com.fastaccess.helper.RxHelper) PopupMenu(android.widget.PopupMenu) View(android.view.View) Observable(io.reactivex.Observable) ReactionTypes(com.fastaccess.data.dao.types.ReactionTypes) BasePresenter(com.fastaccess.ui.base.mvp.presenter.BasePresenter) BundleConstant(com.fastaccess.helper.BundleConstant) CommentRequestModel(com.fastaccess.data.dao.CommentRequestModel) Login(com.fastaccess.data.dao.model.Login) RestProvider(com.fastaccess.provider.rest.RestProvider) BaseMvp(com.fastaccess.ui.base.mvp.BaseMvp) ReactionsProvider(com.fastaccess.provider.timeline.ReactionsProvider) List(java.util.List) R(com.fastaccess.R) FilterIssuesActivity(com.fastaccess.ui.modules.filter.issues.FilterIssuesActivity) TimelineConverter(com.fastaccess.provider.timeline.TimelineConverter) Nullable(android.support.annotation.Nullable) Activity(android.app.Activity) Issue(com.fastaccess.data.dao.model.Issue) CommentRequestModel(com.fastaccess.data.dao.CommentRequestModel)

Aggregations

CommentRequestModel (com.fastaccess.data.dao.CommentRequestModel)7 Bundle (android.os.Bundle)4 NonNull (android.support.annotation.NonNull)4 Nullable (android.support.annotation.Nullable)4 View (android.view.View)4 PopupMenu (android.widget.PopupMenu)4 R (com.fastaccess.R)4 Comment (com.fastaccess.data.dao.model.Comment)4 Login (com.fastaccess.data.dao.model.Login)4 BundleConstant (com.fastaccess.helper.BundleConstant)4 RxHelper (com.fastaccess.helper.RxHelper)4 RestProvider (com.fastaccess.provider.rest.RestProvider)4 BasePresenter (com.fastaccess.ui.base.mvp.presenter.BasePresenter)4 ArrayList (java.util.ArrayList)4 TimelineModel (com.fastaccess.data.dao.TimelineModel)3 ReactionTypes (com.fastaccess.data.dao.types.ReactionTypes)3 ActivityHelper (com.fastaccess.helper.ActivityHelper)3 CommentsHelper (com.fastaccess.provider.timeline.CommentsHelper)3 ReactionsProvider (com.fastaccess.provider.timeline.ReactionsProvider)3 BaseMvp (com.fastaccess.ui.base.mvp.BaseMvp)3