Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,11 @@ - (void)removeEnableFlutterTextInputViewAccessibilityTimer {
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if (_viewController.view == nil) {
result(nil);
return;
}

NSString* method = call.method;
id args = call.arguments;
if ([method isEqualToString:kShowMethod]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ - (FlutterTextRange*)getLineRangeFromTokenizer:(id<UITextInputTokenizer>)tokeniz

#pragma mark - Tests

- (void)testTextInputPluginWillNotHandleMethodWhenViewControllerIsNil {
FlutterEngine* flutterEngine = [[FlutterEngine alloc] init];
FlutterTextInputPlugin* inputPlugin =
[[FlutterTextInputPlugin alloc] initWithDelegate:(id<FlutterTextInputDelegate>)flutterEngine];
XCTAssertNil(inputPlugin.viewController);
FlutterMethodCall* methodCall = [FlutterMethodCall methodCallWithMethodName:@"TextInput.show"
arguments:nil];
[inputPlugin handleMethodCall:methodCall
result:^(id _Nullable result){

}];
XCTAssertNil(inputPlugin.activeView);
}

- (void)testInvokeStartLiveTextInput {
FlutterMethodCall* methodCall =
[FlutterMethodCall methodCallWithMethodName:@"TextInput.startLiveTextInput" arguments:nil];
Expand Down