renamed findAllAsync to findAll
This commit is contained in:
parent
b4558d356a
commit
e9b059b2e2
@ -24,7 +24,7 @@ public class FindInteractionChannelDelegate extends ChannelDelegateImpl {
|
||||
@Override
|
||||
public void onMethodCall(@NonNull MethodCall call, @NonNull final MethodChannel.Result result) {
|
||||
switch (call.method) {
|
||||
case "findAllAsync":
|
||||
case "findAll":
|
||||
if (findInteractionController != null && findInteractionController.webView != null) {
|
||||
String find = (String) call.argument("find");
|
||||
findInteractionController.webView.findAllAsync(find);
|
||||
|
@ -289,7 +289,7 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
|
||||
webView.clearSslPreferences();
|
||||
result.success(true);
|
||||
break;
|
||||
case findAllAsync:
|
||||
case findAll:
|
||||
if (webView != null) {
|
||||
String find = (String) call.argument("find");
|
||||
webView.findAllAsync(find);
|
||||
|
@ -31,7 +31,11 @@ public enum WebViewChannelDelegateMethods {
|
||||
startSafeBrowsing,
|
||||
clearCache,
|
||||
clearSslPreferences,
|
||||
findAllAsync,
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
findAll,
|
||||
findNext,
|
||||
clearMatches,
|
||||
scrollTo,
|
||||
|
@ -45,7 +45,7 @@ void findInteractions() {
|
||||
|
||||
const firstSearchText = "InAppWebViewInitialFileTest";
|
||||
await expectLater(
|
||||
findInteractionController.findAllAsync(find: firstSearchText),
|
||||
findInteractionController.findAll(find: firstSearchText),
|
||||
completes);
|
||||
if ([TargetPlatform.iOS, TargetPlatform.macOS]
|
||||
.contains(defaultTargetPlatform)) {
|
||||
@ -117,7 +117,7 @@ void findInteractions() {
|
||||
await tester.pump();
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
await controller.findAllAsync(find: "InAppWebViewInitialFileTest");
|
||||
await controller.findAll(find: "InAppWebViewInitialFileTest");
|
||||
final int numberOfMatches = await numberOfMatchesCompleter.future;
|
||||
expect(numberOfMatches, 2);
|
||||
}, skip: shouldSkip);
|
||||
|
@ -19,10 +19,10 @@ public class FindInteractionChannelDelegate : ChannelDelegate {
|
||||
let arguments = call.arguments as? NSDictionary
|
||||
|
||||
switch call.method {
|
||||
case "findAllAsync":
|
||||
case "findAll":
|
||||
if let findInteractionController = findInteractionController {
|
||||
let find = arguments!["find"] as! String
|
||||
findInteractionController.findAllAsync(find: find, completionHandler: {(value, error) in
|
||||
findInteractionController.findAll(find: find, completionHandler: {(value, error) in
|
||||
if error != nil {
|
||||
result(FlutterError(code: "FindInteractionChannelDelegate", message: error?.localizedDescription, details: nil))
|
||||
return
|
||||
|
@ -31,7 +31,7 @@ public class FindInteractionController : NSObject, Disposable {
|
||||
// }
|
||||
}
|
||||
|
||||
public func findAllAsync(find: String?, completionHandler: ((Any?, Error?) -> Void)?) {
|
||||
public func findAll(find: String?, completionHandler: ((Any?, Error?) -> Void)?) {
|
||||
guard let webView else {
|
||||
if let completionHandler = completionHandler {
|
||||
completionHandler(nil, nil)
|
||||
|
@ -209,10 +209,10 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
||||
case .getCopyBackForwardList:
|
||||
result(webView?.getCopyBackForwardList())
|
||||
break
|
||||
case .findAllAsync:
|
||||
case .findAll:
|
||||
if let webView = webView, let findInteractionController = webView.findInteractionController {
|
||||
let find = arguments!["find"] as! String
|
||||
findInteractionController.findAllAsync(find: find, completionHandler: {(value, error) in
|
||||
findInteractionController.findAll(find: find, completionHandler: {(value, error) in
|
||||
if error != nil {
|
||||
result(FlutterError(code: "WebViewChannelDelegate", message: error?.localizedDescription, details: nil))
|
||||
return
|
||||
|
@ -35,8 +35,8 @@ public enum WebViewChannelDelegateMethods: String {
|
||||
case show = "show"
|
||||
case hide = "hide"
|
||||
case getCopyBackForwardList = "getCopyBackForwardList"
|
||||
@available(*, deprecated, message: "Use FindInteractionController.findAllAsync instead.")
|
||||
case findAllAsync = "findAllAsync"
|
||||
@available(*, deprecated, message: "Use FindInteractionController.findAll instead.")
|
||||
case findAll = "findAll"
|
||||
@available(*, deprecated, message: "Use FindInteractionController.findNext instead.")
|
||||
case findNext = "findNext"
|
||||
@available(*, deprecated, message: "Use FindInteractionController.clearMatches instead.")
|
||||
|
@ -106,13 +106,13 @@ class FindInteractionController {
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView ([Official API - WebView.findAllAsync](https://developer.android.com/reference/android/webkit/WebView#findAllAsync(java.lang.String)))
|
||||
///- iOS (if [InAppWebViewSettings.isFindInteractionEnabled] is `true`: [Official API - UIFindInteraction.presentFindNavigator](https://developer.apple.com/documentation/uikit/uifindinteraction/3975832-presentfindnavigator?changes=_2) with [Official API - UIFindInteraction.searchText](https://developer.apple.com/documentation/uikit/uifindinteraction/3975834-searchtext?changes=_2))
|
||||
Future<void> findAllAsync({required String find}) async {
|
||||
Future<void> findAll({required String find}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('find', () => find);
|
||||
await _channel?.invokeMethod('findAllAsync', args);
|
||||
await _channel?.invokeMethod('findAll', args);
|
||||
}
|
||||
|
||||
///Highlights and scrolls to the next match found by [findAllAsync]. Notifies [FindInteractionController.onFindResultReceived] listener.
|
||||
///Highlights and scrolls to the next match found by [findAll]. Notifies [FindInteractionController.onFindResultReceived] listener.
|
||||
///
|
||||
///[forward] represents the direction to search.
|
||||
///
|
||||
@ -129,7 +129,7 @@ class FindInteractionController {
|
||||
await _channel?.invokeMethod('findNext', args);
|
||||
}
|
||||
|
||||
///Clears the highlighting surrounding text matches created by [findAllAsync].
|
||||
///Clears the highlighting surrounding text matches created by [findAll].
|
||||
///
|
||||
///**NOTE**: on iOS, if [InAppWebViewSettings.isFindInteractionEnabled] is `true`,
|
||||
///it uses the built-in find interaction native UI,
|
||||
|
@ -2187,12 +2187,12 @@ class InAppWebViewController {
|
||||
await _channel.invokeMethod('clearCache', args);
|
||||
}
|
||||
|
||||
///Use [FindInteractionController.findAllAsync] instead.
|
||||
@Deprecated("Use FindInteractionController.findAllAsync instead")
|
||||
///Use [FindInteractionController.findAll] instead.
|
||||
@Deprecated("Use FindInteractionController.findAll instead")
|
||||
Future<void> findAllAsync({required String find}) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('find', () => find);
|
||||
await _channel.invokeMethod('findAllAsync', args);
|
||||
await _channel.invokeMethod('findAll', args);
|
||||
}
|
||||
|
||||
///Use [FindInteractionController.findNext] instead.
|
||||
|
Loading…
x
Reference in New Issue
Block a user