-
Notifications
You must be signed in to change notification settings - Fork 790
Feature/wkwebview #386
base: master
Are you sure you want to change the base?
Feature/wkwebview #386
Changes from all commits
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -176,7 +176,7 @@ open class FolioReaderAudioPlayer: NSObject { | |||||
| @objc func play() { | ||||||
| if book.hasAudio { | ||||||
| guard let currentPage = self.folioReader.readerCenter?.currentPage else { return } | ||||||
| currentPage.webView?.js("playAudio()") | ||||||
| currentPage.webView?.js("playAudio()") { _ in } | ||||||
|
Member
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.
Suggested change
|
||||||
| } else { | ||||||
| self.readCurrentSentence() | ||||||
| } | ||||||
|
|
@@ -382,22 +382,27 @@ open class FolioReaderAudioPlayer: NSObject { | |||||
| } | ||||||
|
|
||||||
| let playbackActiveClass = book.playbackActiveClass | ||||||
| guard let sentence = currentPage.webView?.js("getSentenceWithIndex('\(playbackActiveClass)')") else { | ||||||
| if (readerCenter.isLastPage() == true) { | ||||||
| self.stop() | ||||||
| } else { | ||||||
| readerCenter.changePageToNext() | ||||||
|
|
||||||
| currentPage.webView?.js("getSentenceWithIndex('\(playbackActiveClass)')") { sentence in | ||||||
| guard let sentence = sentence else { | ||||||
| if (readerCenter.isLastPage() == true) { | ||||||
| self.stop() | ||||||
| } else { | ||||||
| readerCenter.changePageToNext() | ||||||
| } | ||||||
| return | ||||||
|
|
||||||
| } | ||||||
|
|
||||||
| return | ||||||
| } | ||||||
|
|
||||||
| guard let href = readerCenter.getCurrentChapter()?.href else { | ||||||
| return | ||||||
|
|
||||||
| guard let href = readerCenter.getCurrentChapter()?.href else { | ||||||
| return | ||||||
| } | ||||||
|
|
||||||
| // TODO QUESTION: The previous code made it possible to call `playText` with the parameter `href` being an empty string. Was that valid? should this logic be kept? | ||||||
| self.playText(href, text: sentence) | ||||||
|
|
||||||
| } | ||||||
|
|
||||||
| // TODO QUESTION: The previous code made it possible to call `playText` with the parameter `href` being an empty string. Was that valid? should this logic be kept? | ||||||
| self.playText(href, text: sentence) | ||||||
|
|
||||||
| } | ||||||
|
|
||||||
| func readCurrentSentence() { | ||||||
|
|
@@ -410,7 +415,7 @@ open class FolioReaderAudioPlayer: NSObject { | |||||
| if synthesizer.isSpeaking { | ||||||
| stopSynthesizer(immediate: false, completion: { | ||||||
| if let currentPage = self.folioReader.readerCenter?.currentPage { | ||||||
| currentPage.webView?.js("resetCurrentSentenceIndex()") | ||||||
| currentPage.webView?.js("resetCurrentSentenceIndex()") { _ in } | ||||||
|
Member
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.
Suggested change
|
||||||
| } | ||||||
| self.speakSentence() | ||||||
| }) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -190,7 +190,7 @@ class FolioReaderHighlightList: UITableViewController { | |||||
|
|
||||||
| if (highlight.page == self.folioReader.readerCenter?.currentPageNumber), | ||||||
| let page = self.folioReader.readerCenter?.currentPage { | ||||||
| Highlight.removeFromHTMLById(withinPage: page, highlightId: highlight.highlightId) // Remove from HTML | ||||||
| Highlight.removeFromHTMLById(withinPage: page, highlightId: highlight.highlightId) { _ in } // Remove from HTML | ||||||
|
Member
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.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| highlight.remove(withConfiguration: self.readerConfig) // Remove from Database | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -185,7 +185,7 @@ extension FolioReader { | |||||
|
|
||||||
| if let readerCenter = self.readerCenter { | ||||||
| UIView.animate(withDuration: 0.6, animations: { | ||||||
| _ = readerCenter.currentPage?.webView?.js("nightMode(\(self.nightMode))") | ||||||
| _ = readerCenter.currentPage?.webView?.js("nightMode(\(self.nightMode))") { _ in } | ||||||
|
Member
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.
Suggested change
|
||||||
| readerCenter.pageIndicatorView?.reloadColors() | ||||||
| readerCenter.configureNavBar() | ||||||
| readerCenter.scrollScrubber?.reloadColors() | ||||||
|
|
@@ -210,7 +210,7 @@ extension FolioReader { | |||||
| } | ||||||
| set (font) { | ||||||
| self.defaults.set(font.rawValue, forKey: kCurrentFontFamily) | ||||||
| _ = self.readerCenter?.currentPage?.webView?.js("setFontName('\(font.cssIdentifier)')") | ||||||
| _ = self.readerCenter?.currentPage?.webView?.js("setFontName('\(font.cssIdentifier)')") { _ in } | ||||||
|
Member
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.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -232,7 +232,7 @@ extension FolioReader { | |||||
| return | ||||||
| } | ||||||
|
|
||||||
| currentPage.webView?.js("setFontSize('\(currentFontSize.cssIdentifier)')") | ||||||
| currentPage.webView?.js("setFontSize('\(currentFontSize.cssIdentifier)')") { _ in } | ||||||
|
Member
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.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.