-
Notifications
You must be signed in to change notification settings - Fork 116
Deprecate Link.toLocator() in favor of Publication.locatorFromLink()
#83
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
Conversation
| override val currentLocator: StateFlow<Locator> get() = _currentLocator | ||
| private val _currentLocator = MutableStateFlow(initialLocator ?: publication.readingOrder.first().toLocator()) | ||
| private val _currentLocator = MutableStateFlow(initialLocator | ||
| ?: requireNotNull(publication.locatorFromLink(publication.readingOrder.first())) |
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.
A link in the reading order must have a type, so locatorFromLink() will not return null.
| * If there's no match, try again after removing any query parameter and anchor from the | ||
| * given [href]. | ||
| */ | ||
| fun linkWithHref(href: String): Link? { |
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 moved this from Publication, as it makes sense to have it in Manifest as well.
| // progression is mandatory in some contexts | ||
| if (it.locations.fragments.isEmpty()) | ||
| it.copyWithLocations(progression = 0.0) | ||
| else | ||
| it |
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 made sure that locatorFromLink() returns a Locator with either progression or fragments set.
readium/navigator-media2/src/main/java/org/readium/navigator/media2/MediaNavigator.kt
Show resolved
Hide resolved
3c212c0 to
46327bf
Compare
qnga
left a comment
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.
Looks good.
Deprecated
Shared
Link.toLocator()is deprecated as it may create an incorrectLocatorif the linktypeis missing.publication.locatorFromLink()instead.See Slack discussion for context: https://readium.slack.com/archives/C703MSTQU/p1642520174001200