Skip to content

Commit

Permalink
make web views inspectable
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-chow committed Jul 27, 2023
1 parent 789b339 commit b81b38e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/OSInAppMessageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ - (void)setupWebviewWithMessageHandler:(id<WKScriptMessageHandler>)handler {
self.webView = [[WKWebView alloc] initWithFrame:mainBounds configuration:configuration];
self.webView.backgroundColor = [UIColor clearColor];
self.webView.opaque = NO;
// https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/
if (@available(macOS 13.3, iOS 16.4, *)) {
self.webView.isInspectable = YES;
}
[self addSubview:self.webView];

[self layoutIfNeeded];
Expand Down
4 changes: 4 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/OneSignalWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ - (void)viewDidLoad {

_webView = [WKWebView new];
_webView.navigationDelegate = self;
// https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/
if (@available(macOS 13.3, iOS 16.4, *)) {
_webView.isInspectable = YES;
}
[self.view addSubview:_webView];

[self pinSubviewToMarginsWithSubview:_webView withSuperview:self.view];
Expand Down

0 comments on commit b81b38e

Please sign in to comment.