Search in sources :

Example 1 with CreateGistModel

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

the class CreateGistPresenter method onSubmit.

@Override
public void onSubmit(@NonNull String description, @NonNull HashMap<String, FilesListModel> files, boolean isPublic) {
    if (files.isEmpty())
        return;
    CreateGistModel createGistModel = new CreateGistModel();
    createGistModel.setDescription(InputHelper.toString(description));
    createGistModel.setPublicGist(isPublic);
    createGistModel.setFiles(files);
    onSubmit(createGistModel);
}
Also used : CreateGistModel(com.fastaccess.data.dao.CreateGistModel)

Example 2 with CreateGistModel

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

the class CreateGistPresenter method onSubmitUpdate.

@Override
public void onSubmitUpdate(@NonNull String id, @NonNull String description, @NonNull HashMap<String, FilesListModel> files) {
    boolean isEmptyDesc = InputHelper.isEmpty(description);
    if (getView() != null) {
        getView().onDescriptionError(isEmptyDesc);
    }
    if (isEmptyDesc)
        return;
    CreateGistModel createGistModel = new CreateGistModel();
    createGistModel.setDescription(InputHelper.toString(description));
    createGistModel.setFiles(files);
    makeRestCall(RestProvider.getGistService(isEnterprise()).editGist(createGistModel, id), gistsModel -> sendToView(view -> view.onSuccessSubmission(gistsModel)), false);
}
Also used : RestProvider(com.fastaccess.provider.rest.RestProvider) CreateGistModel(com.fastaccess.data.dao.CreateGistModel) InputHelper(com.fastaccess.helper.InputHelper) FilesListModel(com.fastaccess.data.dao.FilesListModel) HashMap(java.util.HashMap) NonNull(android.support.annotation.NonNull) BasePresenter(com.fastaccess.ui.base.mvp.presenter.BasePresenter) CreateGistModel(com.fastaccess.data.dao.CreateGistModel)

Aggregations

CreateGistModel (com.fastaccess.data.dao.CreateGistModel)2 NonNull (android.support.annotation.NonNull)1 FilesListModel (com.fastaccess.data.dao.FilesListModel)1 InputHelper (com.fastaccess.helper.InputHelper)1 RestProvider (com.fastaccess.provider.rest.RestProvider)1 BasePresenter (com.fastaccess.ui.base.mvp.presenter.BasePresenter)1 HashMap (java.util.HashMap)1