Skip to content

fix: crop course details banner image#659

Open
edschema wants to merge 1 commit into
openedx:mainfrom
Schema-Education:edschema/course-details-image-fix
Open

fix: crop course details banner image#659
edschema wants to merge 1 commit into
openedx:mainfrom
Schema-Education:edschema/course-details-image-fix

Conversation

@edschema
Copy link
Copy Markdown

@edschema edschema commented May 4, 2026

Description

This PR addresses issue openedx/wg-mobile#46
This change fixes the native iOS Course Details page banner image so it fills the intended banner frame and crops overflow instead of preserving an image-driven aspect ratio that could render incorrectly.

The implementation is limited to Discovery/Discovery/Presentation/NativeDiscovery/CourseDetailsView.swift Note: no Android, API, persistence, analytics, event tracking, localization, or server-side behavior is changed.

Out of Scope

  • We should provide guidance for course authors on the places images will be cropped (course listing uses square images)
  • currently the height is defined to fit the banner at 16:8.5 ratio. this should be explored: if intentional, keep, but if not, return to a more standard 16:9 ratio. This is suggested follow on work, but not done here.

Change Log

CourseBannerView no longer owns page-level layout decisions through the parent GeometryProxy, isHorisontal, or UIDevice checks. Instead, it renders the course banner image into whatever finite frame its parent provides.

The parent layout now owns the sizing:

  • Horizontal layout keeps the existing fixed-width banner behavior at 312pt, with height derived from the native 16:8.5 banner ratio.
  • Non-horizontal layout applies the native 16:8.5 aspect ratio at the content-column level, allowing the banner to fit the page column without forcing the rest of the page wider.

Inside CourseBannerView, the KFImage is rendered with:

  • resizable()
  • scaledToFill()
  • a frame matching the available banner geometry
  • clipped()

AI Disclosure

Codex was used to help diagnose the bug, catalog the current behavior, suggest an implementation shape, execute the fix, and generate the framework for the PR text based on Open edX guidances in the docs. Each step required manual review to avoid scope creep and to ensure the fix was well defined.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label May 4, 2026
@openedx-webhooks
Copy link
Copy Markdown

Thanks for the pull request, @edschema!

This repository is currently maintained by @openedx/openedx-mobile-maintainers.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Co-authored-by: Codex <codex@openai.com>
@edschema edschema force-pushed the edschema/course-details-image-fix branch from 860fffa to d379639 Compare May 6, 2026 20:57
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions May 7, 2026
@mphilbrick211 mphilbrick211 requested a review from a team May 7, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

3 participants