-
Notifications
You must be signed in to change notification settings - Fork 7
[APTT-27] WKWebView / UIWebView - Send HTTP/S network request status information to backend. #41
Conversation
Codecov Report
@@ Coverage Diff @@
## master #41 +/- ##
==========================================
- Coverage 88.59% 80.23% -8.37%
==========================================
Files 25 25
Lines 1280 1285 +5
==========================================
- Hits 1134 1031 -103
- Misses 146 254 +108
Continue to review full report at Codecov.
|
if (statusCode != 0) | ||
{ | ||
measurement.statusCode = statusCode; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, instead of this workaround I think it would be better to replace this method with an update:statusCode
method that is called from the decidePolicyForNavigationResponse swizzle when there is a valid trackingId associated object.
…information to backend.
@@ -148,7 +148,7 @@ + (void)_swizzleUIWebViewDelegate:(id<UIWebViewDelegate>)delegate | |||
uint_fast64_t trackingIdentifier = [objc_getAssociatedObject(webView, _RPT_UIWEBVIEW_TRACKINGIDENTIFIER) unsignedLongLongValue]; | |||
if (trackingIdentifier) | |||
{ | |||
[_RPTTrackingManager.sharedInstance.tracker end:trackingIdentifier statusCode:httpResponse.statusCode]; | |||
[_RPTTrackingManager.sharedInstance.tracker updateStatusCode:httpResponse.statusCode trackingIdentifier:trackingIdentifier]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only update the statusCode for didFinishLoad.
I think we should also do it for didFailLoad if we can get access to the httpurlresponse.
Then that common logic can be extracted into a helper method.
.travis.yml
Outdated
@@ -4,6 +4,8 @@ xcode_scheme: Tests | |||
osx_image: xcode9.1 | |||
|
|||
before_install: | |||
- gem uninstall --force -x -i /Users/travis/.rvm/gems/ruby-2.4.2@global xcodeproj | |||
- gem install -q -N -f --no-update-sources xcodeproj:1.5.7 | |||
- gem update fastlane --no-ri --no-rdoc --no-document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a workaround like this please add a FIXME comment that references the responsible ticket CocoaPods/Xcodeproj#572 so that we remember to remove the workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline comments
.travis.yml
Outdated
@@ -4,6 +4,8 @@ xcode_scheme: Tests | |||
osx_image: xcode9.1 | |||
|
|||
before_install: | |||
- gem uninstall --force -x -i /Users/travis/.rvm/gems/ruby-2.4.2@global xcodeproj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: why do we provide a full to the gem? Wouldn't be enough to just say gem uninstall xcodeproj
cause it seems that we're using default ruby version everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, without the full path it failed and the travis log suggested using that path. On jenkins I didn't specify the full path.
@@ -148,7 +148,7 @@ + (void)_swizzleUIWebViewDelegate:(id<UIWebViewDelegate>)delegate | |||
uint_fast64_t trackingIdentifier = [objc_getAssociatedObject(webView, _RPT_UIWEBVIEW_TRACKINGIDENTIFIER) unsignedLongLongValue]; | |||
if (trackingIdentifier) | |||
{ | |||
[_RPTTrackingManager.sharedInstance.tracker end:trackingIdentifier statusCode:httpResponse.statusCode]; | |||
[_RPTTrackingManager.sharedInstance.tracker updateStatusCode:httpResponse.statusCode trackingIdentifier:trackingIdentifier]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a helper for updating status code+static void updateStatusCodeForWebView(NSInteger statusCode, WKWebView *webView)
a bit below. Why not to use it here?
No description provided.