use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelClientService method muteNotification.
/**
* Send a mute notification request for a channel to the server.
*
* <p>Request parameters can be passed inside the {@link MuteNotificationRequest} object.
* Pass non-null/non-zero values for either {@link MuteNotificationRequest#setClientGroupId(String)}
* or {@link MuteNotificationRequest#setId(Integer)}.
* See {@link MuteNotificationRequest} for more details.</p>
*
* @param muteNotificationRequest the mute notification parameter object
* @return the {@link ApiResponse} for the request
*/
public ApiResponse muteNotification(@NonNull MuteNotificationRequest muteNotificationRequest) {
ApiResponse apiResponse = null;
try {
if (muteNotificationRequest.isRequestValid()) {
String requestJson = GsonUtils.getJsonFromObject(muteNotificationRequest, MuteNotificationRequest.class);
String response = httpRequestUtils.postData(getMuteChannelUrl(), "application/json", "application/json", requestJson);
apiResponse = (ApiResponse) GsonUtils.getObjectFromJson(response, ApiResponse.class);
if (apiResponse != null) {
Utils.printLog(context, TAG, "Mute notification response: " + apiResponse.getStatus());
}
}
} catch (Exception e) {
e.printStackTrace();
}
return apiResponse;
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelService method addMemberToChannelWithResponseProcess.
/**
* Adds a given user to a channel.
*
* <p>Data for this addition is updated both remotely and locally.</p>
*
* @param channelKey the channel key (to identify the channel)
* @param userId the id of the user to add to the channel
* @return the {@link ApiResponse} for the request
*/
@Nullable
public ApiResponse addMemberToChannelWithResponseProcess(@Nullable Integer channelKey, @Nullable String userId) {
if (channelKey == null && TextUtils.isEmpty(userId)) {
return null;
}
ApiResponse apiResponse = channelClientService.addMemberToChannel(channelKey, userId);
if (apiResponse == null) {
return null;
}
if (apiResponse.isSuccess()) {
ChannelUserMapper channelUserMapper = new ChannelUserMapper(channelKey, userId);
channelDatabaseService.addChannelUserMapper(channelUserMapper);
}
return apiResponse;
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelService method deleteChannel.
// deprecated >>>
/**
* @deprecated Use {@link #processChannelDeleteConversation(Channel, Context)} instead.
*
* @param channelKey the channel key
* @param updateClientGroupId pass true if you want the client group id to be updated
* @param resetCount pass true if you want to reset the unread count for the channel
* @return success (ignore case) or failure (ignore case)
*/
@Deprecated
public String deleteChannel(Integer channelKey, boolean updateClientGroupId, boolean resetCount) {
ApiResponse apiResponse = channelClientService.deleteChannel(channelKey, updateClientGroupId, resetCount);
if (apiResponse != null && apiResponse.isSuccess()) {
channelDatabaseService.deleteChannel(channelKey);
channelDatabaseService.deleteChannelUserMappers(channelKey);
BroadcastService.sendConversationDeleteBroadcast(context, BroadcastService.INTENT_ACTIONS.DELETE_CONVERSATION.toString(), null, channelKey, apiResponse.getStatus());
return apiResponse.getStatus();
} else {
return null;
}
}
use of com.applozic.mobicomkit.feed.ApiResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelService method addMemberToChannelProcess.
/**
* @deprecated Use {@link #addMemberToChannelWithResponseProcess(Integer, String)} instead.
*/
@Deprecated
public String addMemberToChannelProcess(Integer channelKey, String userId) {
if (channelKey == null && TextUtils.isEmpty(userId)) {
return "";
}
ApiResponse apiResponse = channelClientService.addMemberToChannel(channelKey, userId);
if (apiResponse == null) {
return null;
}
if (apiResponse.isSuccess()) {
ChannelUserMapper channelUserMapper = new ChannelUserMapper(channelKey, userId);
channelDatabaseService.addChannelUserMapper(channelUserMapper);
}
return apiResponse.getStatus();
}
Aggregations