Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2.10.2 SDK and 2.10.3 UI #557

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/assets/applozic-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"restrictedWordMessage": " Please don't use restricted word",
"restrictedWordRegex": "",
"hideAttachmentButton": false,
"hideChatBarWithBots": false,
"groupUsersOnlineStatus": false,
"launchChatFromProfilePicOrName": false,
"enableShareConversation": false,
Expand Down
2 changes: 1 addition & 1 deletion kommunicate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdkVersion 17
targetSdkVersion 34
versionCode 1
versionName "2.10.1"
versionName "2.10.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "CHAT_SERVER_URL", '"https://chat.kommunicate.io"'
buildConfigField "String", "API_SERVER_URL", '"https://api.kommunicate.io"'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.applozic.mobicomkit;

import static io.kommunicate.utils.KmConstants.KM_USER_LANGUAGE_CODE;
import static io.kommunicate.utils.KmConstants.KM_USER_LOCALE;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -74,7 +74,7 @@ public static void setDefaultLanguage(Context context){
}
AlPrefSettings.getInstance(context).setDeviceDefaultLanguageToBot(deviceLanguage);
Map<String, String> localeMetadata = new HashMap<>();
localeMetadata.put(KM_USER_LANGUAGE_CODE,deviceLanguage);
localeMetadata.put(KM_USER_LOCALE,deviceLanguage);
KmSettings.updateChatContext(context,localeMetadata);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,15 @@ public enum RoleType {
public Short getValue() {
return value;
}

public static RoleType fromValue(Short value) {
for (RoleType roleType : RoleType.values()) {
if (roleType.getValue().equals(value)) {
return roleType;
}
}
return null;
}
}

public enum PushNotificationFormat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class MessageDatabaseService {
private static final String channelKey_AND= "channelKey = ? AND ";
private static final String contactNumbers_AND = "contactNumbers = ? AND ";
private static final String createdAt_AND = "createdAt >= ? AND ";
private static final String createdAt_AND_No_null = "createdAt < ? AND ";
private static final String conversationID_AND = "conversationId = ? AND ";
private static final String deleted_AND = "deleted = ? AND ";
private static final String reply_AND = "replyMessage != ? AND ";
Expand Down Expand Up @@ -262,7 +263,7 @@ public List<Message> getMessages(Long startTime, Long endTime, Contact contact,
structuredNameParamsList.add(String.valueOf(startTime));
}
if (endTime != null) {
structuredNameWhere += createdAt_AND;
structuredNameWhere += createdAt_AND_No_null;
structuredNameParamsList.add(String.valueOf(endTime));
}
if (BroadcastService.isContextBasedChatEnabled() && conversationId != null && conversationId != 0) {
Expand Down
2 changes: 1 addition & 1 deletion kommunicateui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdkVersion 17
targetSdkVersion 34
versionCode 1
versionName "2.10.2"
versionName "2.10.3"
consumerProguardFiles 'proguard-rules.txt'
vectorDrawables.useSupportLibrary = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ public class AlCustomizationSettings extends JsonMarker {
private int minimumCompressionThresholdForImagesInMB = 5;
private boolean isVideoCompressionEnabled = false;
private int minimumCompressionThresholdForVideosInMB = 5;

private boolean hideAttachmentOptionsWithBots = false;
private boolean hideChatBarWithBots = false;

public boolean getUseDarkMode() {
return useDarkMode;
}

private boolean hideAttachmentOptionsWithBots = false;

public String getStaticTopMessage() {
return staticTopMessage;
Expand Down Expand Up @@ -832,10 +832,14 @@ public int getMinimumCompressionThresholdForVideosInMB() {
return minimumCompressionThresholdForVideosInMB;
}

public boolean getHideAttachmentOptionsWithBots() {
public boolean isHideAttachmentOptionsWithBots() {
return hideAttachmentOptionsWithBots;
}

public boolean isHideChatBarWithBots() {
return hideChatBarWithBots;
}

@Override
public String toString() {
return "AlCustomizationSettings{" +
Expand Down Expand Up @@ -901,6 +905,7 @@ public String toString() {
", toolbarSubtitleColor=" + toolbarSubtitleColor +
", useDeviceDefaultLanguage=" + useDeviceDefaultLanguage +
", showTypingIndicatorWhileFetchingResponse=" + showTypingIndicatorWhileFetchingResponse +
", hideChatBarWithBots=" + hideChatBarWithBots +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public abstract class MobiComConversationFragment extends Fragment implements Vi
protected Spinner sendType;
protected LinearLayout individualMessageSendLayout, mainEditTextLinearLayout;
protected LinearLayout extendedSendingOptionLayout, attachmentIconLayout;
protected LinearLayout kmMessageLinearLayout;
protected RelativeLayout attachmentLayout;
protected ProgressBar mediaUploadProgressBar;
protected View spinnerLayout;
Expand Down Expand Up @@ -600,6 +601,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
messageList = new ArrayList<Message>();
multimediaPopupGrid = (GridView) list.findViewById(R.id.mobicom_multimedia_options1);
textViewCharLimitMessage = list.findViewById(R.id.botCharLimitTextView);
kmMessageLinearLayout = list.findViewById(R.id.km_message_linear_layout);
loggedInUserRole = MobiComUserPreference.getInstance(ApplozicService.getContext(getContext())).getUserRoleType();

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Expand Down Expand Up @@ -1108,10 +1110,11 @@ public void onFailure(Context context, String error) {

emoticonsBtn.setVisibility(View.GONE);

boolean hideAttachmentOptionsWithBots = alCustomizationSettings.getHideAttachmentOptionsWithBots();
boolean hideAttachmentOptionsWithBots = alCustomizationSettings.isHideAttachmentOptionsWithBots();
if (hideAttachmentOptionsWithBots) {
attachmentIconLayout.setVisibility(GONE);
}
toggleHideChatBarWithBots();

if (alCustomizationSettings.getAttachmentOptions() != null && !alCustomizationSettings.getAttachmentOptions().isEmpty()) {
Map<String, Boolean> attachmentOptions = alCustomizationSettings.getAttachmentOptions();
Expand Down Expand Up @@ -2140,6 +2143,7 @@ public void loadConversation(final Contact contact, final Channel channel, final
} else {
userNotAbleToChatLayout.setVisibility(View.GONE);
toggleMessageSendLayoutVisibility();
toggleHideChatBarWithBots();
toggleAttachmentLayoutVisibility();
}
}
Expand Down Expand Up @@ -4562,12 +4566,26 @@ private void checkForCustomInput() {
}

private void toggleAttachmentLayoutVisibility() {
if (alCustomizationSettings.getHideAttachmentOptionsWithBots() && attachmentIconLayout != null) {
Contact assigneeContact = appContactService.getContactById(channel.getConversationAssignee());
boolean isBotAssignee = User.RoleType.BOT.getValue().equals(assigneeContact.getRoleType());
if (alCustomizationSettings.isHideAttachmentOptionsWithBots() && attachmentIconLayout != null) {
attachmentIconLayout.setVisibility(
getCurrentConversationAssignee() == User.RoleType.BOT
? GONE : VISIBLE
);
}
}

attachmentIconLayout.setVisibility(isBotAssignee ? GONE : VISIBLE);
private void toggleHideChatBarWithBots() {
if (!alCustomizationSettings.isHideChatBarWithBots() || kmMessageLinearLayout == null) {
return;
}
kmMessageLinearLayout.setVisibility(
getCurrentConversationAssignee() == User.RoleType.BOT ? GONE : VISIBLE
);
}

private User.RoleType getCurrentConversationAssignee() {
Contact assigneeContact = appContactService.getContactById(channel.getConversationAssignee());
return User.RoleType.fromValue(assigneeContact.getRoleType());
}

private void updateUserFromCustomInput(String message) {
Expand Down Expand Up @@ -5070,6 +5088,7 @@ public void onFailure(Context context, Exception e, String response) {
} else {
kmFeedbackView.setVisibility(View.GONE);
toggleMessageSendLayoutVisibility();
toggleHideChatBarWithBots();
toggleAttachmentLayoutVisibility();
mainDivider.setVisibility(VISIBLE);
}
Expand Down Expand Up @@ -5547,6 +5566,7 @@ public void onFailure(Context context, Exception e, String response) {
}

toggleMessageSendLayoutVisibility();
toggleHideChatBarWithBots();
toggleAttachmentLayoutVisibility();
}

Expand Down