-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[webview_flutter] Fix input bug on route changes #1853
Conversation
Fixes bug where the InputConnection proxy view was persisting across multiple WebView creation calls.
|
||
/** | ||
* This is the crucial trick that gets the InputConnection creation to happen on the correct | ||
* thread. |
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: "... pre Android N."
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.
Done.
* <p>{@code targetView} should have a {@link View#getHandler} method with the thread that future | ||
* InputConnections should be created on. | ||
*/ | ||
private void setInputConnectionThread(final View targetView) { |
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: Maybe call it setInputConnectionTarget? (as the parameter is the target which also specified the thread, and not the thread itself.)
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.
Done.
} | ||
|
||
/** | ||
* Ensure that input creation happens back on {@link #containerView}'s thread. |
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.
Maybe: Ensure that input connection creation happens back on {@link #containerView}
.
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.
Done.
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 also realized that the variable names in setInputConnectionTarget
's comments were outdated, so those are updated the latest patch too.
} | ||
|
||
/** | ||
* Ensure that input creation happens back on {@link #containerView}'s thread. |
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.
Done.
|
||
/** | ||
* This is the crucial trick that gets the InputConnection creation to happen on the correct | ||
* thread. |
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.
Done.
* <p>{@code targetView} should have a {@link View#getHandler} method with the thread that future | ||
* InputConnections should be created on. | ||
*/ | ||
private void setInputConnectionThread(final View targetView) { |
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.
Done.
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.
LGTM!
Fixes bug where the InputConnection proxy view was persisting across multiple WebView creation calls.
Description
Fixes bug where the InputConnection proxy view was persisting across
multiple WebView creation calls.
Manually tested with mklim/plugins@3e033be.
Related Issues
flutter/flutter#19718
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?