Committed by
GitHub
Merge pull request #1025 from navaronbracke/release_5-0-0
feat: Release 5.0.0
Showing
6 changed files
with
50 additions
and
10 deletions
| 1 | +## 5.0.0 | ||
| 2 | + | ||
| 3 | +This major release contains all the changes from the 5.0.0 beta releases, along with the following changes: | ||
| 4 | + | ||
| 5 | +Improvements: | ||
| 6 | +- [Android] Remove the Kotlin Standard Library from the dependencies, as it is automatically included in Kotlin 1.4+ | ||
| 7 | + | ||
| 1 | ## 5.0.0-beta.3 | 8 | ## 5.0.0-beta.3 |
| 2 | 9 | ||
| 3 | **BREAKING CHANGES:** | 10 | **BREAKING CHANGES:** |
| @@ -2,7 +2,6 @@ group 'dev.steenbakker.mobile_scanner' | @@ -2,7 +2,6 @@ group 'dev.steenbakker.mobile_scanner' | ||
| 2 | version '1.0-SNAPSHOT' | 2 | version '1.0-SNAPSHOT' |
| 3 | 3 | ||
| 4 | buildscript { | 4 | buildscript { |
| 5 | - ext.kotlin_version = '1.7.22' | ||
| 6 | repositories { | 5 | repositories { |
| 7 | google() | 6 | google() |
| 8 | mavenCentral() | 7 | mavenCentral() |
| @@ -10,7 +9,7 @@ buildscript { | @@ -10,7 +9,7 @@ buildscript { | ||
| 10 | 9 | ||
| 11 | dependencies { | 10 | dependencies { |
| 12 | classpath 'com.android.tools.build:gradle:8.3.2' | 11 | classpath 'com.android.tools.build:gradle:8.3.2' |
| 13 | - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | 12 | + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22" |
| 14 | } | 13 | } |
| 15 | } | 14 | } |
| 16 | 15 | ||
| @@ -64,8 +63,6 @@ android { | @@ -64,8 +63,6 @@ android { | ||
| 64 | } | 63 | } |
| 65 | 64 | ||
| 66 | dependencies { | 65 | dependencies { |
| 67 | - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
| 68 | - | ||
| 69 | def useUnbundled = project.findProperty('dev.steenbakker.mobile_scanner.useUnbundled') ?: false | 66 | def useUnbundled = project.findProperty('dev.steenbakker.mobile_scanner.useUnbundled') ?: false |
| 70 | if (useUnbundled.toBoolean()) { | 67 | if (useUnbundled.toBoolean()) { |
| 71 | // Dynamically downloaded model via Google Play Services | 68 | // Dynamically downloaded model via Google Play Services |
| 1 | import 'dart:js_interop'; | 1 | import 'dart:js_interop'; |
| 2 | 2 | ||
| 3 | +import 'package:mobile_scanner/src/web/media_track_extension.dart'; | ||
| 3 | import 'package:web/web.dart'; | 4 | import 'package:web/web.dart'; |
| 4 | 5 | ||
| 5 | /// This class represents a delegate that manages the constraints for a [MediaStreamTrack]. | 6 | /// This class represents a delegate that manages the constraints for a [MediaStreamTrack]. |
| @@ -17,10 +18,18 @@ final class MediaTrackConstraintsDelegate { | @@ -17,10 +18,18 @@ final class MediaTrackConstraintsDelegate { | ||
| 17 | 18 | ||
| 18 | final MediaStreamTrack track = tracks.first; | 19 | final MediaStreamTrack track = tracks.first; |
| 19 | 20 | ||
| 20 | - final MediaTrackCapabilities capabilities = track.getCapabilities(); | 21 | + final MediaTrackCapabilities capabilities; |
| 22 | + | ||
| 23 | + if (track.getCapabilitiesNullable != null) { | ||
| 24 | + capabilities = track.getCapabilities(); | ||
| 25 | + } else { | ||
| 26 | + capabilities = MediaTrackCapabilities(); | ||
| 27 | + } | ||
| 28 | + | ||
| 21 | final MediaTrackSettings settings = track.getSettings(); | 29 | final MediaTrackSettings settings = track.getSettings(); |
| 30 | + final JSArray<JSString>? facingModes = capabilities.facingModeNullable; | ||
| 22 | 31 | ||
| 23 | - if (capabilities.facingMode.toDart.isEmpty) { | 32 | + if (facingModes == null || facingModes.toDart.isEmpty) { |
| 24 | return MediaTrackSettings( | 33 | return MediaTrackSettings( |
| 25 | width: settings.width, | 34 | width: settings.width, |
| 26 | height: settings.height, | 35 | height: settings.height, |
lib/src/web/media_track_extension.dart
0 → 100644
| 1 | +import 'dart:js_interop'; | ||
| 2 | +import 'package:web/web.dart'; | ||
| 3 | + | ||
| 4 | +/// This extension provides nullable properties for [MediaStreamTrack], | ||
| 5 | +/// for cases where the properties are not supported by all browsers. | ||
| 6 | +extension NullableMediaStreamTrackCapabilities on MediaStreamTrack { | ||
| 7 | + /// The `getCapabilities` function is not supported on Firefox. | ||
| 8 | + @JS('getCapabilities') | ||
| 9 | + external JSFunction? get getCapabilitiesNullable; | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +/// This extension provides nullable properties for [MediaTrackCapabilities], | ||
| 13 | +/// for cases where the properties are not supported by all browsers. | ||
| 14 | +extension NullableMediaTrackCapabilities on MediaTrackCapabilities { | ||
| 15 | + /// The `facingMode` property is not supported on Safari. | ||
| 16 | + @JS('facingMode') | ||
| 17 | + external JSArray<JSString>? get facingModeNullable; | ||
| 18 | +} |
| @@ -13,6 +13,7 @@ import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart'; | @@ -13,6 +13,7 @@ import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart'; | ||
| 13 | import 'package:mobile_scanner/src/objects/barcode_capture.dart'; | 13 | import 'package:mobile_scanner/src/objects/barcode_capture.dart'; |
| 14 | import 'package:mobile_scanner/src/objects/start_options.dart'; | 14 | import 'package:mobile_scanner/src/objects/start_options.dart'; |
| 15 | import 'package:mobile_scanner/src/web/barcode_reader.dart'; | 15 | import 'package:mobile_scanner/src/web/barcode_reader.dart'; |
| 16 | +import 'package:mobile_scanner/src/web/media_track_extension.dart'; | ||
| 16 | import 'package:mobile_scanner/src/web/zxing/zxing_barcode_reader.dart'; | 17 | import 'package:mobile_scanner/src/web/zxing/zxing_barcode_reader.dart'; |
| 17 | import 'package:web/web.dart'; | 18 | import 'package:web/web.dart'; |
| 18 | 19 | ||
| @@ -124,11 +125,19 @@ class MobileScannerWeb extends MobileScannerPlatform { | @@ -124,11 +125,19 @@ class MobileScannerWeb extends MobileScannerPlatform { | ||
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | final MediaStreamTrack videoTrack = tracks.first; | 127 | final MediaStreamTrack videoTrack = tracks.first; |
| 127 | - final MediaTrackCapabilities capabilities = videoTrack.getCapabilities(); | 128 | + final MediaTrackCapabilities capabilities; |
| 128 | 129 | ||
| 129 | - // TODO: this is empty on MacOS, where there is no facing mode, but one, user facing camera. | 130 | + if (videoTrack.getCapabilitiesNullable != null) { |
| 131 | + capabilities = videoTrack.getCapabilities(); | ||
| 132 | + } else { | ||
| 133 | + capabilities = MediaTrackCapabilities(); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + final JSArray<JSString>? facingModes = capabilities.facingModeNullable; | ||
| 137 | + | ||
| 138 | + // TODO: this is an empty array on MacOS Chrome, where there is no facing mode, but one, user facing camera. | ||
| 130 | // Facing mode is not supported by this track, do nothing. | 139 | // Facing mode is not supported by this track, do nothing. |
| 131 | - if (capabilities.facingMode.toDart.isEmpty) { | 140 | + if (facingModes == null || facingModes.toDart.isEmpty) { |
| 132 | return; | 141 | return; |
| 133 | } | 142 | } |
| 134 | 143 |
| 1 | name: mobile_scanner | 1 | name: mobile_scanner |
| 2 | description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS. | 2 | description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS. |
| 3 | -version: 5.0.0-beta.3 | 3 | +version: 5.0.0 |
| 4 | repository: https://github.com/juliansteenbakker/mobile_scanner | 4 | repository: https://github.com/juliansteenbakker/mobile_scanner |
| 5 | 5 | ||
| 6 | screenshots: | 6 | screenshots: |
-
Please register or login to post a comment