<commit_before>package com.quickblox.sample.groupchatwebrtc.util;

import android.os.Bundle;
import android.util.Log;

import com.quickblox.auth.QBAuth;
import com.quickblox.auth.model.QBSession;
import com.quickblox.core.QBEntityCallback;
import com.quickblox.core.exception.QBResponseException;
import com.quickblox.core.request.QBPagedRequestBuilder;
import com.quickblox.sample.core.utils.SharedPrefsHelper;
import com.quickblox.sample.groupchatwebrtc.utils.QBEntityCallbackImpl;
import com.quickblox.sample.groupchatwebrtc.utils.TokenUtils;
import com.quickblox.users.QBUsers;
import com.quickblox.users.model.QBUser;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by tereha on 26.04.16.
 */
public class QBResRequestExecutor {
    private String TAG = QBResRequestExecutor.class.getSimpleName();

    public void createSession(QBEntityCallback<QBSession> callback) {
        QBAuth.createSession(callback);
    }

    public void createSessionWithUser(final QBUser qbUser, final QBEntityCallback<QBSession> callback) {
        QBAuth.createSession(qbUser, callback);
    }

    public void signUpNewUser(QBUser newQbUser, QBEntityCallback<QBUser> callback) {
        QBUsers.signUp(newQbUser, callback);
    }

    public void signInUser(final QBUser currentQbUser, final QBEntityCallback<QBUser> callback) {
        QBUsers.signIn(currentQbUser, callback);
    }

    public void deleteCurrentUser(int currentQbUserID, QBEntityCallback<Void> callback) {
        QBUsers.deleteUser(currentQbUserID, callback);
    }

    public void loadUsersByTag(final String tag, final QBEntityCallback<ArrayList<QBUser>> callback) {
        restoreOrCreateSession(new QBEntityCallbackImpl<QBSession>() {
            @Override
            public void onSuccess(QBSession result, Bundle params) {
                QBPagedRequestBuilder requestBuilder = new QBPagedRequestBuilder();
                List<String> tags = new LinkedList<>();
                tags.add(tag);

                QBUsers.getUsersByTags(tags, requestBuilder, callback);
            }
        });
    }

    public void loadUsersByIds(final Collection<Integer> usersIDs, final QBEntityCallback<ArrayList<QBUser>> callback) {
        restoreOrCreateSession(new QBEntityCallbackImpl<QBSession>() {
            @Override
            public void onSuccess(QBSession result, Bundle params) {
                QBUsers.getUsersByIDs(usersIDs, null, callback);
            }<commit_msg>add createSessionWithoutUser when signUpUser bug 231<commit_after>package com.quickblox.sample.groupchatwebrtc.util;

import android.os.Bundle;
import android.util.Log;

import com.quickblox.auth.QBAuth;
import com.quickblox.auth.model.QBSession;
import com.quickblox.core.QBEntityCallback;
import com.quickblox.core.exception.QBResponseException;
import com.quickblox.core.request.QBPagedRequestBuilder;
import com.quickblox.sample.core.utils.SharedPrefsHelper;
import com.quickblox.sample.groupchatwebrtc.utils.QBEntityCallbackImpl;
import com.quickblox.sample.groupchatwebrtc.utils.TokenUtils;
import com.quickblox.users.QBUsers;
import com.quickblox.users.model.QBUser;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by tereha on 26.04.16.
 */
public class QBResRequestExecutor {
    private String TAG = QBResRequestExecutor.class.getSimpleName();

    public void createSession(QBEntityCallback<QBSession> callback) {
        QBAuth.createSession(callback);
    }

    public void createSessionWithUser(final QBUser qbUser, final QBEntityCallback<QBSession> callback) {
        QBAuth.createSession(qbUser, callback);
    }

    public void signUpNewUser(final QBUser newQbUser, final QBEntityCallback<QBUser> callback) {
        createSessionWithoutUser(new QBEntityCallback<QBSession>() {
            @Override
            public void onSuccess(QBSession qbSession, Bundle bundle) {
                QBUsers.signUp(newQbUser, callback);
            }

            @Override
            public void onError(QBResponseException e) {
                callback.onError(e);
            }
        });
    }

    public void signInUser(final QBUser currentQbUser, final QBEntityCallback<QBUser> callback) {
        QBUsers.signIn(currentQbUser, callback);
    }

    public void deleteCurrentUser(int currentQbUserID, QBEntityCallback<Void> callback) {
        QBUsers.deleteUser(currentQbUserID, callback);
    }

    public void loadUsersByTag(final String tag, final QBEntityCallback<ArrayList<QBUser>> callback) {
        restoreOrCreateSession(new QBEntityCallbackImpl<QBSession>() {
            @Override
            public void onSuccess(QBSession result, Bundle params) {
                QBPagedRequestBuilder requestBuilder = new QBPagedRequestBuilder();
                List<String> tags = new LinkedList<>();
                tags.add(tag);

                QBUsers.getUsersByTags(tags, requestBuilder, callback);
            }
        });
    }

    public void loadUsersByIds(final Collection<Integer> usersIDs, final QBEntityCallback<ArrayList<QBUser>> callback) {
        restoreOrCreateSession(new QBEntityCallbackImpl<QBSession>() {
            @Override
            public void onSuccess(QBSession result, Bundle params) {
                QBUsers.getUsersByIDs(usersIDs, null, callback);
            }
{'fraction_non_alphanumeric': 0.08719748753002032, 'fraction_numerical': 0.0027711065952336967, 'mean_word_length': 3.5842506350550383, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1571763', 'n_tokens_mistral': 1634, 'n_tokens_neox': 1561, 'n_words': 294}