Merge branch 'fix/imm' of https://github.com/vespr-wallet/flutter_inappwebview into vespr-wallet-fix/imm

This commit is contained in:
Lorenzo Pichilli 2023-11-10 21:06:10 +01:00
commit fb7e025ee0
2 changed files with 11 additions and 3 deletions

View File

@ -1525,7 +1525,15 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
public void run() {
InputMethodManager imm =
(InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
if (containerView != null && imm != null && !imm.isAcceptingText()) {
boolean isAcceptingText = false;
try {
if (imm != null) {
// imm.isAcceptingText() seems to sometimes crash on some devices
isAcceptingText = imm.isAcceptingText();
}
} catch (Exception ignored) {
}
if (containerView != null && imm != null && !isAcceptingText) {
imm.hideSoftInputFromWindow(
containerView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

View File

@ -1878,7 +1878,7 @@ class InAppWebViewController {
///- MacOS ([Official API - WKWebView.canGoBack](https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback))
Future<bool> canGoBack() async {
Map<String, dynamic> args = <String, dynamic>{};
return await _channel?.invokeMethod('canGoBack', args);
return await _channel?.invokeMethod<bool>('canGoBack', args) ?? false;
}
///Goes forward in the history of the WebView.
@ -1903,7 +1903,7 @@ class InAppWebViewController {
///- MacOS ([Official API - WKWebView.canGoForward](https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward))
Future<bool> canGoForward() async {
Map<String, dynamic> args = <String, dynamic>{};
return await _channel?.invokeMethod('canGoForward', args);
return await _channel?.invokeMethod('canGoForward', args) ?? false;
}
///Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward.