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 2 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
37 changes: 0 additions & 37 deletions shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -975,24 +975,13 @@ - (void)flutterTextInputView:(FlutterTextInputView*)textInputView
#pragma mark - FlutterViewEngineDelegate

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

- (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
focusElement:(UIScribbleElementIdentifier)elementIdentifier
atPoint:(CGPoint)referencePoint
result:(FlutterResult)callback {
// TODO(justinmc): Remove the TextInputClient usage when the framework has
// finished transitioning to using the Scribble channel.
// https://github.com/flutter/flutter/pull/104128
[_textInputChannel.get()
invokeMethod:@"TextInputClient.focusElement"
arguments:@[ elementIdentifier, @(referencePoint.x), @(referencePoint.y) ]
result:callback];
[_scribbleChannel.get()
invokeMethod:@"Scribble.focusElement"
arguments:@[ elementIdentifier, @(referencePoint.x), @(referencePoint.y) ]
Expand All @@ -1002,55 +991,29 @@ - (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
- (void)flutterTextInputPlugin:(FlutterTextInputPlugin*)textInputPlugin
requestElementsInRect:(CGRect)rect
result:(FlutterResult)callback {
// TODO(justinmc): Remove the TextInputClient usage when the framework has
// finished transitioning to using the Scribble channel.
// https://github.com/flutter/flutter/pull/104128
[_scribbleChannel.get()
invokeMethod:@"Scribble.requestElementsInRect"
arguments:@[ @(rect.origin.x), @(rect.origin.y), @(rect.size.width), @(rect.size.height) ]
result:callback];
[_textInputChannel.get()
invokeMethod:@"TextInputClient.requestElementsInRect"
arguments:@[ @(rect.origin.x), @(rect.origin.y), @(rect.size.width), @(rect.size.height) ]
result:callback];
}

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
@"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 @@ -2174,12 +2170,6 @@ - (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
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,38 @@ - (void)testScribbleSetSelectionRects {
XCTAssertEqual([textInputPlugin.activeView.selectionRects count], 1u);
}

- (void)testScribbleSetSelectionRectsTICFails {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test useful, or should I get a text exemption?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this adds any value. This patch remove the deprecated stuff in a two-step transition. I think we should land this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 we should just get an exempt.

NSMutableDictionary* regularField = self.mutableTemplateCopy;
NSDictionary* editingValue = @{
@"text" : @"REGULAR_TEXT_FIELD",
@"composingBase" : @0,
@"composingExtent" : @3,
@"selectionBase" : @1,
@"selectionExtent" : @4
};
[regularField setValue:@{
@"uniqueIdentifier" : @"field1",
@"hints" : @[ @"hint2" ],
@"editingValue" : editingValue,
}
forKey:@"autofill"];
[regularField addEntriesFromDictionary:editingValue];
[self setClientId:123 configuration:regularField];
XCTAssertEqual(self.installedInputViews.count, 1ul);
XCTAssertEqual([textInputPlugin.activeView.selectionRects count], 0u);

NSArray<NSNumber*>* selectionRect = [NSArray arrayWithObjects:@0, @0, @100, @100, @0, nil];
NSArray* selectionRects = [NSArray arrayWithObjects:selectionRect, nil];
FlutterMethodCall* methodCall =
[FlutterMethodCall methodCallWithMethodName:@"TextInputClient.setSelectionRects"
arguments:selectionRects];
XCTAssertThrows([textInputPlugin handleMethodCall:methodCall
result:^(id _Nullable result){
}]);

XCTAssertEqual([textInputPlugin.activeView.selectionRects count], 0u);
}

- (void)testDecommissionedViewAreNotReusedByAutofill {
// Regression test for https://github.com/flutter/flutter/issues/84407.
NSMutableDictionary* configuration = self.mutableTemplateCopy;
Expand Down