Repository navigation
[Android] Add validation for empty data in submit actions #3193
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
Changes from 1 commit
569558f
9408fc0
7fafa71
1c1c9a2
fc83a72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,22 +263,32 @@ 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 = new JSONObject(); | ||
| if (!data.equals("null\n")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that string is coming from the shared model |
||
| { | ||
| object = new JSONObject(data); | ||
| } | ||
| showToast("Submit data: " + object.toString() + "\nInput: " + keyValueMap.toString(), Toast.LENGTH_LONG); | ||
| } catch (JSONException e) { | ||
| } | ||
| catch (JSONException e) { | ||
| showToast(e.toString(), Toast.LENGTH_LONG); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.