This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add minizip and Fuzi dependencies
This was referenced Apr 16, 2020
…niff Formats declared in Info.plist by reading apps Add URLResponse.sniffFormat()
Fix sniffing of Readium Audiobook if @type is wrong by falling back on readingOrder sniffing
Add MediaType.isSupportedDocumentType Add Publication.url(to: String) for hrefs Add all media types and extensions from the document types' UTIs
Warn against using strict equality with MediaType
mickael-menu
force-pushed
the
feature/format-api-without-zip+xml
branch
from
May 1, 2020 08:14
86857ae
to
38d95a5
Compare
Merged
…the format, to avoid memory crashes
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation of the Format API proposal.
It's quite a lot of code because I had to integrate ZIP and XML third-party libs in R2Shared and adapt
DocumentTypes
to be a bit more useful. Here's a few shortcuts to jump directly to the interesting types:Compared to the existing solution in the Swift toolkit, this new API offers:
You can see how this new API looks in practice in:
The original Format API proposal is extended a bit to take advantage of iOS capabilities. The sniffing algorithm is going through the provided sniffers, but if no known
Format
is found, then it falls back on two sources, in order:Info.plist
, to automatically detect custom formats supported by the reading app without needing custom sniffers..xlsx
file by returning the followingFormat
generated from system-provided metadata:A few notes about the implementation:
XMLDocument
andZIPArchive
to avoid referring directly to third-party dependencies throughout the project, this has several advantages: