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,
channel: channel!,
userScripts: userScripts)
webView?.disableInputAccessoryView = options.disableInputAccessoryView
}
methodCallDelegate = InAppWebViewMethodHandler(webView: webView!)

View File

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

View File

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

View File

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