Merge branch 'possibility_disable_ios_inputAccessoryView' of https://github.com/ppldo/flutter_inappwebview into ppldo-possibility_disable_ios_inputAccessoryView

This commit is contained in:
Lorenzo Pichilli 2022-04-18 01:16:59 +02:00
commit 4cffd1da73
4 changed files with 15 additions and 7 deletions

View File

@ -58,6 +58,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView {
contextMenu: contextMenu, contextMenu: contextMenu,
channel: channel!, channel: channel!,
userScripts: userScripts) userScripts: userScripts)
webView?.disableInputAccessoryView = options.disableInputAccessoryView
} }
methodCallDelegate = InAppWebViewMethodHandler(webView: webView!) methodCallDelegate = InAppWebViewMethodHandler(webView: webView!)

View File

@ -2956,10 +2956,9 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
} }
// var accessoryView: UIView? // var accessoryView: UIView?
// var disableInputAccessoryView = false
// // https://stackoverflow.com/a/58001395/4637638 // https://stackoverflow.com/a/58001395/4637638
// public override var inputAccessoryView: UIView? { public override var inputAccessoryView: UIView? {
// // remove/replace the default accessory view return disableInputAccessoryView ? nil : super.inputAccessoryView
// return accessoryView }
// }
} }

View File

@ -69,6 +69,7 @@ public class InAppWebViewOptions: Options<InAppWebView> {
var applePayAPIEnabled = false var applePayAPIEnabled = false
var allowingReadAccessTo: String? = nil var allowingReadAccessTo: String? = nil
var disableLongPressContextMenuOnLinks = false var disableLongPressContextMenuOnLinks = false
var disableInputAccessoryView = false
override init(){ override init(){
super.init() super.init()

View File

@ -223,6 +223,10 @@ class IOSInAppWebViewOptions
///The default value is `false`. ///The default value is `false`.
bool disableLongPressContextMenuOnLinks; bool disableLongPressContextMenuOnLinks;
///Set to `true` to disable inputAccessoryView above system keyboard
///https://developer.apple.com/documentation/uikit/uiresponder/1621119-inputaccessoryview
bool disableInputAccessoryView;
IOSInAppWebViewOptions( IOSInAppWebViewOptions(
{this.disallowOverScroll = false, {this.disallowOverScroll = false,
this.enableViewportScale = false, this.enableViewportScale = false,
@ -255,7 +259,8 @@ class IOSInAppWebViewOptions
this.useOnNavigationResponse = false, this.useOnNavigationResponse = false,
this.applePayAPIEnabled = false, this.applePayAPIEnabled = false,
this.allowingReadAccessTo, this.allowingReadAccessTo,
this.disableLongPressContextMenuOnLinks = false}) { this.disableLongPressContextMenuOnLinks = false,
this.disableInputAccessoryView = false}) {
assert( assert(
allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file")); allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file"));
} }
@ -303,6 +308,7 @@ class IOSInAppWebViewOptions
"applePayAPIEnabled": applePayAPIEnabled, "applePayAPIEnabled": applePayAPIEnabled,
"allowingReadAccessTo": allowingReadAccessTo.toString(), "allowingReadAccessTo": allowingReadAccessTo.toString(),
"disableLongPressContextMenuOnLinks": disableLongPressContextMenuOnLinks, "disableLongPressContextMenuOnLinks": disableLongPressContextMenuOnLinks,
"disableInputAccessoryView": disableInputAccessoryView,
}; };
} }
@ -365,6 +371,7 @@ class IOSInAppWebViewOptions
: null; : null;
options.disableLongPressContextMenuOnLinks = options.disableLongPressContextMenuOnLinks =
map["disableLongPressContextMenuOnLinks"]; map["disableLongPressContextMenuOnLinks"];
options.disableInputAccessoryView = map["disableInputAccessoryView"];
return options; return options;
} }