Search in sources :

Example 1 with Role

use of com.eventyay.organizer.data.role.Role in project open-event-orga-app by fossasia.

the class RoleInviteViewModel method createRoleInvite.

public void createRoleInvite(long roleId) {
    long eventId = ContextManager.getSelectedEvent().getId();
    Event event = new Event();
    event.setId(eventId);
    roleInvite.setEvent(event);
    role.setId(roleId);
    roleInvite.setRole(role);
    compositeDisposable.add(roleRepository.sendRoleInvite(roleInvite).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(sentRoleInvite -> {
        success.setValue("Role Invite Sent");
        dismiss.call();
    }, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Also used : Inject(javax.inject.Inject) LiveData(androidx.lifecycle.LiveData) SingleEventLiveData(com.eventyay.organizer.common.livedata.SingleEventLiveData) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Event(com.eventyay.organizer.data.event.Event) RoleInvite(com.eventyay.organizer.data.role.RoleInvite) Role(com.eventyay.organizer.data.role.Role) ViewModel(androidx.lifecycle.ViewModel) ContextManager(com.eventyay.organizer.common.ContextManager) ErrorUtils(com.eventyay.organizer.utils.ErrorUtils) RoleRepository(com.eventyay.organizer.data.role.RoleRepository) Event(com.eventyay.organizer.data.event.Event)

Aggregations

LiveData (androidx.lifecycle.LiveData)1 ViewModel (androidx.lifecycle.ViewModel)1 ContextManager (com.eventyay.organizer.common.ContextManager)1 SingleEventLiveData (com.eventyay.organizer.common.livedata.SingleEventLiveData)1 Event (com.eventyay.organizer.data.event.Event)1 Role (com.eventyay.organizer.data.role.Role)1 RoleInvite (com.eventyay.organizer.data.role.RoleInvite)1 RoleRepository (com.eventyay.organizer.data.role.RoleRepository)1 ErrorUtils (com.eventyay.organizer.utils.ErrorUtils)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Inject (javax.inject.Inject)1