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

Conversation

@gaaclarke
Copy link
Member

Relevant issue: flutter/flutter#55624
This is a more stable alternative to #16270

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

Comment about being more defensive against missing keys. Rest lgtm.


if (@available(iOS 9, *)) {
// Ignore keyboard notifications related to other apps.
if (![info[UIKeyboardIsLocalUserInfoKey] boolValue]) {
Copy link
Member

@chinmaygarde chinmaygarde Apr 27, 2020

Choose a reason for hiding this comment

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

I couldn't find guidance in the documentation on whether this key will always be present. The discussion in the docs seems to be around multitasking on iPad. As it stands, if the key is not present in the dictionary, the frame change will be ignored. A more defensive writing of this piece of code would be to check if the key exists and then check its bool value. If the key doesn't exist, process the frame change as normal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. In practice it isn't just iPad, these were the very notifications that were messing us up and I was testing with iPhone. I believe the key is always present (except iOS 8). It doesn't hurt to make it safer.

@gaaclarke gaaclarke merged commit 5f437fb into flutter:master Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants