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

Opening Downloaded HTML Files #12

Closed
l-k22 opened this issue Nov 6, 2018 · 6 comments
Closed

Opening Downloaded HTML Files #12

l-k22 opened this issue Nov 6, 2018 · 6 comments

Comments

@l-k22
Copy link

l-k22 commented Nov 6, 2018

Hello, I have an epub which is downloaded to the user's device, the HTML files are extracted into a folder within the applications directory. The examples provided only refer to files being located inside the assets folder. How can I display files downloaded elsewhere?

Thanks.

@pichillilorenzo
Copy link
Owner

To get files outside an App, you can use the path_provider plugin and then call the getExternalStorageDirectory function. You get the HTML string of the file and then call openData method (available from version 0.5.5 of my plugin) in case you are using the InAppBrowser class or use the initialData property (available from version 0.5.5 of my plugin) for the InAppWebView widget.
The problem is that this will work only on Android. Like said in the docs of the getExternalStorageDirectory function:

Path to a directory where the application may access top level storage. The current operating system should be determined before issuing this function call, as this functionality is only available on Android.

On iOS, this function throws an UnsupportedError as it is not possible to access outside the app's sandbox.

On Android this returns getExternalStorageDirectory.

On iOS you can't access outside the app's sandbox!

So, you need a way to put the file that you want show in the App "directory" in order to make it work in a cross-platform way.

@l-k22
Copy link
Author

l-k22 commented Nov 7, 2018

Okay thank you for the quick reply. I am using the getApplicationDocumentsDirectory() so all files are downloaded into com.exampleapp/app_flutter/ebooks/book1/*

I realized that my issue was layout overflow which prevented any of the content from displaying.
Scrolling feels very sluggish though.

@l-k22 l-k22 closed this as completed Nov 7, 2018
@pichillilorenzo
Copy link
Owner

Ok!

Scrolling feels very sluggish though.

I think that happens because, like said in the AndroidView documentation:

Embedding Android views is an expensive operation and should be avoided when a Flutter equivalent is possible.

The support for Android native views is not full stable yet unfortunately.

@l-k22
Copy link
Author

l-k22 commented Nov 7, 2018

Yeh still early days unfortunately. Thank you for your hard work

@l-k22
Copy link
Author

l-k22 commented Nov 30, 2018

Could I ask for a feature request? I'm trying to figure out this myself but it's beyond my knowledge. Would it be possible to add the ability to restrict web content to the height of the container then override the swipe gesture used for back and forward to act as the next page of the split content, similar to an ebook?

thanks

@iampato iampato mentioned this issue Mar 7, 2020
@DowsingUK DowsingUK mentioned this issue Apr 29, 2020
This was referenced Jul 6, 2020
plateaukao pushed a commit to plateaukao/flutter_inappwebview that referenced this issue Jul 27, 2020
…x_crash_that_runJavaScriptAlertPanelWithMessage_is_called_while_App_in_the_background

TWECACAPP-651 fix crash that runJavaScriptAlertPanelWithMessage is called while App in the background
@Nabouste Nabouste mentioned this issue Jul 23, 2021
5 tasks
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants