Skip to content

Conversation

@mickael-menu
Copy link
Member

Added

Shared

  • Publication.cover() now falls back on the first reading order resource if it's a bitmap image and no cover is declared.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a default cover service (ResourceCoverService) that automatically determines the cover image when no explicit cover link is provided, and refactors the ImageParser to no longer set the first reading order item as the cover by default.

Changes:

  • Added ResourceCoverService which retrieves covers from the publication container, with fallback to the first bitmap reading order item
  • Made ResourceCoverService the default cover service in PublicationServicesBuilder
  • Updated ImageParser to only set cover links when explicitly declared in ComicInfo.xml
  • Added .avif to the list of bitmap media types
  • Simplified Publication.cover() and Publication.coverFitting() helpers to delegate entirely to the cover service

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Sources/Shared/Publication/Services/Cover/ResourceCoverService.swift New service that retrieves covers with fallback to first bitmap reading order item
Sources/Shared/Publication/Services/Cover/CoverService.swift Simplified cover helpers to always use a CoverService
Sources/Shared/Publication/Services/PublicationServicesBuilder.swift Made ResourceCoverService the default cover service
Sources/Streamer/Parser/Image/ImageParser.swift Only sets cover rel when explicitly declared in ComicInfo.xml
Sources/Shared/Toolkit/Format/MediaType.swift Added AVIF to bitmap media types
Tests/SharedTests/Publication/Services/Cover/CoverServiceTests.swift Comprehensive tests for ResourceCoverService fallback behavior
Tests/StreamerTests/Parser/Image/ImageParserTests.swift Updated test to verify no cover rel is set by default
Tests/SharedTests/Publication/Services/PublicationServicesBuilderTests.swift Updated service counts to account for default ResourceCoverService
Support/Carthage/Readium.xcodeproj/project.pbxproj Added ResourceCoverService.swift to build
Support/Carthage/.xcodegen Added ResourceCoverService.swift to sources
CHANGELOG.md Documented the new fallback behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mickael-menu mickael-menu merged commit 566d13d into develop Jan 29, 2026
5 checks passed
@mickael-menu mickael-menu deleted the cover-fallback-images branch January 29, 2026 12:47
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.

2 participants