public Map<String, String> getMessageTemplates() { return (Map<String, String>) GsonUtils.getObjectFromJson(sharedPreferences.getString(CUSTOM_MESSAGE_TEMPLATE, null), Map.class); }
public ChannelFeedApiResponse createChannelWithReponse(ChannelInfo channelInfo) throws Exception { String jsonFromObject = GsonUtils.getJsonFromObject(channelInfo, channelInfo.getClass()); String createChannelResponse = httpRequestUtils.postData(getCreateChannelUrl(), "application/json", "application/json", jsonFromObject); Utils.printLog(context, TAG, "Create channel Response :" + createChannelResponse); return (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, ChannelFeedApiResponse.class); }
public void addContacts(String url, ContactList contactList, boolean completed) throws Exception { String requestString = GsonUtils .getJsonWithExposeFromObject(contactList, ContactList.class); if (completed) { url = url + "?completed=true"; } httpRequestUtils.postData(url, "application/json", null, requestString); } }
public String getJson() { return GsonUtils.getJsonFromObject(this, TopicDetail.class); }
public ApplozicClient setMessageTemplates(Map<String, String> messageTemplates) { sharedPreferences.edit().putString(CUSTOM_MESSAGE_TEMPLATE, GsonUtils.getJsonFromObject(messageTemplates, Map.class)).commit(); return this; }
public String[] getConnectedUsers() { try { String response = getMessages(null, null, null, null, null); if (response == null || TextUtils.isEmpty(response) || response.equals("UnAuthorized Access") || !response.contains("{")) { return null; } JsonParser parser = new JsonParser(); String element = parser.parse(response).getAsJsonObject().get("connectedUsers").toString(); return (String[]) GsonUtils.getObjectFromJson(element, String[].class); } catch (Exception e) { e.printStackTrace(); } return null; }
private void setupRichMessage() { ALRichMessageModel model = (ALRichMessageModel) GsonUtils.getObjectFromJson(GsonUtils.getJsonFromObject(message.getMetadata(), Map.class), ALRichMessageModel.class); listItemLayout = containerView.findViewById(R.id.listItemLayout); if (model.getTemplateId() == 8) { listItemLayout.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); setupListItemView(listItemLayout, model); } else { listItemLayout.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(layoutManager); ALRichMessageAdapter adapter = new ALRichMessageAdapter(context, model, listener, message); recyclerView.setAdapter(adapter); } }
public void sendMessage(Message message, final MediaUploadProgressHandler progressHandler, Class messageIntentClass) { Intent intent = new Intent(context, messageIntentClass); intent.putExtra(MobiComKitConstants.MESSAGE_JSON_INTENT, GsonUtils.getJsonFromObject(message, Message.class)); Handler handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(android.os.Message message) { handleState(message, progressHandler); return true; } }); MessageIntentService.enqueueWork(context, intent, handler); }
/** * Convenience method for enqueuing work in to this service. */ static public void enqueueWork(Context context, Intent work, Handler handler) { enqueueWork(context, MessageIntentService.class, JOB_ID, work); if (work != null) { final Message message = (Message) GsonUtils.getObjectFromJson(work.getStringExtra(MobiComKitConstants.MESSAGE_JSON_INTENT), Message.class); if (uploadQueueMap != null && handler != null) { uploadQueueMap.put(message.getCreatedAtTime(), handler); } } }
public ChannelFeedApiResponse createChannelWithResponse(ChannelInfo channelInfo) { try { String jsonFromObject = GsonUtils.getJsonFromObject(channelInfo, channelInfo.getClass ()); String createChannelResponse = httpRequestUtils.postData(getCreateChannelUrl(), "application/json", "application/json", jsonFromObject); Utils.printLog(context, TAG, "Create channel Response :" + createChannelResponse); if (TextUtils.isEmpty(createChannelResponse)) { return null; } return (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, ChannelFeedApiResponse.class); } catch (Exception e) { e.printStackTrace(); } return null; }
public void sendMessage(Message message, Class messageIntentClass) { Intent intent = new Intent(context, messageIntentClass); intent.putExtra(MobiComKitConstants.MESSAGE_JSON_INTENT, GsonUtils.getJsonFromObject(message, Message.class)); MessageIntentService.enqueueWork(context, intent, null); }
public SyncBlockUserApiResponse getSyncUserBlockList(String lastSyncTime) { try { String url = getBlockUserSyncUrl() + "?lastSyncTime=" + lastSyncTime; String response = httpRequestUtils.getResponse(url, "application/json", "application/json"); if (response == null || TextUtils.isEmpty(response) || response.equals("UnAuthorized Access")) { return null; } return (SyncBlockUserApiResponse) GsonUtils.getObjectFromJson(response, SyncBlockUserApiResponse.class); } catch (Exception e) { e.printStackTrace(); return null; } }
public ChannelFeed createConversation(Conversation conversation) { ChannelFeed channelFeed = null; try { String jsonFromObject = GsonUtils.getJsonFromObject(conversation, conversation.getClass()); String createChannelResponse = httpRequestUtils.postData(getCreateConversationUrl(), "application/json", "application/json", jsonFromObject); Utils.printLog(context,TAG, "Create Conversation reponse:" + createChannelResponse); ChannelFeedApiResponse channelFeedApiResponse = (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, ChannelFeedApiResponse.class); if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) { channelFeed = channelFeedApiResponse.getResponse(); } } catch (Exception e) { e.printStackTrace(); } return channelFeed; }
public void startContactActivityForResult(Intent intent, Message message, String messageContent, String[] userIdArray) { if (message != null) { intent.putExtra(MobiComKitPeopleActivity.FORWARD_MESSAGE, GsonUtils.getJsonFromObject(message, message.getClass())); } if (messageContent != null) { intent.putExtra(MobiComKitPeopleActivity.SHARED_TEXT, messageContent); } if (userIdArray != null) { intent.putExtra(MobiComKitPeopleActivity.USER_ID_ARRAY, userIdArray); } fragmentActivity.startActivityForResult(intent, REQUEST_CODE_CONTACT_GROUP_SELECTION); }
public MessageInfoResponse getMessageInfoList(String messageKey) { String url = getMessageInfoUrl() + "?key=" + messageKey; String response = httpRequestUtils.getResponse(url, "application/json", "application/json"); if (response == null || TextUtils.isEmpty(response) || response.equals("UnAuthorized Access")) { return null; } MessageInfoResponse messageInfoResponse = (MessageInfoResponse) GsonUtils.getObjectFromJson(response, MessageInfoResponse.class); return messageInfoResponse; }
public synchronized ApiResponse updateChannel(GroupInfoUpdate groupInfoUpdate) { ApiResponse apiResponse = null; try { if (groupInfoUpdate != null) { String channelNameUpdateJson = GsonUtils.getJsonFromObject(groupInfoUpdate, GroupInfoUpdate.class); String response = httpRequestUtils.postData(getChannelUpdateUrl(), "application/json", "application/json", channelNameUpdateJson); apiResponse = (ApiResponse) GsonUtils.getObjectFromJson(response, ApiResponse .class); if (apiResponse != null) { Utils.printLog(context, TAG, "Update Channel response: " + apiResponse .getStatus()); } } } catch (Exception e) { e.printStackTrace(); } return apiResponse; }
public String packageDetail(CustomerPackageDetail customerPackageDetail) { String response; String jsonFromObject = GsonUtils.getJsonFromObject(customerPackageDetail, CustomerPackageDetail.class); try { response = httpRequestUtils.postData(getApplicationInfoUrl(), "application/json", "application/json", jsonFromObject); return response; } catch (Exception e) { e.printStackTrace(); } return null; }
public ApiResponse userUnBlock(String userId) { String response = ""; ApiResponse apiResponse = null; try { if (!TextUtils.isEmpty(userId)) { response = httpRequestUtils.getResponse(getUnBlockUserSyncUrl() + "?userId=" + URLEncoder.encode(userId, "UTF-8"), "application/json", "application/json"); apiResponse = (ApiResponse) GsonUtils.getObjectFromJson(response, ApiResponse.class); } } catch (Exception e) { e.printStackTrace(); } return apiResponse; }
@Deprecated public ChannelFeed createChannel(ChannelInfo channelInfo) { ChannelFeed channelFeed = null; try { String jsonFromObject = GsonUtils.getJsonFromObject(channelInfo, channelInfo.getClass ()); String createChannelResponse = httpRequestUtils.postData(getCreateChannelUrl(), "application/json", "application/json", jsonFromObject); Utils.printLog(context, TAG, "Create channel Response :" + createChannelResponse); ChannelFeedApiResponse channelFeedApiResponse = (ChannelFeedApiResponse) GsonUtils .getObjectFromJson(createChannelResponse, ChannelFeedApiResponse.class); if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) { channelFeed = channelFeedApiResponse.getResponse(); } } catch (Exception e) { e.printStackTrace(); return null; } return channelFeed; }
public void updateMessageMetadata(String keyString, Map<String, String> metadata) { ContentValues values = new ContentValues(); if (isMessagePresent(keyString)) { values.put(MobiComDatabaseHelper.MESSAGE_METADATA, GsonUtils.getJsonFromObject(metadata, Map.class)); dbHelper.getWritableDatabase().update("sms", values, "keyString='" + keyString + "'", null); } dbHelper.close(); }