Julian Steenbakker
Committed by GitHub

Merge branch 'master' into master

@@ -12,4 +12,4 @@ jobs: @@ -12,4 +12,4 @@ jobs:
12 assign-author: 12 assign-author:
13 runs-on: ubuntu-latest 13 runs-on: ubuntu-latest
14 steps: 14 steps:
15 - - uses: toshimaru/auto-author-assign@v1.6.2 15 + - uses: toshimaru/auto-author-assign@v2.0.1
@@ -11,8 +11,8 @@ jobs: @@ -11,8 +11,8 @@ jobs:
11 analysis: 11 analysis:
12 runs-on: ubuntu-latest 12 runs-on: ubuntu-latest
13 steps: 13 steps:
14 - - uses: actions/checkout@v4.0.0  
15 - - uses: actions/setup-java@v3.12.0 14 + - uses: actions/checkout@v4.1.0
  15 + - uses: actions/setup-java@v3.13.0
16 with: 16 with:
17 java-version: 11 17 java-version: 11
18 distribution: temurin 18 distribution: temurin
@@ -28,8 +28,8 @@ jobs: @@ -28,8 +28,8 @@ jobs:
28 formatting: 28 formatting:
29 runs-on: ubuntu-latest 29 runs-on: ubuntu-latest
30 steps: 30 steps:
31 - - uses: actions/checkout@v4.0.0  
32 - - uses: actions/setup-java@v3.12.0 31 + - uses: actions/checkout@v4.1.0
  32 + - uses: actions/setup-java@v3.13.0
33 with: 33 with:
34 java-version: 11 34 java-version: 11
35 distribution: temurin 35 distribution: temurin
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 release-please: 7 release-please:
8 runs-on: ubuntu-latest 8 runs-on: ubuntu-latest
9 steps: 9 steps:
10 - - uses: GoogleCloudPlatform/release-please-action@v3.7.11 10 + - uses: GoogleCloudPlatform/release-please-action@v3.7.12
11 with: 11 with:
12 token: ${{ secrets.GITHUB_TOKEN }} 12 token: ${{ secrets.GITHUB_TOKEN }}
13 release-type: simple 13 release-type: simple
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 [![mobile_scanner](https://github.com/juliansteenbakker/mobile_scanner/actions/workflows/flutter.yml/badge.svg)](https://github.com/juliansteenbakker/mobile_scanner/actions/workflows/flutter.yml) 5 [![mobile_scanner](https://github.com/juliansteenbakker/mobile_scanner/actions/workflows/flutter.yml/badge.svg)](https://github.com/juliansteenbakker/mobile_scanner/actions/workflows/flutter.yml)
6 [![GitHub Sponsors](https://img.shields.io/github/sponsors/juliansteenbakker?label=like%20my%20work?%20sponsor%20me!)](https://github.com/sponsors/juliansteenbakker) 6 [![GitHub Sponsors](https://img.shields.io/github/sponsors/juliansteenbakker?label=like%20my%20work?%20sponsor%20me!)](https://github.com/sponsors/juliansteenbakker)
7 7
8 -A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS. 8 +A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
9 9
10 10
11 ## Features Supported 11 ## Features Supported
@@ -27,28 +27,34 @@ See the example app for detailed implementation information. @@ -27,28 +27,34 @@ See the example app for detailed implementation information.
27 27
28 ## Platform specific setup 28 ## Platform specific setup
29 ### Android 29 ### Android
30 -This packages uses the **bundled version** of MLKit Barcode-scanning for Android. This version is more accurate and immediately available to devices. However, this version will increase the size of the app with approximately 3 to 10 MB. The alternative for this is to use the **unbundled version** of MLKit Barcode-scanning for Android. This version is older than the bundled version however this only increases the size by around 600KB.  
31 -To use this version you must alter the mobile_scanner gradle file to replace `com.google.mlkit:barcode-scanning:17.0.2` with `com.google.android.gms:play-services-mlkit-barcode-scanning:18.0.0`. Keep in mind that if you alter the gradle files directly in your project it can be overriden when you update your pubspec.yaml. I am still searching for a way to properly replace the module in gradle but have yet to find one. 30 +This package uses by default the **bundled version** of MLKit Barcode-scanning for Android. This version is immediately available to the device. But it will increase the size of the app by approximately 3 to 10 MB.
  31 +
  32 +The alternative is to use the **unbundled version** of MLKit Barcode-scanning for Android. This version is downloaded on first use via Google Play Services. It increases the app size by around 600KB.
32 33
33 [You can read more about the difference between the two versions here.](https://developers.google.com/ml-kit/vision/barcode-scanning/android) 34 [You can read more about the difference between the two versions here.](https://developers.google.com/ml-kit/vision/barcode-scanning/android)
34 35
  36 +To use the **unbundled version** of the MLKit Barcode-scanning, add the following line to your `/android/gradle.properties` file:
  37 +```
  38 +dev.steenbakker.mobile_scanner.useUnbundled=true
  39 +```
  40 +
35 ### iOS 41 ### iOS
36 **Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:** 42 **Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:**
37 NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor. 43 NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
38 - 44 +
39 **If you want to use the local gallery feature from [image_picker](https://pub.dev/packages/image_picker)** 45 **If you want to use the local gallery feature from [image_picker](https://pub.dev/packages/image_picker)**
40 NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor. 46 NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
41 - 47 +
42 Example, 48 Example,
43 ``` 49 ```
44 <key>NSCameraUsageDescription</key> 50 <key>NSCameraUsageDescription</key>
45 <string>This app needs camera access to scan QR codes</string> 51 <string>This app needs camera access to scan QR codes</string>
46 - 52 +
47 <key>NSPhotoLibraryUsageDescription</key> 53 <key>NSPhotoLibraryUsageDescription</key>
48 <string>This app needs photos access to get QR code from photo library</string> 54 <string>This app needs photos access to get QR code from photo library</string>
49 ``` 55 ```
50 -  
51 - 56 +
  57 +
52 ### macOS 58 ### macOS
53 Ensure that you granted camera permission in XCode -> Signing & Capabilities: 59 Ensure that you granted camera permission in XCode -> Signing & Capabilities:
54 60
@@ -9,7 +9,7 @@ buildscript { @@ -9,7 +9,7 @@ buildscript {
9 } 9 }
10 10
11 dependencies { 11 dependencies {
12 - classpath 'com.android.tools.build:gradle:8.1.1' 12 + classpath 'com.android.tools.build:gradle:8.1.2'
13 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 } 14 }
15 } 15 }
@@ -50,10 +50,14 @@ android { @@ -50,10 +50,14 @@ android {
50 dependencies { 50 dependencies {
51 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 51 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
52 52
53 - // Use this dependency to bundle the model with your app  
54 - implementation 'com.google.mlkit:barcode-scanning:17.2.0'  
55 - // Use this dependency to use the dynamically downloaded model in Google Play Services  
56 -// implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.1.0' 53 + def useUnbundled = project.findProperty('dev.steenbakker.mobile_scanner.useUnbundled') ?: false
  54 + if (useUnbundled.toBoolean()) {
  55 + // Dynamically downloaded model via Google Play Services
  56 + implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.1.0'
  57 + } else {
  58 + // Bundled model in app
  59 + implementation 'com.google.mlkit:barcode-scanning:17.2.0'
  60 + }
57 61
58 implementation 'androidx.camera:camera-camera2:1.2.3' 62 implementation 'androidx.camera:camera-camera2:1.2.3'
59 implementation 'androidx.camera:camera-lifecycle:1.2.3' 63 implementation 'androidx.camera:camera-lifecycle:1.2.3'
@@ -6,7 +6,7 @@ buildscript { @@ -6,7 +6,7 @@ buildscript {
6 } 6 }
7 7
8 dependencies { 8 dependencies {
9 - classpath 'com.android.tools.build:gradle:8.1.1' 9 + classpath 'com.android.tools.build:gradle:8.1.2'
10 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 } 11 }
12 } 12 }