use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class ConversationClientService method closeConversation.
public String closeConversation(Integer conversationId) {
String response;
try {
if (conversationId != null) {
response = httpRequestUtils.getResponse(getConversationCloseUrl() + "?id=" + String.valueOf(conversationId), "application/json", "application/json");
if (TextUtils.isEmpty(response)) {
return null;
}
ApiResponse apiResponse = (ApiResponse) GsonUtils.getObjectFromJson(response, ApiResponse.class);
Utils.printLog(context, TAG, "Conversation close API Response :" + response);
if (apiResponse != null && apiResponse.isSuccess()) {
return apiResponse.getResponse().toString();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method blockUserProcess.
public void blockUserProcess(final String userId, final boolean block, final boolean isFromChannel) {
final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "", ApplozicService.getContext(getContext()).getString(R.string.please_wait_info), true);
UserBlockTask.TaskListener listener = new UserBlockTask.TaskListener() {
@Override
public void onSuccess(ApiResponse apiResponse) {
if (block && typingStarted) {
if (getActivity() != null) {
setToolbarSubtitle("");
}
Applozic.publishTypingStatus(getActivity(), null, contact, false);
}
menu.findItem(R.id.userBlock).setVisible(!block);
menu.findItem(R.id.userUnBlock).setVisible(block);
}
@Override
public void onFailure(ApiResponse apiResponse, Exception exception) {
String error = getString(Utils.isInternetAvailable(getActivity()) ? R.string.applozic_server_error : R.string.you_need_network_access_for_block_or_unblock);
Toast toast = Toast.makeText(getActivity(), error, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
@Override
public void onCompletion() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
if (!isFromChannel) {
contact = appContactService.getContactById(userId);
}
}
};
AlTask.execute(new UserBlockTask(getActivity(), listener, userId, block));
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method umuteGroupChat.
public void umuteGroupChat() {
Date date = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime();
millisecond = date.getTime();
final MuteNotificationAsync.TaskListener taskListener = new MuteNotificationAsync.TaskListener() {
@Override
public void onSuccess(ApiResponse apiResponse) {
if (menu != null) {
menu.findItem(R.id.unmuteGroup).setVisible(false);
menu.findItem(R.id.muteGroup).setVisible(true);
}
}
@Override
public void onFailure(ApiResponse apiResponse, Exception exception) {
}
@Override
public void onCompletion() {
}
};
muteNotificationRequest = new MuteNotificationRequest(channel.getKey(), millisecond);
MuteNotificationAsync muteNotificationAsync = new MuteNotificationAsync(getContext(), taskListener, muteNotificationRequest);
AlTask.execute(muteNotificationAsync);
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class UserService method updateDisplayNameORImageLink.
public String updateDisplayNameORImageLink(String displayName, String profileImageLink, String localURL, String status, String contactNumber) {
ApiResponse response = userClientService.updateDisplayNameORImageLink(displayName, profileImageLink, status, contactNumber);
if (response == null) {
return null;
}
if (response != null && response.isSuccess()) {
Contact contact = baseContactService.getContactById(MobiComUserPreference.getInstance(context).getUserId());
if (!TextUtils.isEmpty(displayName)) {
contact.setFullName(displayName);
}
if (!TextUtils.isEmpty(profileImageLink)) {
contact.setImageURL(profileImageLink);
}
contact.setLocalImageUrl(localURL);
if (!TextUtils.isEmpty(status)) {
contact.setStatus(status);
}
if (!TextUtils.isEmpty(contactNumber)) {
contact.setContactNumber(contactNumber);
}
baseContactService.upsert(contact);
Contact contact1 = baseContactService.getContactById(MobiComUserPreference.getInstance(context).getUserId());
Utils.printLog(context, "UserService", contact1.getImageURL() + ", " + contact1.getDisplayName() + "," + contact1.getStatus() + "," + contact1.getStatus());
}
return response.getStatus();
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelClientService method deleteChannel.
public synchronized ApiResponse deleteChannel(Integer channelKey) {
try {
if (channelKey != null) {
String url = getChannelDeleteUrl() + "?" + GROUP_ID + "=" + URLEncoder.encode(String.valueOf(channelKey), "UTF-8");
String response = httpRequestUtils.getResponse(url, "application/json", "application/json");
ApiResponse apiResponse = (ApiResponse) GsonUtils.getObjectFromJson(response, ApiResponse.class);
if (apiResponse != null) {
Utils.printLog(context, TAG, "Channel delete call response: " + apiResponse.getStatus());
}
return apiResponse;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Aggregations