Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
platform: ${{ 'iOS Simulator' }}
device: ${{ 'iPhone 17' }}
device: ${{ 'iPhone 16 Pro' }}
commit_sha: ${{ github.sha }}
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer

Expand All @@ -33,6 +33,7 @@ jobs:
git diff --exit-code Support/Carthage/Readium.xcodeproj
- name: Build
run: |
xcrun simctl list
set -eo pipefail
xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
- name: Test
Expand All @@ -55,6 +56,7 @@ jobs:
run: |
set -eo pipefail
make navigator-ui-tests-project
xcrun simctl list
xcodebuild test -project Tests/NavigatorTests/UITests/NavigatorUITests.xcodeproj -scheme NavigatorTestHost -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi

lint:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. Take a look

### Added

#### Shared

* Added support for JXL (JPEG XL) bitmap images. JXL is decoded natively on iOS 17+.

#### Navigator

* Support for displaying Divina (image-based publications like CBZ) in the fixed-layout EPUB navigator.
Expand Down
1 change: 1 addition & 0 deletions Sources/Shared/Toolkit/Format/Format.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public struct FormatSpecification: RawRepresentable, Hashable {
public static let bmp = FormatSpecification(rawValue: "bmp")
public static let gif = FormatSpecification(rawValue: "gif")
public static let jpeg = FormatSpecification(rawValue: "jpeg")
public static let jxl = FormatSpecification(rawValue: "jxl")
public static let png = FormatSpecification(rawValue: "png")
public static let tiff = FormatSpecification(rawValue: "tiff")
public static let webp = FormatSpecification(rawValue: "webp")
Expand Down
3 changes: 2 additions & 1 deletion Sources/Shared/Toolkit/Format/MediaType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public struct MediaType: Hashable, Loggable, Sendable {

/// Returns whether this media type is of a bitmap image, so excluding vectorial formats.
public var isBitmap: Bool {
matchesAny(.bmp, .gif, .jpeg, .png, .tiff, .webp)
matchesAny(.bmp, .gif, .jpeg, .jxl, .png, .tiff, .webp)
}

/// Returns whether this media type is of an audio clip.
Expand Down Expand Up @@ -228,6 +228,7 @@ public struct MediaType: Hashable, Loggable, Sendable {
public static let javascript = MediaType("text/javascript")!
public static let jpeg = MediaType("image/jpeg")!
public static let json = MediaType("application/json")!
public static let jxl = MediaType("image/jxl")!
public static let lcpLicenseDocument = MediaType("application/vnd.readium.lcp.license.v1.0+json")!
public static let lcpProtectedAudiobook = MediaType("application/audiobook+lcp")!
public static let lcpProtectedPDF = MediaType("application/pdf+lcp")!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class BitmapFormatSniffer: FormatSniffer {
if hints.hasFileExtension("jpg", "jpeg", "jpe", "jif", "jfif", "jfi") || hints.hasMediaType("image/jpeg") {
return Format(specifications: .jpeg, mediaType: .jpeg, fileExtension: "jpg")
}
if hints.hasFileExtension("jxl") || hints.hasMediaType("image/jxl") {
return Format(specifications: .jxl, mediaType: .jxl, fileExtension: "jxl")
}
if hints.hasFileExtension("png") || hints.hasMediaType("image/png") {
return Format(specifications: .png, mediaType: .png, fileExtension: "png")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public struct ComicFormatSniffer: FormatSniffer {
"jfif",
"jpg",
"jpeg",
"jxl",
"png",
"tif",
"tiff",
Expand Down
1 change: 1 addition & 0 deletions Sources/Streamer/Parser/Image/ImageParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public final class ImageParser: PublicationParser {
.bmp,
.gif,
.jpeg,
.jxl,
.png,
.tiff,
.webp,
Expand Down
5 changes: 5 additions & 0 deletions Tests/SharedTests/Toolkit/Format/FormatSniffersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ class FormatSniffersTests: XCTestCase {
XCTAssertEqual(sut.sniffHints(fileExtension: "jfi"), jpeg)
XCTAssertEqual(sut.sniffHints(mediaType: "image/jpeg"), jpeg)

// JXL
let jxl = Format(specifications: .jxl, mediaType: .jxl, fileExtension: "jxl")
XCTAssertEqual(sut.sniffHints(fileExtension: "jxl"), jxl)
XCTAssertEqual(sut.sniffHints(mediaType: "image/jxl"), jxl)

// PNG
let png = Format(specifications: .png, mediaType: .png, fileExtension: "png")
XCTAssertEqual(sut.sniffHints(fileExtension: "png"), png)
Expand Down
3 changes: 2 additions & 1 deletion Tests/SharedTests/Toolkit/Format/MediaTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,10 @@ class MediaTypeTests: XCTestCase {
XCTAssertTrue(MediaType("image/bmp")!.isBitmap)
XCTAssertTrue(MediaType("image/gif")!.isBitmap)
XCTAssertTrue(MediaType("image/jpeg")!.isBitmap)
XCTAssertTrue(MediaType("image/jxl")!.isBitmap)
XCTAssertTrue(MediaType("image/png")!.isBitmap)
XCTAssertTrue(MediaType("image/tiff")!.isBitmap)
XCTAssertTrue(MediaType("image/tiff")!.isBitmap)
XCTAssertTrue(MediaType("image/webp")!.isBitmap)
XCTAssertTrue(MediaType("image/tiff;charset=utf-8")!.isBitmap)
}

Expand Down