Skip to content

Commit

Permalink
RUMM-1931 PR comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
buranmert committed Feb 8, 2022
1 parent 773f394 commit c43e372
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class ShopistWebviewViewController: UIViewController {
private let request = URLRequest(url: URL(string: "https://shopist.io")!)
private var webView: WKWebView!

deinit {
webView.configuration.userContentController.stopTrackingDatadogEvents()
}

override func viewDidLoad() {
super.viewDidLoad()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public extension WKUserContentController {
/// Disables Datadog iOS SDK and Datadog Browser SDK integration.
///
/// Removes Datadog's ScriptMessageHandler and UserScript from the caller.
/// _NOTE:_ This method **must** be called when the webview can be deinitialized.
/// - Note: This method **must** be called when the webview can be deinitialized.
func stopTrackingDatadogEvents() {
removeScriptMessageHandler(forName: DatadogMessageHandler.name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ final class DDUserContentController: WKUserContentController {
}

final class MockMessageHandler: NSObject, WKScriptMessageHandler {
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
return
}
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { }
}

final class MockScriptMessage: WKScriptMessage {
Expand Down

0 comments on commit c43e372

Please sign in to comment.