Skip to content
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

Add support for raw key events on Fuchsia #6754

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

abarth
Copy link
Contributor

@abarth abarth commented Nov 8, 2016

See #6631

@abarth
Copy link
Contributor Author

abarth commented Nov 8, 2016

@Hixie

/// If there is no unicode code point, this value is zero.
final int codePoint;
}

/// Base class for raw key events.
///
/// Raw key events pass through as much information as possible from the
Copy link
Contributor

Choose a reason for hiding this comment

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

"makes they" on line 89 is grammatically dubious, while you're here...

@@ -110,6 +134,12 @@ RawKeyEvent _toRawKeyEvent(dynamic message) {
metaState: message['metaState'] ?? 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

before the switch, maybe in the argument type, assert that message is a Map

Copy link
Contributor

Choose a reason for hiding this comment

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

...and that it contains a key 'keymap'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there's no keymap, it will hit the default case and throw an exception

hidUsage: message['hidUsage'] ?? 0,
codePoint: message['codePoint'] ?? 0,
);
break;
default:
throw new FlutterError('Unknown keymap for key events: $keymap');
Copy link
Contributor

Choose a reason for hiding this comment

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

how does this avoid crashing on iOS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't generate these messages on iOS.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment explaining this.

hidUsage: message['hidUsage'] ?? 0,
codePoint: message['codePoint'] ?? 0,
);
break;
default:
throw new FlutterError('Unknown keymap for key events: $keymap');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

just below here, assert that message has a 'type' key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made this switch follow the pattern from the other switch, so you'll hit the default case and trigger an exception.

@Hixie
Copy link
Contributor

Hixie commented Nov 9, 2016

LGTM

@Hixie
Copy link
Contributor

Hixie commented Nov 9, 2016

no tests?

@abarth abarth merged commit d8e6de8 into flutter:master Nov 15, 2016
@abarth abarth deleted the raw_keys_fuchsia branch November 15, 2016 18:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants