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

fix: Handle unknown barcode data enum types & disable media controls #1175

Merged

Conversation

navaronbracke
Copy link
Collaborator

@navaronbracke navaronbracke commented Sep 9, 2024

Fixes #1172
Fixes #1174

@@ -1,7 +1,7 @@
/// Wifi encryption type constants.
enum EncryptionType {
/// Unknown encryption type.
none(0),
unknown(0),
Copy link
Collaborator Author

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 0

So 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.

case 1:
return EncryptionType.open;
case 2:
return EncryptionType.wpa;
case 3:
return EncryptionType.wep;
default:
throw ArgumentError.value(value, 'value', 'Invalid raw value.');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This fixes the strange integer 4 that was reported in #1172

@Deprecated(
'EncryptionType.none is deprecated. Use EncryptionType.unknown instead.',
)
static const EncryptionType none = EncryptionType.unknown;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@navaronbracke navaronbracke changed the title Handle unknown barcode data enum types fix: Handle unknown barcode data enum types Sep 9, 2024
@navaronbracke navaronbracke changed the title fix: Handle unknown barcode data enum types fix: Handle unknown barcode data enum types & disable media controls Sep 9, 2024
@@ -88,6 +88,18 @@ class MobileScannerWeb extends MobileScannerPlatform {
..transformOrigin = 'center'
..pointerEvents = 'none';

// Do not show the media controls, as this is a preview element.
// Also prevent play/pause events from changing the media controls.
videoElement.controls = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apparently we did not unset the controls for the video element. iOS WKWebviews might add the controls to the video, unless prevented.

@navaronbracke navaronbracke merged commit 23f3dd3 into juliansteenbakker:master Sep 9, 2024
6 checks passed
@navaronbracke navaronbracke deleted the unknown_encryption_type branch September 9, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant