-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Handle privatecommand messages that pass no data #112590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1837,7 +1837,9 @@ class TextInput { | |||
final Map<String, dynamic> firstArg = args[1] as Map<String, dynamic>; | |||
_currentConnection!._client.performPrivateCommand( | |||
firstArg['action'] as String, | |||
firstArg['data'] as Map<String, dynamic>, | |||
firstArg['data'] == null |
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.
nit: as Map<String, dynamic>?
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 duh, that's awesome that we can do that 👍
@@ -1134,7 +1134,7 @@ mixin TextInputClient { | |||
/// * [sendAppPrivateCommand](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager#sendAppPrivateCommand), | |||
/// which is the Android documentation for sendAppPrivateCommand, used to | |||
/// send a command to the input method. | |||
void performPrivateCommand(String action, Map<String, dynamic> data); | |||
void performPrivateCommand(String action, Map<String, dynamic>? data); |
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 breaks internal tests I think?
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'll try running the Google tests on this PR when it goes green. I thought about just creating an empty map if it's null and keeping this parameter the same non-nullable, but it felt dirty. I'll consider just migrating any breakages myself if it's not too crazy.
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've requested Google tests but it's not showing up here... This never works for me. Maybe because the PR has no LGTM yet?
I LGTM'd earlier, google testing is now finished. |
Ah sorry you're right. Well it looks like there are tons of breaking changes from that. I should have assumed lots of people are implementing TextInputClient. I will use an empty Map to avoid the breaking change. |
94bb048
to
359d567
Compare
auto label is removed for flutter/flutter, pr: 112590, due to - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label. |
@LongCatIsLooong @justinmc given the small size of the fix can it be cherry picked into stable or beta, as it's flooding crashlytics on old Android devices with each tap in a text field, related issue #113973 |
I agree with that, it would be a very low-risk cherry pick. @absar Can you create a new cherry pick request issue? (New Issue, then choose "Request a cherry-pick"). Tag me and @itsjustkevin please. |
…114461) Co-authored-by: Justin McCandless <[email protected]>
@justinmc I don't see this in beta branch, it should be cherry-picked there as well |
@absar Now it looks like it's released on beta. flutter/packages/flutter/lib/src/services/text_input.dart Lines 1880 to 1882 in 7592730
|
Currently, if a
TextInputClient.performPrivateCommand
platform message is sent that has nodata
key, the framework will not know how to handle it and will throw an error. This PR properly handles this situation and eliminates the error.The engine purposely sends a map with no
data
key in situations where the data map isn't used (code).This PR allows receiving a null value and passing it through to onAppPrivateCommand.