Search in sources :

Example 1 with AddParticipantOverall

use of com.nextcloud.talk.models.json.participants.AddParticipantOverall in project talk-android by nextcloud.

the class OperationsMenuController method inviteUsersToAConversation.

private void inviteUsersToAConversation() {
    RetrofitBucket retrofitBucket;
    final ArrayList<String> localInvitedUsers = invitedUsers;
    if (localInvitedUsers.size() > 0) {
        for (int i = 0; i < invitedUsers.size(); i++) {
            final String userId = invitedUsers.get(i);
            retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(userEntity.getBaseUrl(), room.getToken(), userId);
            ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<AddParticipantOverall>() {

                @Override
                public void onSubscribe(Disposable d) {
                }

                @Override
                public void onNext(AddParticipantOverall addParticipantOverall) {
                }

                @Override
                public void onError(Throwable e) {
                    dispose();
                }

                @Override
                public void onComplete() {
                    synchronized (localInvitedUsers) {
                        localInvitedUsers.remove(userId);
                    }
                    if (localInvitedUsers.size() == 0) {
                        initiateCall();
                    }
                    dispose();
                }
            });
        }
    } else {
        showResultImage(true, false);
    }
}
Also used : Disposable(io.reactivex.disposables.Disposable) RetrofitBucket(com.nextcloud.talk.models.RetrofitBucket) AddParticipantOverall(com.nextcloud.talk.models.json.participants.AddParticipantOverall)

Aggregations

RetrofitBucket (com.nextcloud.talk.models.RetrofitBucket)1 AddParticipantOverall (com.nextcloud.talk.models.json.participants.AddParticipantOverall)1 Disposable (io.reactivex.disposables.Disposable)1