Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 75fabbe

Browse files
authored
Revert "[iOS] Send connectionClosed message when resignFirstResponder to ensure framework focus state is correct. (#40703)" (#40777)
Revert "[iOS] Send connectionClosed message when resignFirstResponder to ensure framework focus state is correct."
1 parent 14e536b commit 75fabbe

File tree

4 files changed

+4
-30
lines changed

4 files changed

+4
-30
lines changed

shell/platform/darwin/ios/framework/Source/FlutterEngine.mm

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,14 +1095,7 @@ - (void)flutterTextInputView:(FlutterTextInputView*)textInputView
10951095
arguments:@[ @(client) ]];
10961096
}
10971097

1098-
- (void)flutterTextInputView:(FlutterTextInputView*)textInputView
1099-
didResignFirstResponderWithTextInputClient:(int)client {
1100-
// When flutter text input view resign first responder, send a message to
1101-
// framework to ensure the focus state is correct. This is useful when close
1102-
// keyboard from platform side.
1103-
[_textInputChannel.get() invokeMethod:@"TextInputClient.onConnectionClosed"
1104-
arguments:@[ @(client) ]];
1105-
1098+
- (void)flutterTextInputViewDidResignFirstResponder:(FlutterTextInputView*)textInputView {
11061099
// Platform view's first responder detection logic:
11071100
//
11081101
// All text input widgets (e.g. EditableText) are backed by a dummy UITextInput view

shell/platform/darwin/ios/framework/Source/FlutterEngineTest.mm

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@
1313
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterBinaryMessengerRelay.h"
1414
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
1515
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Test.h"
16-
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
1716

1817
FLUTTER_ASSERT_ARC
1918

20-
@interface FlutterEngine () <FlutterTextInputDelegate>
21-
22-
@end
23-
2419
@interface FlutterEngineTest : XCTestCase
2520
@end
2621

@@ -318,17 +313,4 @@ - (void)testCanEnableDisableEmbedderAPIThroughInfoPlist {
318313
}
319314
}
320315

321-
- (void)testFlutterTextInputViewDidResignFirstResponderWillCallTextInputClientConnectionClosed {
322-
id mockBinaryMessenger = OCMClassMock([FlutterBinaryMessengerRelay class]);
323-
FlutterEngine* engine = [[FlutterEngine alloc] init];
324-
[engine setBinaryMessenger:mockBinaryMessenger];
325-
[engine runWithEntrypoint:FlutterDefaultDartEntrypoint initialRoute:@"test"];
326-
[engine flutterTextInputView:nil didResignFirstResponderWithTextInputClient:1];
327-
FlutterMethodCall* methodCall =
328-
[FlutterMethodCall methodCallWithMethodName:@"TextInputClient.onConnectionClosed"
329-
arguments:@[ @(1) ]];
330-
NSData* encodedMethodCall = [[FlutterJSONMethodCodec sharedInstance] encodeMethodCall:methodCall];
331-
OCMVerify([mockBinaryMessenger sendOnChannel:@"flutter/textinput" message:encodedMethodCall]);
332-
}
333-
334316
@end

shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ typedef NS_ENUM(NSInteger, FlutterFloatingCursorDragState) {
5959
insertTextPlaceholderWithSize:(CGSize)size
6060
withClient:(int)client;
6161
- (void)flutterTextInputView:(FlutterTextInputView*)textInputView removeTextPlaceholder:(int)client;
62-
- (void)flutterTextInputView:(FlutterTextInputView*)textInputView
63-
didResignFirstResponderWithTextInputClient:(int)client;
62+
- (void)flutterTextInputViewDidResignFirstResponder:(FlutterTextInputView*)textInputView;
63+
6464
@end
6565

6666
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERTEXTINPUTDELEGATE_H_

shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,7 @@ - (BOOL)canBecomeFirstResponder {
10431043
- (BOOL)resignFirstResponder {
10441044
BOOL success = [super resignFirstResponder];
10451045
if (success) {
1046-
[self.textInputDelegate flutterTextInputView:self
1047-
didResignFirstResponderWithTextInputClient:_textInputClient];
1046+
[self.textInputDelegate flutterTextInputViewDidResignFirstResponder:self];
10481047
}
10491048
return success;
10501049
}

0 commit comments

Comments
 (0)