Merge pull request #1095 from sunalwaysknows/master

fix: ApplicationNameForUserAgent is not working in iOS
This commit is contained in:
Lorenzo Pichilli 2022-04-15 20:35:50 +02:00 committed by GitHub
commit 65e00b8d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -407,9 +407,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
if #available(iOS 9.0, *) {
configuration.allowsAirPlayForMediaPlayback = options.allowsAirPlayForMediaPlayback
configuration.allowsPictureInPictureMediaPlayback = options.allowsPictureInPictureMediaPlayback
if !options.applicationNameForUserAgent.isEmpty {
configuration.applicationNameForUserAgent = options.applicationNameForUserAgent
}
}
configuration.preferences.javaScriptCanOpenWindowsAutomatically = options.javaScriptCanOpenWindowsAutomatically
@ -501,6 +498,11 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
} else if options.cacheEnabled {
configuration.websiteDataStore = WKWebsiteDataStore.default()
}
if !options.applicationNameForUserAgent.isEmpty {
if let applicationNameForUserAgent = configuration.applicationNameForUserAgent {
configuration.applicationNameForUserAgent = applicationNameForUserAgent + " " + options.applicationNameForUserAgent
}
}
}
if #available(iOS 10.0, *) {