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 all commits
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
43 changes: 33 additions & 10 deletions shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -975,46 +975,69 @@ - (void)flutterTextInputView:(FlutterTextInputView*)textInputView
#pragma mark - FlutterViewEngineDelegate

- (void)flutterTextInputView:(FlutterTextInputView*)textInputView showToolbar:(int)client {
[_scribbleChannel.get() invokeMethod:@"Scribble.showToolbar" arguments:@[ @(client) ]];
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get() invokeMethod:@"TextInputClient.showToolbar" arguments:@[ @(client) ]];
}

- (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
focusElement:(UIScribbleElementIdentifier)elementIdentifier
atPoint:(CGPoint)referencePoint
result:(FlutterResult)callback {
[_scribbleChannel.get()
invokeMethod:@"Scribble.focusElement"
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get()
invokeMethod:@"TextInputClient.focusElement"
arguments:@[ elementIdentifier, @(referencePoint.x), @(referencePoint.y) ]
result:callback];
}

- (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
requestElementsInRect:(CGRect)rect
result:(FlutterResult)callback {
[_scribbleChannel.get()
invokeMethod:@"Scribble.requestElementsInRect"
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get()
invokeMethod:@"TextInputClient.requestElementsInRect"
arguments:@[ @(rect.origin.x), @(rect.origin.y), @(rect.size.width), @(rect.size.height) ]
result:callback];
}

- (void)flutterTextInputViewScribbleInteractionBegan:(FlutterTextInputView*)textInputView {
[_scribbleChannel.get() invokeMethod:@"Scribble.scribbleInteractionBegan" arguments:nil];
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get() invokeMethod:@"TextInputClient.scribbleInteractionBegan" arguments:nil];
}

- (void)flutterTextInputViewScribbleInteractionFinished:(FlutterTextInputView*)textInputView {
[_scribbleChannel.get() invokeMethod:@"Scribble.scribbleInteractionFinished" arguments:nil];
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get() invokeMethod:@"TextInputClient.scribbleInteractionFinished"
arguments:nil];
}

- (void)flutterTextInputView:(FlutterTextInputView*)textInputView
insertTextPlaceholderWithSize:(CGSize)size
withClient:(int)client {
[_scribbleChannel.get() invokeMethod:@"Scribble.insertTextPlaceholder"
arguments:@[ @(client), @(size.width), @(size.height) ]];
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get() invokeMethod:@"TextInputClient.insertTextPlaceholder"
arguments:@[ @(client), @(size.width), @(size.height) ]];
}

- (void)flutterTextInputView:(FlutterTextInputView*)textInputView
removeTextPlaceholder:(int)client {
[_scribbleChannel.get() invokeMethod:@"Scribble.removeTextPlaceholder" arguments:@[ @(client) ]];
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
// the framework has finished transitioning to the Scribble channel.
// https://github.com/flutter/flutter/pull/115296
[_textInputChannel.get() invokeMethod:@"TextInputClient.removeTextPlaceholder"
arguments:@[ @(client) ]];
}

- (void)flutterTextInputViewDidResignFirstResponder:(FlutterTextInputView*)textInputView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
@"TextInput.setEditableSizeAndTransform";
static NSString* const kSetMarkedTextRectMethod = @"TextInput.setMarkedTextRect";
static NSString* const kFinishAutofillContextMethod = @"TextInput.finishAutofillContext";
// TODO(justinmc): Remove the TextInput method constant when the framework has
// finished transitioning to using the Scribble channel.
// https://github.com/flutter/flutter/pull/104128
static NSString* const kDeprecatedSetSelectionRectsMethod = @"TextInput.setSelectionRects";
static NSString* const kSetSelectionRectsMethod = @"Scribble.setSelectionRects";
static NSString* const kStartLiveTextInputMethod = @"TextInput.startLiveTextInput";

Expand Down Expand Up @@ -2170,6 +2174,12 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
} else if ([method isEqualToString:kFinishAutofillContextMethod]) {
[self triggerAutofillSave:[args boolValue]];
result(nil);
// TODO(justinmc): Remove the TextInput method constant when the framework has
// finished transitioning to using the Scribble channel.
// https://github.com/flutter/flutter/pull/104128
} else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
[self setSelectionRects:args];
result(nil);
} else if ([method isEqualToString:kSetSelectionRectsMethod]) {
[self setSelectionRects:args];
result(nil);
Expand Down