From 62ff0a81f5079077375bf8b5eedaa836b5df780f Mon Sep 17 00:00:00 2001 From: Takaki Hoshikawa Date: Mon, 1 Jun 2020 22:59:32 +0900 Subject: [PATCH] add custom UA method for iPadOS --- ios/Classes/FlutterWebviewPlugin.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/Classes/FlutterWebviewPlugin.m b/ios/Classes/FlutterWebviewPlugin.m index fc266094..fa8be359 100644 --- a/ios/Classes/FlutterWebviewPlugin.m +++ b/ios/Classes/FlutterWebviewPlugin.m @@ -142,7 +142,13 @@ - (void)initWebview:(FlutterMethodCall*)call withResult:(FlutterResult)result { self.webview.hidden = [hidden boolValue]; self.webview.scrollView.showsHorizontalScrollIndicator = [scrollBar boolValue]; self.webview.scrollView.showsVerticalScrollIndicator = [scrollBar boolValue]; - + + if (@available(iOS 9.0, *)) { + if (userAgent != (id)[NSNull null]) { + self.webview.customUserAgent = userAgent; + } + } + [self.webview addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:NULL]; WKPreferences* preferences = [[self.webview configuration] preferences];