Closed jstorq closed 3 years ago
Hello, Normally the webview is the standard one if I not mistaken. So for file upload it should be used an agent action that triggers the file picker
https://jasonelle-archive.github.io/docs/legacy/agents/ https://jasonelle-archive.github.io/docs/legacy/actions/#mediapicker
@panterozo
FWIW, I was able to replace the WebView control with the AdvancedWebView control to get this working. See https://github.com/delight-im/Android-AdvancedWebView. I had to add the dependency to the app build.gradle file, I replace WebView with AdvancedWebView in JasonViewActivity, JasonHtmlComponent, and JasonAgentService. Additionally, I had to add a snippet to the onResume method in JasonViewActivity to forward as successful activityResult on to the webview. See the backgroundWebview.onActivityResult call below on a successful intent_to_resolve.
// Intent Handler
// This part is for handling return values from external Intents triggered
// We set "intent_to_resolve" from onActivityResult() below, and then process it here.
// It's because onCall/onSuccess/onError callbacks are not yet attached when onActivityResult() is called.
// Need to wait till this point.
try {
if(intent_to_resolve != null) {
if(intent_to_resolve.has("type")){
((Launcher)getApplicationContext()).trigger(intent_to_resolve, JasonViewActivity.this);
// jsa
if (intent_to_resolve.get("type") == "success") {
backgroundWebview.onActivityResult(intent_to_resolve.getInt("name"), RESULT_OK, (Intent)intent_to_resolve.get("intent"));
}
intent_to_resolve = null;
}
}
} catch (Exception e) {
I would suggest it worth considering making this enhancement to the project. A WebView should just work to allow file uploads out-of-the-box which will make this engine much more useful. Everyone needs to be able to upload files from their device these days. I understand that this is primarily a mobile device development platform, but the ability to build applications to work via http (webview) across platforms really would benefit from this added support.
Thank you for the feedback! I hope you find this useful.
Jason
Thanks @jstorq Glad that you could solve it :) Please it would be awesome to have a PR to review 👍
Sure @clsource. I have a branch created locally for the jaselle/jasonette-android project but I need permission to push it. If you can grant me access to push the branch to the repo, I'll create a PR. Thanks.
Normally this can be easily solved by creating a fork using the fork button at github. Pushing changes in a new branch (based on develop) of your fork and then send the PR to the android jasonelle project develop branch 👍
Merged 👍 Thanks.
Please be kind. We recommend following the GNU Communications Guidelines. https://www.gnu.org/philosophy/kind-communication.html
Keep in mind not all help requests could be solved. Help requests open more than a week willbe closed to keep repository tidy. Feel free to comment on closed help requests issues if such action adds value to the conversation.
Add as much information as you can in order to understand your problem.
I am having an issue with a new android application built with Jasonelle. The $Jason is:
{"$jason":{"head":{"title":"example","actions":{"$load":{"type":"$render"}}},"body":{"background":{"action":{"type":"$default"},"type":"html","url":"https://example.com"}}}}
When I navigate to a page with a file input control, I click on it and it does nothing. Can you tell me what WebViewer control is being used for the body > background > type > html? I've seen posts that suggest using AdvancedWebView (https://stackoverflow.com/questions/5907369/file-upload-in-webview), but I am not sure what is being used under the covers for Jasonelle.
Or, do I need to manually set some permissions (in the AndroidManifest.xml) to get this to work?
Please let me know if you have any ideas. Thank you.
Jason