FolioReaderKit
FolioReaderKit copied to clipboard
Feature/wkwebview
Hi We are looking for our project folio reader with wkWebview
Hi @thilakks,
It is working without problems?
Or is WIP?
Thanks.
Hello @hebertialmeida , thanks for the review!, I need to clarify that we were working in this feature for a specific project, so some stuff we have here are project specific, for instance we only support fixed-layout ebooks, so we did some changes that may break regular epubs. The project is on stand by, so we're not working on this at the moment. however, due to increased interest ( I just saw apple is not accepting UIWebKit anymore) and your code review I think we should end this WKWebView migration. :)
Hi all, have you planning in the near future to finish the migration to WKWebview? And also this scrolling issue, how to fix it? I saw on google some suggestions via scroll issue, posted on this blog https://ahmedk92.github.io/2017/11/03/WKWebView-Horizontal-Paging.html
As apple is rejecting apps if they are using the UIWebview, this library won't work till the migration to the WKWebview completed. So put this task on high priority otherwise in spite of being the best library, doesn't sense anything.
I also find this repo where is the migration to WKWebview. Maybe to you guys who knows more about webviews can help to speed up process of migrations
https://github.com/pmfawkes/FolioReaderKit
@ricardohg Yeah, after I posted my review I saw that it was opened by someone using your branch. I lost track of how many people have been asking about this but I haven't had time to work on that, but I can definitely help to review it.
Hello Can you please help me out I have implemented the same and also I got crashed but I have resolved;lved that now my project is working but I think CSS and js file is not loaded properly in the collection view cell WKwebview , it looks weird can you please let me know how to resolve that issue . here is screen shot
Which method are you using to load the html?, it is working on a real device ?
Same method that is mentioned in the file and I only changed UIwebview TO WkwebView
Please help me out its urgent
Hello everyone, does somebody know how to download epub book, save it to path and load it and then present it in FolioReader? Please help.
Hi, everyone.
If you need to fix the issue with font you need do this:
let headerString = "<meta name=\"viewport\" content=\"initial-scale=1.0\" />" webView?.loadHTMLString(headerString + tempHtmlContent, baseURL: baseURL)
@hebertialmeida @ricardohg Since with WKWebview we can control javascript capability, can we utilize it to add more security to the module? We can keep javascript disabled for the WebView and temporarily toggle it back while evaluating a script from the code. This way we can be safe from any kind of script injection from the document. Thoughts?
@hebertialmeida What do you think? When will you be able to publish an update with WKWebview? As I am working on one project in which this SDK is the heart of it. So now I am not able to launch that app due to UIWebView. Please do the needful. Thanks.
It's a great library. Please don't let it die. Please udpate it the WKWebview :(
Just thought of sharing these two forked repos - https://github.com/drasdasdasd/FolioReaderKit https://github.com/judith-bitcube/FolioReaderKit
The font size issue is solved in this repo. There are minor issues with both of these repos. but horizontal scroll is flipping through chapters and not pages.
Since the paginationMode is missing in WkWebview, you need to add this code in your CSS file:
overflow: paged-x;
overflow: -webkit-paged-x;
overflow: -o-paged-x;
If you're in a rush, consider sponsoring the repository so the contributors can spend more time during these wild times.
We have very recently started the work on our iOS app to integrate folioreader. Came across this issue. @Parsida - how can we sponsor to get this issue resolved soon. If you have any suggestions please let us know.
We did contact @ricardohg to check how we can get his services to get the issue fixed. We are waiting on the response.
@mooka-ventures Check out @hebertialmeida's page: https://github.com/sponsors/hebertialmeida
Thanks, yes we are aware of that page. @Parsida we are already doing a tiny bit of sponsorship starting this month..
Small donations from several developers that are using this repository in their projects adds up 🙌🏽
We don't see any other sponsorships to the author @hebertialmeida by other developers. By the way, we tried to get some freelancer developers to help out with this but I didn't get a positive response from any till now. So we are still waiting for anyone who is ready to complete this issue. Please let us know if anyone is interested in completing this task. We can sponsor the implementation of this specific task.
Hey guys, I'm open to keeping code reviewing this but at this time I can't do this implementation. If anyone wants to continue this implementation on another PR feel free to open and I can review.
Alright guys. I've managed to fix the scrolling/pagination issue by injecting style tag (scrolling direction dependent) into an html. But I still have to fix the page counting issue and media overlay handling issues. I can post a PR after I will make it work, ok?
Alright guys. I've managed to fix the scrolling/pagination issue by injecting style tag (scrolling direction dependent) into an html. But I still have to fix the page counting issue and media overlay handling issues. I can post a PR after I will make it work, ok?
Hello!, are you working on my branch?, did you check it is working on a real device ?
Hello @ricardohg! Well, I used the most of your code - just edited it according to @hebertialmeida remarks on this PR and fixed the scrolling issue (credits to @emirchelsea). I haven't pushed it anywhere yet. I plan to push it on my fork first. https://github.com/OrbitalMan/FolioReaderKit The scrolling is confirmed to be working properly on iPhone 7, iOS 13.4.1 BTW. Upd: I will push the code after I fix the following issues:
- You have to select a text couple of times in order to have an ability to play the audio from it.
- The play button from menu also doesn't work before you select the text and make it to show play popup.
- The pages counter doesn't always calculate correctly.
Also I don't see images embedded in epub content in webview. You can check by opening a book from example project app and looking at empty rect on the first page where the book cover is supposed to be shown. (I don't yet have an idea how to fix it, nor I need to fix it urgently) Upd2: Ah, I forgot to mention that I also fixed the font scale issue. (credits to @myak0v1ev)
@OrbitalMan Thanks for contributing! will you open a new PR then? If so, I can review that and we can go from there.
Sure @hebertialmeida! On the first commit I will make as few changes as possible for your convenience. Later I will refactor the code.
Hey guys, I really think that WebKit/CSS/Javascript approach is overkill (at least for my project requirements - at least for now) - but the problem that migration just screwed up and doesn't work acceptable way. I probably will continue to fix this monster later, some day-ish... BUT! I've came up with a native approach solution!
let textView: UITextView = UITextView()
let xhtmlURL = Bundle.main.url(forResource: "resource", withExtension: "xhtml")!
do {
let xhtml = try String(contentsOf: xhtmlURL)
let data = Data(xhtml.utf8)
let attributedText = try NSAttributedString(data: data,
options: [.documentType: NSAttributedString.DocumentType.html],
documentAttributes: nil)
textView.attributedText = attributedText
} catch {
print(error)
}
All you need is just locate your epub's .xhtml files! (you have to unzip the epub - it's up to you how to) Although this snippet is suitable if you don't need dynamic fonts, etc and if your epub contains single xhtml resource. (and I'm totally fine with that at least for now)
Credits for the snippet go to the Hacking with Swift: https://www.hackingwithswift.com/example-code/system/how-to-convert-html-to-an-nsattributedstring
@OrbitalMan
Also I don't see images embedded in epub content in webview. You can check by opening a book from example project app and looking at empty rect on the first page where the book cover is supposed to be shown. (I don't yet have an idea how to fix it, nor I need to fix it urgently)
https://developer.apple.com/forums/thread/100125 Maybe it helps! but I don't know how to do it. Thanks in advance.
