Skip to content

Commit

Permalink
Merge pull request #444 from Kommunicate-io/CM-1705
Browse files Browse the repository at this point in the history
[CM-1705] Added hidePostCTA configuration for form action button
  • Loading branch information
pranaysaini04 authored Nov 2, 2023
2 parents b514a16 + 4a38358 commit ca4175e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
The changelog for [Kommunicate-Android-Chat-SDK](https://github.com/Kommunicate-io/Kommunicate-Android-Chat-SDK). Also see the
[releases](https://github.com/Kommunicate-io/Kommunicate-Android-Chat-SDK/releases) on Github.

## Unreleased
1) Added configuration for form submit button in hidePostCTA
## Kommunicate Android SDK 2.8.4
1) Reduce time taken for conversation creation
## Kommunicate Android SDK 2.8.3
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/assets/applozic-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
"hidePostCTA": {
"submit": false,
"link": false,
"quickReply": false
"quickReply": false,
"hidePostFormSubmit": false
},
"receiverNameTextColor": "#5C6677",
"innerTimestampDesign": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ public void createRichMessage(boolean isMessageProcessed) {
final KmFormItemAdapter formItemAdapter = new KmFormItemAdapter(context, kmRichMessageModel.getFormModelList(), message.getKeyString(), alCustomizationSettings);
alFormLayoutRecycler.setAdapter(formItemAdapter);

if (isMessageProcessed && themeHelper.hideSubmitButtonsPostCTA()) {
return;
}

List<Object> actionModelList = new ArrayList<>();

for (Object object : kmRichMessageModel.getFormModelList()) {
if (object instanceof KmFormPayloadModel) {
KmFormPayloadModel formPayloadModel = (KmFormPayloadModel) object;

if (isMessageProcessed && themeHelper.hideFormSubmitButtonsPostCTA() && KmFormPayloadModel.Type.SUBMIT.getValue().equals(formPayloadModel.getType())) {
continue;
}

if (KmFormPayloadModel.Type.SUBMIT.getValue().equals(formPayloadModel.getType()) || KmFormPayloadModel.Type.ACTION.getValue().equals(formPayloadModel.getType()) || TextUtils.isEmpty(formPayloadModel.getType())) {
actionModelList.add(formPayloadModel.getAction());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class KmThemeHelper implements KmCallback {
private static final String SUBMIT_BUTTON = "submit";
private static final String LINK_BUTTON = "link";
private static final String QUICK_REPLIES = "quickReply";
private static final String FORM_SUBMIT_BUTTON = "hidePostFormSubmit";
private static KmThemeHelper kmThemeHelper;
private final Context context;
private final KmAppSettingPreferences appSettingPreferences;
Expand Down Expand Up @@ -121,6 +122,11 @@ public boolean hideSubmitButtonsPostCTA() {
return getHidePostCTA().get(SUBMIT_BUTTON) != null ? getHidePostCTA().get(SUBMIT_BUTTON) : false;
}

@SuppressWarnings("ConstantConditions")
public boolean hideFormSubmitButtonsPostCTA() {
return getHidePostCTA().get(FORM_SUBMIT_BUTTON) != null ? getHidePostCTA().get(FORM_SUBMIT_BUTTON) : false;
}

@SuppressWarnings("ConstantConditions")
public boolean hideLinkButtonsPostCTA() {
return getHidePostCTA().get(LINK_BUTTON) != null ? getHidePostCTA().get(LINK_BUTTON) : false;
Expand Down

0 comments on commit ca4175e

Please sign in to comment.