Make web views inspectable#1286
Conversation
emawby
left a comment
There was a problem hiding this comment.
Hello thank you for your contribution! It looks like this is failing to build. I believe the Objective-C version of this property is named inspectable (the getter is isInspectable)
Awesome, thanks! I pushed a fix, do you have guidance about getting this to build in an existing project? I wasn't able to due to certificate signing issues. |
emawby
left a comment
There was a problem hiding this comment.
Good question you likely need to change the bundle id and development team in the dev app. One last fix
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @casey-chow, @jkasten2, and @rgomezp)
iOS_SDK/OneSignalSDK/Source/OneSignalWebView.m line 45 at r1 (raw file):
_webView.navigationDelegate = self; // https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/ if (@available(macOS 13.3, iOS 16.4, *)) {
Let's add a condition to this to only enable inspectability if the app is being run in debug mode.
iOS_SDK/OneSignalSDK/Source/OSInAppMessageView.m line 114 at r1 (raw file):
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, *)) {
Let's add a condition to this to only enable inspectability if the app is being run in debug mode.
The main issue I'm facing is our web developers are facing issues in the production version of the app, so we'd like to have access in TestFlight. This is especially important because we need to test against production data/non-sandbox environment, which we can't on a debug build. The other option would be to expose this configuration in the API, but I opted to avoid making any API changes. |
emawby
left a comment
There was a problem hiding this comment.
That makes sense in order to allow debugging in TestFlight lets have the condition be OneSignal's log level as debug or higher. I do not want to have inspectability on by default. This behavior would also match the Android SDK's Webview inspectability behavior.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @casey-chow, @jkasten2, and @rgomezp)
|
@emawby made the requisite changes, please take a look! |
Description
One Line Summary
Adds Safari inspectability for all WKWebView instances, closes #1277. See https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/ for details.
Details
Motivation
This PR allows developers to view WKWebView instances inside Safari's inspection mechanism for iOS devices. This is necessary for us to verify click tracking in OneSignal Web Views.
Testing
No automated testing added since this is functionally a configuration change.
Manual testing
I've not been able to succeed testing this, seems like the framework cannot be built without certificates.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is