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

Proposal: Decorator API #160

Merged
merged 8 commits into from
Oct 9, 2021
Merged

Proposal: Decorator API #160

merged 8 commits into from
Oct 9, 2021

Conversation

mickael-menu
Copy link
Member

@mickael-menu mickael-menu commented Jul 7, 2021

See the full proposal

This proposal introduces a new Navigator API to draw decorations on top of publications, in a media type agnostic way.

A variety of features need to draw user interface elements (decorations) over a publication's content, such as:

  • highlighting a text selection
  • displaying search results
  • underlining spoken text with speech synthesis
  • annotating a piece of content with an icon or button
  • drawing side marks in the margin

The actual rendering routines depend on the media type of the decorated resources. We can simplify reading apps significantly by providing a media type agnostic Navigator API to handle decorations.

Simulator Screen Shot - iPad (8th generation) - 2021-07-06 at 19 00 01

@chrfalch
Copy link

chrfalch commented Jul 7, 2021

Great work! I've looked through your proposal and it seems (on first glance) like a flexible and generic way to handle and extend a navigator with decorations.

Would be interesting to see the API that the navigator is expected to implement to support this. Would diffing and rendering decorators be calculated by each navigator, or is this something that will be done for the navigator through a helper class?

Copy link
Contributor

@qnga qnga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I like the idea! Since the same topics occur in several places, comments are quite randomly ordered, sorry.

proposals/000-decorator-api.md Outdated Show resolved Hide resolved
proposals/000-decorator-api.md Outdated Show resolved Hide resolved
proposals/000-decorator-api.md Outdated Show resolved Hide resolved
proposals/000-decorator-api.md Outdated Show resolved Hide resolved
proposals/000-decorator-api.md Outdated Show resolved Hide resolved
proposals/000-decorator-api.md Outdated Show resolved Hide resolved
proposals/000-decorator-api.md Outdated Show resolved Hide resolved
@mickael-menu
Copy link
Member Author

@chrfalch Thanks!

Would be interesting to see the API that the navigator is expected to implement to support this. Would diffing and rendering decorators be calculated by each navigator, or is this something that will be done for the navigator through a helper class?

On iOS, there's no native diff algorithm before iOS 13 (it's used by Diffable Data Sources). But on Android there's one with Jetpack. I think the best approach would be a helper class, ideally using a native API. That's what I've implemented for iOS.

@qnga
Copy link
Contributor

qnga commented Jul 8, 2021

To summarise the discussion in comments, enabling or disabling interactions would be simpler on the basis of decoration groups. On Android, it might be done registering a listener for a specific group or not. I'm not sure how it could be implemented on iOS.

@mrifni
Copy link

mrifni commented Jul 13, 2021

this is great work.

@mickael-menu mickael-menu merged commit dc939bf into master Oct 9, 2021
@mickael-menu mickael-menu deleted the proposal/decorator-api branch October 9, 2021 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants