-
-
Notifications
You must be signed in to change notification settings - Fork 605
fix: Handle unknown barcode data enum types & disable media controls #1175
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
Changes from 4 commits
603410a
065ddf8
bb8a123
5595bf0
6b07dc0
9febbe8
fe6be14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/// Wifi encryption type constants. | ||
enum EncryptionType { | ||
/// Unknown encryption type. | ||
none(0), | ||
unknown(0), | ||
|
||
/// Not encrypted. | ||
open(1), | ||
|
@@ -14,18 +14,23 @@ enum EncryptionType { | |
|
||
const EncryptionType(this.rawValue); | ||
|
||
@Deprecated( | ||
'EncryptionType.none is deprecated. Use EncryptionType.unknown instead.', | ||
) | ||
static const EncryptionType none = EncryptionType.unknown; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For backwards compatibility, Included a static const alias that points to the old name. We can remove this constant in version 6.0.0 |
||
|
||
factory EncryptionType.fromRawValue(int value) { | ||
switch (value) { | ||
case 0: | ||
return EncryptionType.none; | ||
return EncryptionType.unknown; | ||
case 1: | ||
return EncryptionType.open; | ||
case 2: | ||
return EncryptionType.wpa; | ||
case 3: | ||
return EncryptionType.wep; | ||
default: | ||
throw ArgumentError.value(value, 'value', 'Invalid raw value.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes the strange integer 4 that was reported in #1172 |
||
return EncryptionType.unknown; | ||
} | ||
} | ||
|
||
|
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.
As noted in #1172
Android: never reported 'none/unknown'
iOS: reported
MLKBarcodeWiFiEncryptionTypeUnknown
as integer 0So this constant's name is wrong, but the documentation is correct. I opted into deprecating the old name (providing a static const for users to migrate), to match the new, correct behavior.