Search in sources :

Example 6 with PodThreadManager

use of com.fanap.podchat.util.PodThreadManager in project pod-chat-android-sdk by FanapSoft.

the class Generator method generateFakeContact.

public static void generateFakeContact(int count, Context context) {
    new PodThreadManager().doThisAndGo(() -> {
        Faker faker = new Faker();
        ArrayList<ContentProviderOperation> ops = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            String DisplayName = faker.artist().name();
            String MobileNumber = faker.phoneNumber().cellPhone();
            String HomeNumber = faker.phoneNumber().phoneNumber();
            String WorkNumber = faker.phoneNumber().phoneNumber();
            String emailID = null;
            String company = faker.company().name();
            String jobTitle = faker.company().bs();
            ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI).withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null).withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null).build());
            // ------------------------------------------------------ Names
            if (DisplayName != null) {
                ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0).withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, DisplayName).build());
            }
            // ------------------------------------------------------ Mobile Number
            if (MobileNumber != null) {
                ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0).withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, MobileNumber).withValue(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE).build());
            }
            // ------------------------------------------------------ Home Numbers
            if (HomeNumber != null) {
                ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0).withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, HomeNumber).withValue(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_HOME).build());
            }
            // ------------------------------------------------------ Work Numbers
            if (WorkNumber != null) {
                ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0).withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, WorkNumber).withValue(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_WORK).build());
            }
            // ------------------------------------------------------ Email
            if (emailID != null) {
                ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0).withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.Email.DATA, emailID).withValue(ContactsContract.CommonDataKinds.Email.TYPE, ContactsContract.CommonDataKinds.Email.TYPE_WORK).build());
            }
            // ------------------------------------------------------ Organization
            if (!company.equals("") && !jobTitle.equals("")) {
                ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0).withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, company).withValue(ContactsContract.CommonDataKinds.Organization.TYPE, ContactsContract.CommonDataKinds.Organization.TYPE_WORK).withValue(ContactsContract.CommonDataKinds.Organization.TITLE, jobTitle).withValue(ContactsContract.CommonDataKinds.Organization.TYPE, ContactsContract.CommonDataKinds.Organization.TYPE_WORK).build());
            }
            try {
                // Asking the Contact provider to create a new contact
                context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
            } catch (Exception e) {
                e.printStackTrace();
                Log.e("MTAG", "Exception Generating Contact " + e.getMessage());
            }
        }
        Log.e("MTAG", "Generator added " + ops.size() + " Contact");
    });
}
Also used : ContentProviderOperation(android.content.ContentProviderOperation) PodThreadManager(com.fanap.podchat.util.PodThreadManager) Faker(com.github.javafaker.Faker) ArrayList(java.util.ArrayList)

Example 7 with PodThreadManager

use of com.fanap.podchat.util.PodThreadManager in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method getThreadAdminsMain.

private String getThreadAdminsMain(int count, int offset, long threadId, String typeCode, boolean useCache, ChatHandler handler) {
    String uniqueId = generateUniqueId();
    final int mCount = count != 0 ? count : 50;
    PodThreadManager podThreadManager = new PodThreadManager();
    podThreadManager.addTask(() -> {
        if (cache && useCache) {
            loadAdminsFromCache(uniqueId, mCount, offset, threadId);
        }
    });
    podThreadManager.addTask(() -> {
        if (chatReady) {
            JsonObject content = new JsonObject();
            content.addProperty("count", mCount);
            content.addProperty("offset", offset);
            content.addProperty("admin", true);
            AsyncMessage chatMessage = new AsyncMessage();
            chatMessage.setContent(content.toString());
            chatMessage.setType(Constants.THREAD_PARTICIPANTS);
            chatMessage.setTokenIssuer(String.valueOf(TOKEN_ISSUER));
            chatMessage.setToken(getToken());
            chatMessage.setUniqueId(uniqueId);
            chatMessage.setSubjectId(threadId);
            chatMessage.setTypeCode(typeCode != null ? typeCode : getTypeCode());
            JsonObject jsonObject = (JsonObject) gson.toJsonTree(chatMessage);
            String asyncContent = jsonObject.toString();
            setCallBacks(null, null, null, true, Constants.THREAD_PARTICIPANTS, (long) offset, uniqueId);
            sendAsyncMessage(asyncContent, AsyncAckType.Constants.WITHOUT_ACK, "SEND_GET_THREAD_ADMINS");
            if (handler != null) {
                handler.onGetThreadParticipant(uniqueId);
            }
        } else {
            captureError(ChatConstant.ERROR_CHAT_READY, ChatConstant.ERROR_CODE_CHAT_READY, uniqueId);
        }
    });
    podThreadManager.runTasksSynced();
    return uniqueId;
}
Also used : PodThreadManager(com.fanap.podchat.util.PodThreadManager) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Example 8 with PodThreadManager

use of com.fanap.podchat.util.PodThreadManager in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method addContacts.

/**
 * Add list of contacts with their mobile numbers and their cellphoneNumbers
 */
private void addContacts(List<PhoneContact> phoneContacts, String uniqueId) {
    ArrayList<String> firstNames = new ArrayList<>();
    ArrayList<String> cellphoneNumbers = new ArrayList<>();
    ArrayList<String> lastNames = new ArrayList<>();
    ArrayList<String> typeCodes = new ArrayList<>();
    ArrayList<String> uniqueIds = new ArrayList<>();
    ArrayList<String> emails = new ArrayList<>();
    for (PhoneContact contact : phoneContacts) {
        firstNames.add(contact.getName());
        lastNames.add(contact.getLastName());
        uniqueIds.add(generateUniqueId());
        String phoneNum = String.valueOf(contact.getPhoneNumber());
        if (phoneNum.startsWith("9")) {
            phoneNum = phoneNum.replaceFirst("9", "09");
        }
        cellphoneNumbers.add(phoneNum);
        emails.add("");
        typeCodes.add(getTypeCode());
    }
    Observable<Response<Contacts>> addContactsObservable;
    if (getPlatformHost() != null) {
        if (!Util.isNullOrEmpty(getTypeCode())) {
            addContactsObservable = contactApi.addContacts(getToken(), TOKEN_ISSUER, firstNames, lastNames, emails, uniqueIds, cellphoneNumbers, typeCodes);
        } else {
            addContactsObservable = contactApi.addContacts(getToken(), TOKEN_ISSUER, firstNames, lastNames, emails, uniqueIds, cellphoneNumbers);
        }
        showLog("Call add contacts " + new Date());
        addContactsObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(contactsResponse -> {
            showLog(">>> Server Respond " + new Date());
            boolean error = false;
            if (contactsResponse.body() != null) {
                error = contactsResponse.body().getHasError();
                showLog(">>>Response: " + contactsResponse.code());
                showLog(">>>ReferenceNumber: " + contactsResponse.body().getReferenceNumber());
                showLog(">>>Ott: " + contactsResponse.body().getOtt());
            }
            if (contactsResponse.isSuccessful()) {
                if (error) {
                    captureError(contactsResponse.body().getMessage(), contactsResponse.body().getErrorCode(), uniqueId);
                    showLog("Error add Contacts: " + contactsResponse.body().getMessage());
                } else {
                    // successful response
                    Contacts contacts = contactsResponse.body();
                    ChatResponse<Contacts> chatResponse = new ChatResponse<>();
                    chatResponse.setResult(contacts);
                    chatResponse.setUniqueId(uniqueId);
                    Runnable updatePhoneContactsDBTask = () -> {
                        try {
                            boolean result = phoneContactDbHelper.addPhoneContacts(phoneContacts);
                            if (!result) {
                                disableCache(() -> phoneContactDbHelper.addPhoneContacts(phoneContacts));
                            }
                        } catch (Exception e) {
                            showErrorLog("Updating Contacts cache failed: " + e.getMessage());
                            onUnknownException(uniqueId, e);
                        }
                    };
                    Runnable updateCachedContactsTask = () -> {
                        if (cache) {
                            try {
                                // messageDatabaseHelper.saveContacts(chatResponse.getResult().getResult(), getExpireAmount());
                                dataSource.saveContactsResultFromServer(chatResponse.getResult().getResult());
                            } catch (Exception e) {
                                showErrorLog("Saving Contacts Failed: " + e.getMessage());
                                onUnknownException(uniqueId, e);
                            }
                        }
                    };
                    new PodThreadManager().addNewTask(updatePhoneContactsDBTask).addNewTask(updateCachedContactsTask).runTasksSynced();
                    String contactsJson = gson.toJson(chatResponse);
                    listenerManager.callOnSyncContact(contactsJson, chatResponse);
                    showLog("SYNC_CONTACT_COMPLETED", contactsJson);
                }
            } else {
                captureError(contactsResponse.message(), contactsResponse.code(), uniqueId);
                showLog("Error add Contacts: " + contactsResponse.raw());
            }
        }, throwable -> captureError(throwable.getMessage(), ChatConstant.ERROR_CODE_UNKNOWN_EXCEPTION, uniqueId));
    }
}
Also used : PhoneContact(com.fanap.podchat.cachemodel.PhoneContact) PodThreadManager(com.fanap.podchat.util.PodThreadManager) ArrayList(java.util.ArrayList) Date(java.util.Date) JSONException(org.json.JSONException) SentryException(io.sentry.core.protocol.SentryException) IOException(java.io.IOException) JsonSyntaxException(com.google.gson.JsonSyntaxException) PodChatException(com.fanap.podchat.util.PodChatException) RoomIntegrityException(com.fanap.podchat.persistance.RoomIntegrityException) ChatResponse(com.fanap.podchat.model.ChatResponse) Response(retrofit2.Response) Contacts(com.fanap.podchat.model.Contacts) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 9 with PodThreadManager

