Repository navigation
refactor: [SDK-5661] extract IAM horizontal inset math and unit test it - #1791
Conversation
83ffc75 to
c850e73
Compare
nan-li
left a comment
There was a problem hiding this comment.
Verified the helper matches the old inline math and the 12 expected values check out. Two test notes inline.
abdulraqeeb33
left a comment
There was a problem hiding this comment.
Clean extraction. I reconstructed the old horizontalInsets from the removed lines and the helper is identical across fullscreen, margin, iOS 27.1 availability and region placement (the fullscreen short-circuit matches because margin is never negative). Wiring is right: header stays project-private, .m and test are in the correct phases, and OneSignalInAppMessagesTests is in the reduced plan so these run in CI.
One non-blocking ask, inline on the test file: the suite pins every left-side guard but not its right-side mirror. I ran one-line mutations of OSInAppMessageInsets.m against the 12 tests on a simulator and three survive with 0 failures:
- left
minX >= 1→minX > 1 - right
right = MAX(right, …)→ plain assignment - right
width - safeArea.right - 1→width - safeArea.right
Three short tests close all of them.
c850e73 to
d9a8849
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d9a8849 to
9fd9ee9
Compare
Description
One Line Summary
Move the IAM horizontal inset math into a pure
OSInAppMessageInsetshelper and unit test it.Details
Motivation
Follow-up to #1789 review:
horizontalInsetsmixed window lookup, safe area, margin and iOS 27.1 reserved regions, so it was only verified by screenshot runs.Scope
OSInAppMessageInsetstakesmargin,safeArea,width, region frames andisFullscreen, and returns the left/right insets. Same rules as before: each side is max(margin, safe area), full screen ignores the safe area and regions, and a region adds clearance only when it sits inside a side safe area and isn't flush with the edge.OSInAppMessageViewControllerkeeps the scene view and reserved-region lookup (still behind the local protocol shim for Xcode 15.2 builds) and passes plainCGRects in.Testing
Unit testing
OSInAppMessageInsetsTests(12 cases): max vs sum, with and without the width margin, full screen ignoring regions, regions inside, flush with and straddling a side safe area, left, right and both sides, and the 1pt tolerance.OneSignalInAppMessagesTestspasses on an iOS 26.5 simulator (52 tests).Manual testing
Not rerun. This is a pure refactor and the unit tests cover the math. The Duo capture comparison from #1789 can be rerun if wanted.
Affected code checklist
Checklist
Overview
Testing
Final pass
🤖 Generated with Claude Code