Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ CI.swift
*.mdb
.build/arm64-apple-macosx/debug/IterableSDK.build/output-file-map.json
.build
.mcp.json
17 changes: 15 additions & 2 deletions swift-sdk/Internal/IterableHtmlMessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,24 @@ class IterableHtmlMessageViewController: UIViewController {

/// Resizes the webview based upon the insetPadding, height etc
private func resizeWebView(animate: Bool) {
let parentPosition = ViewPosition(width: view.bounds.width,
// For full position, use screen bounds to ensure edge-to-edge coverage
// including behind notch/Dynamic Island and home indicator
let parentPosition: ViewPosition
if location == .full {
let screenBounds = UIScreen.main.bounds
// Convert screen center to view's coordinate system
let screenCenterInView = view.convert(CGPoint(x: screenBounds.midX, y: screenBounds.midY), from: nil)
parentPosition = ViewPosition(width: screenBounds.width,
height: screenBounds.height,
center: screenCenterInView)
} else {
parentPosition = ViewPosition(width: view.bounds.width,
height: view.bounds.height,
center: view.center)
}
let safeAreaInsets = InAppCalculations.safeAreaInsets(for: view)
IterableHtmlMessageViewController.calculateWebViewPosition(webView: webView,
safeAreaInsets: InAppCalculations.safeAreaInsets(for: view),
safeAreaInsets: safeAreaInsets,
parentPosition: parentPosition,
paddingLeft: CGFloat(parameters.padding.left),
paddingRight: CGFloat(parameters.padding.right),
Expand Down
2 changes: 1 addition & 1 deletion swift-sdk/Internal/Utilities/WebViewProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extension WKWebView: WebViewProtocol {
func set(navigationDelegate: WKNavigationDelegate?) {
self.navigationDelegate = navigationDelegate
}

func calculateHeight() -> Pending<CGFloat, IterableError> {
let fulfill = Fulfill<CGFloat, IterableError>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,17 @@ struct InAppMessageTestView: View {
}
.accessibilityIdentifier("trigger-testview-in-app-button")
.disabled(viewModel.isTriggeringCampaign)


ActionButton(
title: "Send Full Screen In-App (SDK-31 Test)",
backgroundColor: Color(.systemPurple),
isLoading: viewModel.isTriggeringCampaign
) {
viewModel.triggerCampaign(16505358)
}
.accessibilityIdentifier("trigger-fullscreen-in-app-button")
.disabled(viewModel.isTriggeringCampaign)

ActionButton(
title: "Send Silent Push (Campaign 14750476)",
backgroundColor: Color(.brown),
Expand Down
16 changes: 8 additions & 8 deletions tests/common/MockWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ import WebKit

class MockWebView: WebViewProtocol {
let view: UIView = UIView()

func loadHTMLString(_: String, baseURL _: URL?) -> WKNavigation? {
nil
}

func set(position: ViewPosition) {
self.position = position
view.frame.size.width = position.width
view.frame.size.height = position.height
view.center = position.center
}

func set(navigationDelegate _: WKNavigationDelegate?) {}

func layoutSubviews() {}

func calculateHeight() -> Pending<CGFloat, IterableError> {
Fulfill<CGFloat, IterableError>(value: height)
}

var position: ViewPosition = ViewPosition()

private var height: CGFloat

init(height: CGFloat) {
self.height = height
}
Expand Down
Loading