From c31592e9e42d6c3fa521ab5e98fb0420ade2d7b2 Mon Sep 17 00:00:00 2001 From: salmannawaz Date: Mon, 3 Sep 2018 18:06:47 +0500 Subject: [PATCH] In-App banner is showing in programs (#1154) * LEARNER-6308, fix to remove banner in programs. --- Source/AuthenticatedWebViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/AuthenticatedWebViewController.swift b/Source/AuthenticatedWebViewController.swift index 875bde1bd4..e9b78d6d3b 100644 --- a/Source/AuthenticatedWebViewController.swift +++ b/Source/AuthenticatedWebViewController.swift @@ -60,6 +60,12 @@ private class WKWebViewContentController : WebContentController { } func loadURLRequest(request: NSURLRequest) { + // If the view initialize before registering userAgent the request goes without the required userAgent, + // to solve this we are setting customeUserAgent here. + if let userAgent = UserDefaults.standard.string(forKey: "UserAgent"), webView.customUserAgent?.isEmpty ?? false { + webView.customUserAgent = userAgent + } + webView.load(request as URLRequest) }