-
Notifications
You must be signed in to change notification settings - Fork 780
Conversation
Any update on this @hebertialmeida :) |
Hey @omaralbeik, I haven't time to review that yet, but I will soon, I am on vacation right now... Sorry. |
Source/FolioReaderBookmarkList.swift
Outdated
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: kReuseCellIdentifier) |
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.
Could you remove all unnecessary self
?
Source/FolioReaderBookmarkList.swift
Outdated
super.viewDidLoad() | ||
|
||
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: kReuseCellIdentifier) | ||
self.tableView.separatorInset = UIEdgeInsets.zero |
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.
Could you remove UIEdgeInsets
?
tableView.separatorInset = .zero
Source/FolioReaderBookmarkList.swift
Outdated
|
||
// MARK: - Table view data source | ||
|
||
override func numberOfSections(in tableView: UITableView) -> Int { |
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.
I think you could remove this method
Source/FolioReaderBookmarkList.swift
Outdated
|
||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
let cell = tableView.dequeueReusableCell(withIdentifier: kReuseCellIdentifier, for: indexPath) | ||
cell.backgroundColor = UIColor.clear |
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.
Could you remove UIColor
?
cell.backgroundColor = .clear
Source/FolioReaderBookmarkList.swift
Outdated
let cell = tableView.dequeueReusableCell(withIdentifier: kReuseCellIdentifier, for: indexPath) | ||
cell.backgroundColor = UIColor.clear | ||
|
||
let bookmark = bookmarks[(indexPath as NSIndexPath).row] |
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.
Why (indexPath as NSIndexPath)
?
let realm = try Realm(configuration: readerConfig.realmConfiguration) | ||
bookmarks = realm.objects(Bookmark.self).filter(predicate).toArray(Bookmark.self) | ||
return (bookmarks ?? []) | ||
} catch let error as NSError { |
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.
here too let error as NSError
do { | ||
let realm = try Realm(configuration: readerConfig.realmConfiguration) | ||
bookmarks = realm.objects(Bookmark.self).filter(predicate).toArray(Bookmark.self) | ||
return (bookmarks ?? []) |
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.
Extra parenthesis (...)
Source/Models/Bookmark+Helper.swift
Outdated
do { | ||
let realm = try Realm(configuration: readerConfig.realmConfiguration) | ||
bookmarks = realm.objects(Bookmark.self).toArray(Bookmark.self) | ||
return (bookmarks ?? []) |
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.
Extra parenthesis (...)
Source/Models/Bookmark+Helper.swift
Outdated
let realm = try Realm(configuration: readerConfig.realmConfiguration) | ||
bookmarks = realm.objects(Bookmark.self).toArray(Bookmark.self) | ||
return (bookmarks ?? []) | ||
} catch let error as NSError { |
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.
here too let error as NSError
|
||
/// A Bookmark object | ||
open class Bookmark: Object { | ||
@objc open dynamic var bookId: String! |
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.
Why are you using String!
? Could it be optional? If not, you shouldn't use !
Hey @rodrigorsa, thank you for your review, I updated the submission with fixes to some points you mentioned above.
I'd recommend adding SwiftLint to catch this kind of warnings, however, I'm afraid there are tons of changes required as the current code base follows a different code style |
This PR is really good, the only problem that I have not merged yet is the same problem with #334. Basically, we need to solve locator in the epub, that is the biggest problem we have right now, most of the bugs are highlight related and that being said anything we add will just increase bug reports. Do you have experience with epub locators like CFI? So you might help us solve this problem before merging that. If we merge and people start using it we will have to probably implement some migration solution because the highlights format probably will change. |
@hebertialmeida @rodrigorsa Is this is being merged in the Repository as We are also looking for this (Bookmark) feature. |
Hi @hebertialmeida , This library is good but has some bugs related to highlights. Especially when trying to highlight multiple paragraphs at once. @omaralbeik Have you completed the bookmark feature? I require this feature for one of my projects. Still working on my own implementation for it. |
Anyone is ware that library have Book Search feature or not? |
When can this library implement the bookmark function? |
Sorry, I can't find the time to work on this feature anymore 😅 |
Hi @hebertialmeida : We are facing issue while highlighting multiple paragraphs at once. Can you please provide solution for the same.if anyone else has resolved it please provide the solution. |
Hi @shalinipd : I had faced the same issue. I end up integrating rangy library in iOS to resolve this and that gives me an advantage as both platforms iOS and Android now have the same approach for Highlight. |
Hey ..thanks for replying.Can you give us the link of library as we are
searching the same for iOS and have not found.
…On Wed, Jul 17, 2019 at 12:49 PM shubhankarbhavsar ***@***.***> wrote:
Hi @shalinipd <https://github.com/shalinipd> : I had faced the same
issue. I end up integrating rangy library in iOS to resolve this and that
gives me an advantage as both platforms iOS and Android now have the same
approach for Highlight.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#328?email_source=notifications&email_token=ABWPL7646R2DTZHUXZ5C7OTP73BY7A5CNFSM4EXL7FF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2DI62A#issuecomment-512135016>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWPL7ZIVUX4FKKEZ2KTSX3P73BY7ANCNFSM4EXL7FFQ>
.
|
@shubhankarbhavsar If you can share the code base that will be helpful. |
@shalinipd Unfortunately I do not have the code but I can help and guide. |
Please use rangy js files from FolioReader Android project. |
Hi shubhankar,
As you suggested we are trying to integrate rangy in iOS but we are getting
error "undefined error".can you guide us how to integrate the same.
…On Wed, Jul 17, 2019 at 3:44 PM shubhankarbhavsar ***@***.***> wrote:
@shalinipd <https://github.com/shalinipd> Unfortunately I do not have the
code but I can help and guide.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#328?email_source=notifications&email_token=ABWPL72YFJP3PN6CMXCHYOTP73WG7A5CNFSM4EXL7FF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2DXFVY#issuecomment-512193239>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWPL7ZH3VKOJVXMGLKXNZLP73WG7ANCNFSM4EXL7FFQ>
.
|
Hi @hebertialmeida ,@shubhankarbhavsar We were able to integrate the rangy lib and successfully see the highlight by using "highlighselection" method but how to persist it so that redirection can be achieved.Can you please guide us on the same. |
@shalinipd You can follow a similar approach as Highlight works here. As you said you've already achieved the highlighting part which means there is only one step left which is to return parameters from the highlight function. Highlighter's highlightSelection() method returns the highlightRangy string and you can prepare a custom JSON object by adding this in the parameter list and return it from the highlight function. After that, you can save this JSON object in any database like realm or core data. |
Hi FolioReader/FolioReaderKit
Thanks for your response.yes we are getting the JSON object which have
multiple values.How do we use these values to again put the highlight on
the original HTML.Can you please share a code sample and methods with us.
Please find attached the sample JSON which we are getting attached.
"[{\"id\":1,\"characterRange\":{\"start\":2,\"end\":31},\"doc\":{\"location\":{\"href\":\"file:///Users/dmi/Library/Developer/CoreSimulator/Devices/FCEF81F6-EEE3-4B0C-A1F5-09E7ACBA7734/data/Containers/Data/Application/1B12B7D9-AD63-432D-9BCB-35777CB7730E/Documents/English_DSM5.epub/OEBPS/xhtml/\",\"protocol\":\"file:\",\"host\":\"\",\"hostname\":\"\",\"port\":\"\",\"pathname\":\"/Users/dmi/Library/Developer/CoreSimulator/Devices/FCEF81F6-EEE3-4B0C-A1F5-09E7ACBA7734/data/Containers/Data/Application/1B12B7D9-AD63-432D-9BCB-35777CB7730E/Documents/English_DSM5.epub/OEBPS/xhtml/\",\"search\":\"\",\"hash\":\"\",\"origin\":\"file://\",\"ancestorOrigins\":{}}},\"classApplier\":{\"className\":\"highlight\",\"cssClass\":\"highlight\",\"ignoreWhiteSpace\":true,\"normalize\":true,\"attrExceptions\":[],\"elementProperties\":{},\"elementSortedClassName\":\"highlight\",\"applyToAnyTagName\":false,\"tagNames\":[\"span\",\"a\"]},\"converter\":{\"type\":\"textContent\"},\"containerElementId\":null,\"applied\":true}]"
Looking for your support we are really struck.
…On Wed, Aug 7, 2019 at 4:43 PM shubhankarbhavsar ***@***.***> wrote:
@shalinipd <https://github.com/shalinipd> You can follow a similar
approach as Highlight works here. As you said you've already achieved the
highlighting part which means there is only one step left which is to
return parameters from the highlight function. Highlighter's
highlightSelection() method returns the highlightRangy string and you can
prepare a custom JSON object by adding this in the parameter list and
return it from the highlight function. After that, you can save this JSON
object in any database like realm or core data.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#328?email_source=notifications&email_token=ABWPL76KEEUYAAMS4GO24V3QDKU3ZA5CNFSM4EXL7FF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3YBWYQ#issuecomment-519052130>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWPL755KE43QT3CLYJ6Y3DQDKU3ZANCNFSM4EXL7FFQ>
.
|
@shalinipd var highlightRangy = this.highlighter.highlightSelection(color, null, highlightId); Expected Rangy string returned in highlightRangy param should be like this: 69$79$1$highlight-yellow$ Please note that you must use the rangy files that are attached in FolioReader Android Project. |
Hi Subhankar,
Thanks for your reply.This was really helpful.We were able to integrate the
library.The last issue which we are facing after integrating rangy is its
not working in case of table content.Have you done any fix for the same.
We have logged this issue in folio also -
FolioReader/FolioReader-Android#390
This is happening in Android library also.looking for your answer on the
same.
Thanks
Shalini Pandey
…On Wed, Aug 7, 2019 at 7:49 PM shubhankarbhavsar ***@***.***> wrote:
@shalinipd <https://github.com/shalinipd>
This is what I'm explaining in the last message.
var highlightRangy = this.highlighter.highlightSelection(color, null,
highlightId);
var params = { content: rangeString, rangy: highlightRangy, color: color,
id: highlightId };
return JSON.stringify(params);
Expected Rangy string returned in highlightRangy param should be like
this: 69$79$1$highlight-yellow$
Please note that you must use the rangy files that are attached in
FolioReader Android Project.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#328?email_source=notifications&email_token=ABWPL7Y7FHTZTJ4OORENIQ3QDLKYRA5CNFSM4EXL7FF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3YR47Y#issuecomment-519118463>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWPL7Z4H43Z7R7X5OFTH73QDLKYRANCNFSM4EXL7FFQ>
.
|
Hi Shalini, Congratulations on the success. I've not faced issue while highlighting table contents. I'll require code access to understand the issue. If possible please share something to look into. |
Hi Subhankar,
I tried with above epub file in Sample code provided by FolioReader Android
github page itself and found same issue. epub is attached in the mail.
Do you need any further information let me know.
Thanks
Shalini Pandey
…On Mon, Aug 26, 2019 at 7:49 PM shubhankarbhavsar ***@***.***> wrote:
Hi Shalini,
Congratulations on the success. I've not faced issue while highlighting
table contents. I'll require code access to understand the issue. If
possible please share something to look into.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#328?email_source=notifications&email_token=ABWPL7YRYT3CP2BUYCJT5LLQGPQ6BA5CNFSM4EXL7FF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EQJ6Q#issuecomment-524879098>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABWPL73B4B6NK74PTUBAG5TQGPQ6BANCNFSM4EXL7FFQ>
.
|
Hi Subhankar,
really looking for your support.
Thanks
Shalini Pandey
On Tue, Aug 27, 2019 at 5:48 PM Shalini Pandey <[email protected]>
wrote:
… Hi Subhankar,
I tried with above epub file in Sample code provided by FolioReader
Android github page itself and found same issue. epub is attached in the
mail.
Do you need any further information let me know.
Thanks
Shalini Pandey
On Mon, Aug 26, 2019 at 7:49 PM shubhankarbhavsar <
***@***.***> wrote:
> Hi Shalini,
>
> Congratulations on the success. I've not faced issue while highlighting
> table contents. I'll require code access to understand the issue. If
> possible please share something to look into.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#328?email_source=notifications&email_token=ABWPL7YRYT3CP2BUYCJT5LLQGPQ6BA5CNFSM4EXL7FF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EQJ6Q#issuecomment-524879098>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABWPL73B4B6NK74PTUBAG5TQGPQ6BANCNFSM4EXL7FFQ>
> .
>
|
Hi guys 👋
We're trying to add bookmarking capability to FolioReaderKit
Here is what I did so far
allowBookmarking
andlocalizedBookmarkTitle
toFolioReaderConfig
Bookmark
model (copied most of the code from theHighlight
model) 😅BookmarkList
UItableViewControllerWhat I was not able to do:
BookmarkList
view controllerisHighlighted
totrue
orfalse
based on whether the currently visible page was bookmarked or not@hebertialmeida your help is highly appreciated, it would be nice to see Bookmark capability in FolioReaderKit soon 💯