-
Notifications
You must be signed in to change notification settings - Fork 6k
Add autofill support to ios text input plugin #17493
Add autofill support to ios text input plugin #17493
Conversation
5366c54 to
0d195a6
Compare
0b7faea to
e87f36f
Compare
600d9f7 to
c306f8c
Compare
| } | ||
|
|
||
| - (void)updateEditingClient:(int)client withState:(NSDictionary*)state withTag:(NSString*)tag { | ||
| [_textInputChannel.get() invokeMethod:@"TextInputClient.updateEditingStateWithTag" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be safer if you used performSelector:withObject:withObject: https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418667-performselector?language=objc
That will give you static analysis that the method you are invoking exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @"TextInputClient.updateEditingStateWithTag" does not represent an objective-c selector but a platform message (that will be received and handled by some dart code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, you're right.
| #include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h" | ||
| #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h" | ||
|
|
||
| #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This will be unnecessary after #17624 lands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was talking about the "FLUTTER_EXPORT" not being needed once that lands. We used to have to export things we wanted to tests, now tests live with the code so it isn't necessary.
gaaclarke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please date the PR with a more descriptive title.
| } | ||
|
|
||
| - (void)setAutofillId:(NSString*)autofillId { | ||
| _autofillId = [autofillId copy]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't release the old value. Instead of writing this you can just do@property(nonatomic, copy) NSString* autofillId to have one automatically generated. Put it in the .mm file to make it private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review! I have to put the interface in the header file in order to be able to import that in a unit test (at least for now). Does adding autorelease after copy work here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh your pull request is already merged. I guess that means I can move the interface back to the .mm file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, autorelease can be used on any object.
| } else { | ||
| _activeView = _view; | ||
| NSAssert(clientUniqueId != nil, @"The client's unique id can't be null"); | ||
| for (FlutterTextInputView* v in _inputViews) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < 10; i++)
BlowTheHorn(); // AVOID.
http://google.github.io/styleguide/objcguide.html#conditionals
gaaclarke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry i didn't put all my comments all together in one review, i'm done now =)
a38471f to
ca9262e
Compare
ca9262e to
bec64d3
Compare
gaaclarke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just threw on a change with my outstanding comments into a patch. LGTM now.
Framework PR: flutter/flutter#52126
Moved
FlutterTextInputView's interface to the header file in order to expose it in unit tests.