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

Commit c9d474c

Browse files
justinmcjmagman
authored andcommitted
Revert "Remove deprecated TextInputClient scribble method code" (#39516)
Fixes the scribble feature (iPad handwriting input via Apple Pencil).
1 parent 248290d commit c9d474c

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

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

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -975,46 +975,69 @@ - (void)flutterTextInputView:(FlutterTextInputView*)textInputView
975975
#pragma mark - FlutterViewEngineDelegate
976976

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

981984
- (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
982985
focusElement:(UIScribbleElementIdentifier)elementIdentifier
983986
atPoint:(CGPoint)referencePoint
984987
result:(FlutterResult)callback {
985-
[_scribbleChannel.get()
986-
invokeMethod:@"Scribble.focusElement"
988+
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
989+
// the framework has finished transitioning to the Scribble channel.
990+
// https://github.com/flutter/flutter/pull/115296
991+
[_textInputChannel.get()
992+
invokeMethod:@"TextInputClient.focusElement"
987993
arguments:@[ elementIdentifier, @(referencePoint.x), @(referencePoint.y) ]
988994
result:callback];
989995
}
990996

991997
- (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
992998
requestElementsInRect:(CGRect)rect
993999
result:(FlutterResult)callback {
994-
[_scribbleChannel.get()
995-
invokeMethod:@"Scribble.requestElementsInRect"
1000+
// TODO(justinmc): Switch from the TextInputClient to Scribble channel when
1001+
// the framework has finished transitioning to the Scribble channel.
1002+
// https://github.com/flutter/flutter/pull/115296
1003+
[_textInputChannel.get()
1004+
invokeMethod:@"TextInputClient.requestElementsInRect"
9961005
arguments:@[ @(rect.origin.x), @(rect.origin.y), @(rect.size.width), @(rect.size.height) ]
9971006
result:callback];
9981007
}
9991008

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

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

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

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

10201043
- (void)flutterTextInputViewDidResignFirstResponder:(FlutterTextInputView*)textInputView {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
@"TextInput.setEditableSizeAndTransform";
4949
static NSString* const kSetMarkedTextRectMethod = @"TextInput.setMarkedTextRect";
5050
static NSString* const kFinishAutofillContextMethod = @"TextInput.finishAutofillContext";
51+
// TODO(justinmc): Remove the TextInput method constant when the framework has
52+
// finished transitioning to using the Scribble channel.
53+
// https://github.com/flutter/flutter/pull/104128
54+
static NSString* const kDeprecatedSetSelectionRectsMethod = @"TextInput.setSelectionRects";
5155
static NSString* const kSetSelectionRectsMethod = @"Scribble.setSelectionRects";
5256
static NSString* const kStartLiveTextInputMethod = @"TextInput.startLiveTextInput";
5357

@@ -2170,6 +2174,12 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
21702174
} else if ([method isEqualToString:kFinishAutofillContextMethod]) {
21712175
[self triggerAutofillSave:[args boolValue]];
21722176
result(nil);
2177+
// TODO(justinmc): Remove the TextInput method constant when the framework has
2178+
// finished transitioning to using the Scribble channel.
2179+
// https://github.com/flutter/flutter/pull/104128
2180+
} else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
2181+
[self setSelectionRects:args];
2182+
result(nil);
21732183
} else if ([method isEqualToString:kSetSelectionRectsMethod]) {
21742184
[self setSelectionRects:args];
21752185
result(nil);

0 commit comments

Comments
 (0)