Skip to content

Conversation

@defagos
Copy link
Member

@defagos defagos commented Jan 28, 2026

Description

This PR fixes a crash with CastPlayerView view and improves support for taller CastMiniPlayerViews.

These issues were reported by @clementbeffa.

Remark

Another issue was reported by @clementbeffa, namely that locally overriding the locale via the SwiftUI environment:

MyView()
    .environment(\.locale, Locale(identifier: "de"))

does not work for all strings in CastPlayerView and CastMiniPlayerView, and that some results are inconsistent. This locale overriding trick has inherent flaws, though, since it is limited to SwiftUI. Strings fetched using String(localized:bundle:comment:), for example, are not affected by locale overrides (and even if there is an initializer that supports a locale, this locale is only used for formatting, not for actually fetching the string itself). Same for error messages, for example.

Several attempts were made to improve compatibility of Cast views with this mechanism, but there will always be blind spots and attempting to cover all cases requires unnatural API changes (e.g. returning SwiftUI Texts instead of Strings to convey whether a string is localized or not, or returning a type that would convey such information but would introduce friction when used).

For these reasons this PR only partially improves support for locale overrides by using LocalizedStringResource where appropriate, but is not an attempt at fully supporting such overrides, as they cannot be fully supported anyway.

Changes made

  • Fix incorrect environment object Cast usage, leading to crashes if not injected.
  • Avoid restricting information displayed by a mini player to single lines if more space is available vertically.
  • Replace Group with ZStack.
  • Improve localization implementation (improves support for SwiftUI locale environment overrides without providing full support, though).

Checklist

  • APIs have been properly documented (if relevant).
  • The behavior works with all receivers available in the demo.
  • The documentation has been updated (if relevant).
  • New unit tests have been written (if relevant).
  • The demo has been updated (if relevant).

@github-project-automation github-project-automation bot moved this to 📋 Backlog in Pillarbox Jan 28, 2026
@defagos defagos self-assigned this Jan 28, 2026
@defagos defagos moved this from 📋 Backlog to 🍿 Code Review in Pillarbox Jan 28, 2026
@defagos defagos added the bug Something isn't working label Jan 28, 2026
@defagos defagos enabled auto-merge January 28, 2026 08:33
@defagos defagos changed the title Improve and fix crash with standard Cast views Improve and fix crash for standard Cast views Jan 28, 2026
@defagos defagos added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 1043c0a Jan 29, 2026
4 checks passed
@defagos defagos deleted the miscellaneous-fixes branch January 29, 2026 13:47
@github-project-automation github-project-automation bot moved this from 🍿 Code Review to ✅ Done in Pillarbox Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants