Skip to content

SDK-291 Fix in-app message position in landscape#1074

Merged
sumeruchat merged 2 commits into
masterfrom
fix/SDK-291-inapp-rotation-taskbar
Jun 15, 2026
Merged

SDK-291 Fix in-app message position in landscape#1074
sumeruchat merged 2 commits into
masterfrom
fix/SDK-291-inapp-rotation-taskbar

Conversation

@sumeruchat

Copy link
Copy Markdown
Contributor

What

In-app HTML messages could be mispositioned after rotating to landscape on notched devices. The webview width and center were computed from the full parent width, ignoring the side safe-area inset where the Dynamic Island or notch sits.

Changes

  • Constrain webview width and center.x using safeAreaInsets.left and .right, so a message stays inside the safe area in any orientation.
  • Center a .center message within the top and bottom safe-area bounds.
  • Make the location switch exhaustive (explicit .center and .full) so a future case fails to compile until handled.
  • Pure inset-based math, no orientation or global-state reads. Added unit tests for portrait and both landscape orientations.

Impact

  • Breaking changes: None. Internal layout math only, no API change.
  • Dependencies: None.
  • Performance: None.

Testing

How to test:

  1. Run ./agent_test.sh IterableHtmlMessageViewControllerTests (34 tests, including new portrait and landscape cases).

Visual check still needed (not covered by unit tests): on a notched device or simulator, show a top, bottom, and center HTML in-app message, rotate to both landscape orientations, and confirm the message stays inside the safe area and clear of the Dynamic Island and home indicator. The unit tests verify the inset math but cannot confirm live rotation behavior or how customer HTML renders in the adjusted frame.

Jira: https://iterable.atlassian.net/browse/SDK-291

In-app message width and center were computed from the full parent
width, so on notched devices in landscape a message could span or
center across the unsafe edge where the Dynamic Island sits. Use the
left and right safe-area insets to constrain width and center.x, and
center a .center message within the top and bottom safe bounds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.60%. Comparing base (8263b08) to head (13bee93).

Files with missing lines Patch % Lines
swift-sdk/Internal/in-app/InAppCalculations.swift 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1074      +/-   ##
==========================================
- Coverage   71.61%   71.60%   -0.01%     
==========================================
  Files         114      114              
  Lines        9462     9467       +5     
==========================================
+ Hits         6776     6779       +3     
- Misses       2686     2688       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaodordio joaodordio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@sumeruchat sumeruchat merged commit 72b371d into master Jun 15, 2026
15 checks passed
@sumeruchat sumeruchat deleted the fix/SDK-291-inapp-rotation-taskbar branch June 15, 2026 11:52
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