Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,22 @@ private void onSubmit(BaseActionElement actionElement, RenderedAdaptiveCard rend
Map<String, String> keyValueMap = renderedAdaptiveCard.getInputs();
if (!data.isEmpty())
{
try {
JSONObject object = new JSONObject(data);
try
{
JSONObject object = null;
if (!data.equals("null\n"))
{
object = new JSONObject(data);
}
else
{
object = new JSONObject();
}

showToast("Submit data: " + object.toString() + "\nInput: " + keyValueMap.toString(), Toast.LENGTH_LONG);
} catch (JSONException e) {
}
catch (JSONException e)
{
showToast(e.toString(), Toast.LENGTH_LONG);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,22 +263,36 @@ public void run()
this.runOnUiThread(new RunnableExtended(this, text, duration));
}

private void onSubmit(BaseActionElement actionElement, RenderedAdaptiveCard renderedAdaptiveCard) {
private void onSubmit(BaseActionElement actionElement, RenderedAdaptiveCard renderedAdaptiveCard)
{
SubmitAction submitAction = null;
if (actionElement instanceof SubmitAction) {
if (actionElement instanceof SubmitAction)
{
submitAction = (SubmitAction) actionElement;
} else if ((submitAction = SubmitAction.dynamic_cast(actionElement)) == null) {
}
else if ((submitAction = SubmitAction.dynamic_cast(actionElement)) == null)
{
throw new InternalError("Unable to convert BaseActionElement to ShowCardAction object model.");
}

String data = submitAction.GetDataJson();
Map<String, String> keyValueMap = renderedAdaptiveCard.getInputs();
if (!data.isEmpty())
{
try {
JSONObject object = new JSONObject(data);
try
{
JSONObject object = null;
if (!data.equals("null\n"))

@RebeccaAnne RebeccaAnne Jul 12, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null\n [](start = 34, length = 6)

Where is this string coming from? Is getting this string the expected behavior or should the shared model be doing something better? If we have to do this, third parties would too, and it seems like a bad experience.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that string is coming from the shared model

{
object = new JSONObject(data);
}
else
{
object = new JSONObject();
}
showToast("Submit data: " + object.toString() + "\nInput: " + keyValueMap.toString(), Toast.LENGTH_LONG);
} catch (JSONException e) {
}
catch (JSONException e) {
showToast(e.toString(), Toast.LENGTH_LONG);
}
}
Expand Down