use of com.fanap.podchat.util.PodThreadManager in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method findAndUpdateGaps.

private void findAndUpdateGaps(List<MessageVO> newMessagesFromServer, long threadId) {
    Runnable jobFindAndInsertGap = () -> {
        if (newMessagesFromServer.size() == 0)
            return;
        MessageVO lastMessage = newMessagesFromServer.get(newMessagesFromServer.size() - 1);
        if (lastMessage.getPreviousId() == 0)
            return;
        List<CacheMessageVO> messages = messageDatabaseHelper.getMessageById(lastMessage.getPreviousId());
        if (Util.isNullOrEmpty(messages)) {
            GapMessageVO gapMessageVO = new GapMessageVO();
            gapMessageVO.setId(lastMessage.getId());
            gapMessageVO.setPreviousId(lastMessage.getPreviousId());
            gapMessageVO.setThreadId(threadId);
            gapMessageVO.setTime(lastMessage.getTime());
            gapMessageVO.setUniqueId(lastMessage.getUniqueId());
            messageDatabaseHelper.insertGap(gapMessageVO);
            lastMessage.setHasGap(true);
            dataSource.updateMessage(lastMessage, threadId);
        // messageDatabaseHelper.updateMessage(lastMessage, threadId);
        }
    };
    Runnable jobUpdateGaps = () -> {
        List<GapMessageVO> gaps = messageDatabaseHelper.getAllGaps(threadId);
        if (!Util.isNullOrEmpty(gaps)) {
            Map<Long, Long> msgIdAndPreviousId = new HashMap<>();
            for (GapMessageVO gapMessage : gaps) {
                msgIdAndPreviousId.put(gapMessage.getPreviousId(), gapMessage.getId());
            }
            for (MessageVO newMessage : newMessagesFromServer) {
                if (msgIdAndPreviousId.containsKey(newMessage.getId())) {
                    // delete gap that produced by this message
                    messageDatabaseHelper.deleteGapForMessageId(msgIdAndPreviousId.get(newMessage.getId()));
                    // set message gap field to false
                    messageDatabaseHelper.updateMessageGapState(msgIdAndPreviousId.get(newMessage.getId()), false);
                }
            }
        }
    };
    PodThreadManager podThreadManager = new PodThreadManager();
    podThreadManager.addTask(jobFindAndInsertGap);
    podThreadManager.addTask(jobUpdateGaps);
    podThreadManager.runTasksSynced();
}
Also used : GapMessageVO(com.fanap.podchat.cachemodel.GapMessageVO) PodThreadManager(com.fanap.podchat.util.PodThreadManager) ResultBlockList(com.fanap.podchat.model.ResultBlockList) RequestGetMentionList(com.fanap.podchat.chat.mention.model.RequestGetMentionList) RequestDeliveredMessageList(com.fanap.podchat.requestobject.RequestDeliveredMessageList) ArrayList(java.util.ArrayList) RequestBlockList(com.fanap.podchat.requestobject.RequestBlockList) RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) RequestSeenMessageList(com.fanap.podchat.requestobject.RequestSeenMessageList) List(java.util.List) GapMessageVO(com.fanap.podchat.cachemodel.GapMessageVO) CacheMessageVO(com.fanap.podchat.cachemodel.CacheMessageVO) MessageVO(com.fanap.podchat.mainmodel.MessageVO) Map(java.util.Map) RetrofitHelperMap(com.fanap.podchat.networking.retrofithelper.RetrofitHelperMap) HashMap(java.util.HashMap) MimeTypeMap(android.webkit.MimeTypeMap)

