File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -227,13 +227,23 @@ class IterableHtmlMessageViewController: UIViewController {
227227 let parentPosition = ViewPosition ( width: view. bounds. width,
228228 height: view. bounds. height,
229229 center: view. center)
230+ let safeAreaInsets = InAppCalculations . safeAreaInsets ( for: view)
230231 IterableHtmlMessageViewController . calculateWebViewPosition ( webView: webView,
231- safeAreaInsets: InAppCalculations . safeAreaInsets ( for : view ) ,
232+ safeAreaInsets: safeAreaInsets,
232233 parentPosition: parentPosition,
233234 paddingLeft: CGFloat ( parameters. padding. left) ,
234235 paddingRight: CGFloat ( parameters. padding. right) ,
235236 location: location)
236237 . onSuccess { [ weak self] position in
238+ // Apply safe area insets to scrollView content for full position
239+ // This keeps the webView covering the full screen (edge-to-edge background)
240+ // while ensuring content is not hidden behind notch or home indicator
241+ if self ? . location == . full {
242+ self ? . webView. set ( contentInset: safeAreaInsets)
243+ } else {
244+ self ? . webView. set ( contentInset: . zero)
245+ }
246+
237247 if animate {
238248 self ? . animateWhileEntering ( position)
239249 } else {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ protocol WebViewProtocol {
1717 @discardableResult func loadHTMLString( _ string: String , baseURL: URL ? ) -> WKNavigation ?
1818 func set( position: ViewPosition )
1919 func set( navigationDelegate: WKNavigationDelegate ? )
20+ func set( contentInset: UIEdgeInsets )
2021 func layoutSubviews( )
2122 func calculateHeight( ) -> Pending < CGFloat , IterableError >
2223}
@@ -39,7 +40,11 @@ extension WKWebView: WebViewProtocol {
3940 func set( navigationDelegate: WKNavigationDelegate ? ) {
4041 self . navigationDelegate = navigationDelegate
4142 }
42-
43+
44+ func set( contentInset: UIEdgeInsets ) {
45+ scrollView. contentInset = contentInset
46+ }
47+
4348 func calculateHeight( ) -> Pending < CGFloat , IterableError > {
4449 let fulfill = Fulfill < CGFloat , IterableError > ( )
4550
Original file line number Diff line number Diff line change @@ -22,15 +22,20 @@ class MockWebView: WebViewProtocol {
2222 }
2323
2424 func set( navigationDelegate _: WKNavigationDelegate ? ) { }
25-
25+
26+ func set( contentInset: UIEdgeInsets ) {
27+ self . contentInset = contentInset
28+ }
29+
2630 func layoutSubviews( ) { }
2731
2832 func calculateHeight( ) -> Pending < CGFloat , IterableError > {
2933 Fulfill < CGFloat , IterableError > ( value: height)
3034 }
3135
3236 var position : ViewPosition = ViewPosition ( )
33-
37+ var contentInset : UIEdgeInsets = . zero
38+
3439 private var height : CGFloat
3540
3641 init ( height: CGFloat ) {
You can’t perform that action at this time.
0 commit comments