Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f76f4dc
fix: [SDK-5654] render IAMs on iPhone Duo folded and unfolded
fadi-george Oct 30, 2026
94b049f
chore: [SDK-5654] fill demo top inset with the nav bar color
fadi-george Oct 30, 2026
4577de9
fix(iam): keep IAM clear of safe area hardware
fadi-george Oct 30, 2026
3766b06
revert me later
fadi-george Oct 30, 2026
c98f33d
fix(iam): query full-screen window for occlusion regions
fadi-george Oct 30, 2026
3a331d6
refactor(iam): extract sceneView helper method
fadi-george Oct 30, 2026
262f921
fix(iam): use max of margin and bottom safe area
fadi-george Oct 30, 2026
402c59c
fix(iam): apply safe area offset to top banners
fadi-george Oct 31, 2026
220f9b6
refactor(iam): unify vertical insets via layout guide
fadi-george Oct 31, 2026
f4e829a
refactor(iam): compute webview insets before window exists
fadi-george Oct 31, 2026
eb4ac62
fix(iam): refresh status bar visibility once IAM appears
fadi-george Nov 3, 2026
07301d4
Revert "revert me later"
fadi-george Nov 3, 2026
b1f8f27
fix(iam): look up reserved regions at runtime
fadi-george Nov 3, 2026
9205fc8
fix(iam): prefer lowest visible full scene window for insets
fadi-george Nov 3, 2026
af88faa
refactor(iam): skip reserved regions for full screen messages
fadi-george Nov 3, 2026
2333383
fix(iam): only refresh status bar for full screen messages
fadi-george Nov 3, 2026
7827c0a
chore(iam): warn when display bounds fall back to the screen
fadi-george Nov 3, 2026
52f0398
fix(iam): re-show message when JS height check fails on rotation
fadi-george Nov 3, 2026
017a6ab
chore(iam): note when the reserved region shim can go
fadi-george Nov 3, 2026
eaa970c
fix(iam): send full screen insets from the message's own window
fadi-george Nov 4, 2026
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
2 changes: 1 addition & 1 deletion examples/demo/App/Views/Components/LogView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct LogView: View {
entryList
}
.frame(maxWidth: .infinity)
.background(OS.Color.logBackground)
.background(OS.Color.logBackground, ignoresSafeAreaEdges: .horizontal)
.accessibilityElement(children: .contain)
.accessibilityIdentifier("log_view")
}
Expand Down
3 changes: 2 additions & 1 deletion examples/demo/App/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ struct ContentView: View {
// Android's `scrollIntoView` `scrollableElement` param.
.accessibilityIdentifier("main_scroll_view")
}
.background(OS.Color.lightBackground.ignoresSafeArea())
.background(OS.Color.lightBackground.ignoresSafeArea(edges: [.horizontal, .bottom]))
.background(OS.Color.primary.ignoresSafeArea())
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(OS.Color.primary, for: .navigationBar)
.toolbarBackground(.visible, for: .navigationBar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ - (void)webViewContentFinishedLoading:(OSInAppMessageInternal *)message {
if (!self.window) {
self.window = [[UIWindow alloc] init];
self.window.windowLevel = UIWindowLevelAlert;
self.window.frame = [[UIScreen mainScreen] bounds];
self.window.frame = [UIApplication displayBounds];
}

self.window.rootViewController = _viewController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ NS_ASSUME_NONNULL_BEGIN
@interface OSInAppMessageView : UIView <WKNavigationDelegate>

@property (weak, nonatomic, nullable) id<OSInAppMessageViewDelegate> delegate;
// Left & right space around the message, so content is laid out at the width it is displayed at
@property (nonatomic) UIEdgeInsets horizontalInsets;

- (instancetype _Nonnull)initWithMessage:(OSInAppMessageInternal *)inAppMessage withScriptMessageHandler:(id<WKScriptMessageHandler>)messageHandler;
- (void)resetWebViewToMaxBoundsAndResizeHeight:(void (^) (NSNumber *newHeight)) completion;
- (void)updateSafeAreaInsets;
- (void)updateSafeAreaInsets:(UIEdgeInsets)insets;
- (void)setupWebViewConstraints;
- (void)loadReplacementURL:(NSURL *)url;
- (void)loadedHtmlContent:(NSString *)html withBaseURL:(NSURL *)url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#import "OSInAppMessageClickResult.h"
#import <OneSignalUser/OneSignalUser.h>
#import "OSMacros.h"
#import "UIApplication+OneSignal.h"

@interface OSInAppMessageView () <UIScrollViewDelegate, WKUIDelegate, WKNavigationDelegate>

Expand Down Expand Up @@ -101,7 +102,7 @@ - (void)setupWebviewWithMessageHandler:(id<WKScriptMessageHandler>)handler {

// WebView should use mainBounds as frame since we need to make sure it spans full possible screen size
// to prevent text wrapping while obtaining true height of message from JS
CGRect mainBounds = UIScreen.mainScreen.bounds;
CGRect mainBounds = [UIApplication displayBounds];
mainBounds.size.width -= (2.0 * marginSpacing);

// Setup WebView, delegates, and disable scrolling inside of the WebView
Expand Down Expand Up @@ -132,11 +133,8 @@ - (void)setIsFullscreen:(BOOL)isFullscreen {
}

- (void)setWebviewFrame {
CGRect mainBounds = UIScreen.mainScreen.bounds;
if (!self.isFullscreen) {
CGFloat marginSpacing = [OneSignalCoreHelper sizeToScale:MESSAGE_MARGIN];
mainBounds.size.width -= (2.0 * marginSpacing);
}
CGRect mainBounds = [UIApplication displayBounds];
mainBounds.size.width -= self.horizontalInsets.left + self.horizontalInsets.right;
[self.webView setFrame:mainBounds];
}

Expand All @@ -157,6 +155,9 @@ - (void)resetWebViewToMaxBoundsAndResizeHeight:(void (^) (NSNumber *newHeight))
if (error) {
NSString *errorMessage = [NSString stringWithFormat:@"Javascript Method: %@ Evaluated with Error: %@", OS_JS_GET_PAGE_META_DATA_METHOD, error];
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage];
// Still complete so a rotation or fold re-shows the message at its previous height
[self setupWebViewConstraints];
completion(nil);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocking: The header declares newHeight non-null (it's under NS_ASSUME_NONNULL_BEGIN), but this passes nil. NSNumber * _Nullable newHeight in the .h would match the caller's nil check.

return;
}
NSString *successMessage = [NSString stringWithFormat:@"Javascript Method: %@ Evaluated with Success: %@", OS_JS_GET_PAGE_META_DATA_METHOD, result];
Expand All @@ -170,13 +171,8 @@ - (void)resetWebViewToMaxBoundsAndResizeHeight:(void (^) (NSNumber *newHeight))
}];
}

- (void)updateSafeAreaInsets {
UIWindow *keyWindow = UIApplication.sharedApplication.keyWindow;
CGFloat top = keyWindow.safeAreaInsets.top;
CGFloat bottom = keyWindow.safeAreaInsets.bottom;
CGFloat right = keyWindow.safeAreaInsets.right;
CGFloat left = keyWindow.safeAreaInsets.left;
NSString *safeAreaInsetsObjectString = [NSString stringWithFormat:OS_JS_SAFE_AREA_INSETS_OBJ,top, bottom, right, left];
- (void)updateSafeAreaInsets:(UIEdgeInsets)insets {
NSString *safeAreaInsetsObjectString = [NSString stringWithFormat:OS_JS_SAFE_AREA_INSETS_OBJ, insets.top, insets.bottom, insets.right, insets.left];

NSString *setInsetsString = [NSString stringWithFormat:OS_SET_SAFE_AREA_INSETS_METHOD, safeAreaInsetsObjectString];
[self.webView evaluateJavaScript:setInsetsString completionHandler:^(NSDictionary *result, NSError * _Nullable error) {
Expand Down
Loading
Loading