Example 10 with PodThreadManager

use of com.fanap.podchat.util.PodThreadManager in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method searchContact.

// public String searchContact(RequestSearchContact requestSearchContact) {
// 
// String uniqueId = generateUniqueId();
// 
// Runnable cacheLoading = () -> {
// 
// if (cache && requestSearchContact.canUseCache()) {
// List<Contact> contacts = new ArrayList<>();
// if (requestSearchContact.getId() != null) {
// Contact contact = messageDatabaseHelper.getContactById(Long.parseLong(requestSearchContact.getId()));
// contacts.add(contact);
// } else if (requestSearchContact.getFirstName() != null) {
// contacts = messageDatabaseHelper.getContactsByFirst(requestSearchContact.getFirstName());
// } else if (requestSearchContact.getFirstName() != null && requestSearchContact.getLastName() != null && !requestSearchContact.getFirstName().isEmpty() && !requestSearchContact.getLastName().isEmpty()) {
// contacts = messageDatabaseHelper.getContactsByFirstAndLast(requestSearchContact.getFirstName(), requestSearchContact.getLastName());
// } else if (requestSearchContact.getEmail() != null && !requestSearchContact.getEmail().isEmpty()) {
// contacts = messageDatabaseHelper.getContactsByEmail(requestSearchContact.getEmail());
// } else if (requestSearchContact.getCellphoneNumber() != null && !requestSearchContact.getCellphoneNumber().isEmpty()) {
// contacts = messageDatabaseHelper.getContactByCell(requestSearchContact.getCellphoneNumber());
// }
// 
// ChatResponse<ResultContact> chatResponse = new ChatResponse<>();
// chatResponse.setCache(true);
// 
// ResultContact resultContact = new ResultContact();
// ArrayList<Contact> listContact = new ArrayList<>(contacts);
// resultContact.setContacts(listContact);
// chatResponse.setUniqueId(uniqueId);
// chatResponse.setHasError(false);
// chatResponse.setErrorCode(0);
// chatResponse.setErrorMessage("");
// chatResponse.setResult(resultContact);
// 
// String jsonContact = gson.toJson(chatResponse);
// listenerManager.callOnSearchContact(jsonContact, chatResponse);
// showLog("CACHE_SEARCH_CONTACT", jsonContact);
// 
// 
// }
// };
// 
// Runnable requestServer = () -> {
// if (chatReady) {
// 
// JsonObject jsonObject = (JsonObject) gson.toJsonTree(requestSearchContact);
// 
// jsonObject.addProperty("uniqueId", uniqueId);
// 
// jsonObject.addProperty("tokenIssuer", 1);
// 
// showLog("SEND_SEARCH_CONTACT", getJsonForLog(jsonObject));
// 
// 
// Observable<Response<SearchContactVO>> observable = contactApi.searchContact(
// getToken(),
// TOKEN_ISSUER,
// requestSearchContact.getId()
// , requestSearchContact.getFirstName()
// , requestSearchContact.getLastName()
// , requestSearchContact.getEmail()
// , null
// , requestSearchContact.getOffset()
// , requestSearchContact.getSize()
// , null
// , requestSearchContact.getQuery()
// , requestSearchContact.getCellphoneNumber());
// 
// observable
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(contactResponse -> {
// 
// 
// if (contactResponse.isSuccessful()) {
// 
// if (contactResponse.body() != null && contactResponse.body().getResult() != null) {
// 
// ArrayList<Contact> contacts = new ArrayList<>(contactResponse.body().getResult());
// 
// ResultContact resultContacts = new ResultContact();
// resultContacts.setContacts(contacts);
// 
// ChatResponse<ResultContact> chatResponse = new ChatResponse<>();
// chatResponse.setUniqueId(uniqueId);
// chatResponse.setResult(resultContacts);
// 
// String content = gson.toJson(chatResponse);
// 
// 
// showLog("RECEIVE_SEARCH_CONTACT", content);
// 
// listenerManager.callOnSearchContact(content, chatResponse);
// 
// }
// 
// } else {
// 
// if (contactResponse.body() != null) {
// String errorMessage = contactResponse.body().getMessage() != null ? contactResponse.body().getMessage() : "";
// int errorCode = contactResponse.body().getErrorCode() != null ? contactResponse.body().getErrorCode() : 0;
// getErrorOutPut(errorMessage, errorCode, uniqueId);
// }
// }
// 
// }, (Throwable throwable) -> Log.e(TAG, throwable.getMessage()));
// } else {
// getErrorOutPut(ChatConstant.ERROR_CHAT_READY, ChatConstant.ERROR_CODE_CHAT_READY, uniqueId);
// }
// };
// 
// 
// new PodThreadManager()
// .addNewTask(cacheLoading)
// .addNewTask(requestServer)
// .runTasksSynced();
// 
// return uniqueId;
// }
public String searchContact(RequestSearchContact requestSearchContact) {
    String uniqueId = generateUniqueId();
    String size = !Util.isNullOrEmpty(requestSearchContact.getSize()) && !requestSearchContact.getSize().equals("0") ? requestSearchContact.getSize() : "50";
    String offset = !Util.isNullOrEmpty(requestSearchContact.getOffset()) ? requestSearchContact.getOffset() : "0";
    String order = !Util.isNullOrEmpty(requestSearchContact.getOrder()) ? requestSearchContact.getOrder() : "asc";
    Runnable cacheLoading = () -> {
        if (cache && requestSearchContact.canUseCache()) {
            ChatResponse<ResultContact> chatResponse = messageDatabaseHelper.searchContacts(requestSearchContact, size, offset);
            chatResponse.setUniqueId(uniqueId);
            String jsonContact = gson.toJson(chatResponse);
            listenerManager.callOnSearchContact(jsonContact, chatResponse);
            showLog("CACHE_SEARCH_CONTACT", jsonContact);
        }
    };
    Runnable requestServer = () -> {
        if (chatReady) {
            JsonObject jObj = new JsonObject();
            String query = requestSearchContact.getQuery();
            if (Util.isNullOrEmpty(query)) {
                query = "";
                if (!Util.isNullOrEmpty(requestSearchContact.getFirstName())) {
                    query += requestSearchContact.getFirstName() + " ";
                }
                if (!Util.isNullOrEmpty(requestSearchContact.getLastName())) {
                    query += requestSearchContact.getLastName();
                }
            }
            if (!Util.isNullOrEmpty(query)) {
                jObj.addProperty("query", query);
            }
            if (!Util.isNullOrEmpty(requestSearchContact.getEmail())) {
                jObj.addProperty("email", requestSearchContact.getEmail());
            }
            if (!Util.isNullOrEmpty(requestSearchContact.getCellphoneNumber())) {
                jObj.addProperty("cellphoneNumber", requestSearchContact.getCellphoneNumber());
            }
            if (!Util.isNullOrEmpty(requestSearchContact.getId())) {
                jObj.addProperty("id", requestSearchContact.getId());
            }
            jObj.addProperty("size", size);
            jObj.addProperty("offset", offset);
            jObj.addProperty("order", order);
            AsyncMessage chatMessage = new AsyncMessage();
            chatMessage.setContent(jObj.toString());
            chatMessage.setType(Constants.GET_CONTACTS);
            chatMessage.setToken(getToken());
            chatMessage.setUniqueId(uniqueId);
            chatMessage.setTypeCode(!Util.isNullOrEmpty(typeCode) ? typeCode : getTypeCode());
            chatMessage.setTokenIssuer(String.valueOf(TOKEN_ISSUER));
            JsonObject jsonObject = (JsonObject) gson.toJsonTree(chatMessage);
            String asyncContent = jsonObject.toString();
            setCallBacks(null, null, null, true, Constants.GET_CONTACTS, Long.valueOf(offset), uniqueId);
            handlerSend.put(uniqueId, new ChatHandler() {

                @Override
                public void onGetContact(String contactJson, ChatResponse<ResultContact> chatResponse) {
                    super.onGetContact(contactJson, chatResponse);
                    showLog("RECEIVE_SEARCH_CONTACT", contactJson);
                    listenerManager.callOnSearchContact(contactJson, chatResponse);
                    handlerSend.remove(uniqueId);
                }
            });
            sendAsyncMessage(asyncContent, AsyncAckType.Constants.WITHOUT_ACK, "SEND_SEARCH_CONTACT");
        } else {
            captureError(ChatConstant.ERROR_CHAT_READY, ChatConstant.ERROR_CODE_CHAT_READY, uniqueId);
        }
    };
    new PodThreadManager().addNewTask(cacheLoading).addNewTask(requestServer).runTasksSynced();
    return uniqueId;
}
Also used : PodThreadManager(com.fanap.podchat.util.PodThreadManager) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) ChatResponse(com.fanap.podchat.model.ChatResponse) JsonObject(com.google.gson.JsonObject)

Aggregations

PodThreadManager (com.fanap.podchat.util.PodThreadManager)13 ChatResponse (com.fanap.podchat.model.ChatResponse)5 RoomIntegrityException (com.fanap.podchat.persistance.RoomIntegrityException)5 PodChatException (com.fanap.podchat.util.PodChatException)5 JsonObject (com.google.gson.JsonObject)5 JsonSyntaxException (com.google.gson.JsonSyntaxException)5 SentryException (io.sentry.core.protocol.SentryException)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 JSONException (org.json.JSONException)5 AsyncMessage (com.fanap.podchat.mainmodel.AsyncMessage)3 ResultBlockList (com.fanap.podchat.model.ResultBlockList)3 PhoneContact (com.fanap.podchat.cachemodel.PhoneContact)2 RequestGetHashTagList (com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList)2 RequestGetMentionList (com.fanap.podchat.chat.mention.model.RequestGetMentionList)2 ChatMessage (com.fanap.podchat.mainmodel.ChatMessage)2 UserInfo (com.fanap.podchat.mainmodel.UserInfo)2 Contacts (com.fanap.podchat.model.Contacts)2 ResultUserInfo (com.fanap.podchat.model.ResultUserInfo)2 RequestBlockList (com.fanap.podchat.requestobject.RequestBlockList)2