use of com.applozic.mobicommons.task.AlAsyncTask in project Applozic-Android-SDK by AppLozic.
the class ApplozicConversation method deleteConversation.
/**
* Delete a group (<i>channelKey</i>) or 1-to-1 conversation (<i>contact</i>) or both. Use with caution.
*
* <p>Will return true for a successful delete.</p>
*/
@NonNull
private static AlAsyncTask<Void, Boolean> deleteConversation(@NonNull Context context, @Nullable Integer channelKey, @Nullable Contact contact) {
return new AlAsyncTask<Void, Boolean>() {
@Override
protected Boolean doInBackground() {
if ((channelKey == null || channelKey == 0) && contact == null) {
return false;
}
Channel channel = (channelKey != null && channelKey != 0) ? new Channel(channelKey) : null;
String response = new MobiComConversationService(context).deleteSync(contact, channel, null);
return !TextUtils.isEmpty(response) && MobiComKitConstants.SUCCESS.equals(response);
}
};
}
Aggregations