From 81edea79358cc3267567b42f7a39e5c1c25ea838 Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Fri, 5 Jul 2019 16:32:46 +0700 Subject: [PATCH 01/15] fix compile warning https://stackoverflow.com/questions/18039275/retained-block-property-does-not-copy-the-block-use-copy-attribute-instead "Retain'ed block property does not copy the block - use copy attribute instead" Not sure if this should be `copy` or `strong`. --- ios/Classes/BarcodeScanPlugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Classes/BarcodeScanPlugin.h b/ios/Classes/BarcodeScanPlugin.h index 197399e..d6b1bab 100644 --- a/ios/Classes/BarcodeScanPlugin.h +++ b/ios/Classes/BarcodeScanPlugin.h @@ -9,6 +9,6 @@ @interface BarcodeScanPlugin : NSObject -@property(nonatomic, retain) FlutterResult result; +@property(nonatomic, copy) FlutterResult result; @property (nonatomic, assign) UIViewController *hostViewController; @end From 4fe1075fa6dae2207d1f30e14060e19ea2c3a77f Mon Sep 17 00:00:00 2001 From: Eterna Date: Tue, 27 Aug 2019 10:51:15 +0700 Subject: [PATCH 02/15] upgrade gradle --- android/build.gradle | 10 +++++----- android/gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 1ac4e7c..c1acc78 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,8 +8,8 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.3.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20" + classpath 'com.android.tools.build:gradle:3.5.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50" } } @@ -24,14 +24,14 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 28 + compileSdkVersion 29 sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -43,7 +43,7 @@ android { dependencies { implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.20' + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50' implementation 'me.dm7.barcodescanner:zxing:1.9.13' api 'com.google.android.material:material:1.0.0' } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index f00068b..7225ec2 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jan 30 20:42:57 BRST 2019 +#Tue Aug 27 10:46:28 ICT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip From 06f38e0b538095e1aa3f648a8feec9e4da2d7311 Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Mon, 16 Dec 2019 20:59:07 +0100 Subject: [PATCH 03/15] Fix for Issue #61 While the iOS device is rotating the bounds of the previewView will be recalculated and the scanRect will be reinitialized Changes in the WorkspaceSettings are necessary to run the example app --- .../xcshareddata/WorkspaceSettings.xcsettings | 10 +++++ ios/Classes/BarcodeScannerViewController.m | 44 ++++++++++++------- 2 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..6b30c74 --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + BuildSystemType + Original + PreviewsEnabled + + + diff --git a/ios/Classes/BarcodeScannerViewController.m b/ios/Classes/BarcodeScannerViewController.m index da44ca0..0366f0d 100644 --- a/ios/Classes/BarcodeScannerViewController.m +++ b/ios/Classes/BarcodeScannerViewController.m @@ -10,6 +10,34 @@ @implementation BarcodeScannerViewController { } +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator +{ + CGRect bounds = [UIScreen mainScreen].bounds; + CGRect reversedBounds = CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.height, bounds.size.width); + self.previewView.bounds = reversedBounds; + self.previewView.frame = reversedBounds; + [self.scanRect removeFromSuperview]; + [self setupScanRect:reversedBounds]; + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; +} + +- (void)setupScanRect:(CGRect)bounds { + self.scanRect = [[ScannerOverlay alloc] initWithFrame:bounds]; + self.scanRect.translatesAutoresizingMaskIntoConstraints = NO; + self.scanRect.backgroundColor = UIColor.clearColor; + [self.view addSubview:_scanRect]; + [self.view addConstraints:[NSLayoutConstraint + constraintsWithVisualFormat:@"V:[scanRect]" + options:NSLayoutFormatAlignAllBottom + metrics:nil + views:@{@"scanRect": _scanRect}]]; + [self.view addConstraints:[NSLayoutConstraint + constraintsWithVisualFormat:@"H:[scanRect]" + options:NSLayoutFormatAlignAllBottom + metrics:nil + views:@{@"scanRect": _scanRect}]]; + [_scanRect startAnimating]; +} - (void)viewDidLoad { [super viewDidLoad]; @@ -26,21 +54,7 @@ options:NSLayoutFormatAlignAllBottom metrics:nil views:@{@"previewView": _previewView}]]; - self.scanRect = [[ScannerOverlay alloc] initWithFrame:self.view.bounds]; - self.scanRect.translatesAutoresizingMaskIntoConstraints = NO; - self.scanRect.backgroundColor = UIColor.clearColor; - [self.view addSubview:_scanRect]; - [self.view addConstraints:[NSLayoutConstraint - constraintsWithVisualFormat:@"V:[scanRect]" - options:NSLayoutFormatAlignAllBottom - metrics:nil - views:@{@"scanRect": _scanRect}]]; - [self.view addConstraints:[NSLayoutConstraint - constraintsWithVisualFormat:@"H:[scanRect]" - options:NSLayoutFormatAlignAllBottom - metrics:nil - views:@{@"scanRect": _scanRect}]]; - [_scanRect startAnimating]; + [self setupScanRect:self.view.bounds]; self.scanner = [[MTBBarcodeScanner alloc] initWithPreviewView:_previewView]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; [self updateFlashButton]; From 2a2a3e0899ac9267076c2583f29838ef7baafc18 Mon Sep 17 00:00:00 2001 From: Santi Hoyos Date: Wed, 18 Dec 2019 17:43:01 +0100 Subject: [PATCH 04/15] avoid use Registrar.activity() before flutter engine is attached to android Activity this add support for use this plugin in apps with add-to-app feature --- .../barcodescan/BarcodeScanPlugin.kt | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt b/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt index e3a58f6..a72ec23 100644 --- a/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt +++ b/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt @@ -2,53 +2,56 @@ package com.apptreesoftware.barcodescan import android.app.Activity import android.content.Intent +import android.util.Log +import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel.MethodCallHandler import io.flutter.plugin.common.MethodChannel.Result -import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.PluginRegistry import io.flutter.plugin.common.PluginRegistry.Registrar -class BarcodeScanPlugin(val activity: Activity): MethodCallHandler, - PluginRegistry.ActivityResultListener { - var result : Result? = null - companion object { - @JvmStatic - fun registerWith(registrar: Registrar): Unit { - val channel = MethodChannel(registrar.messenger(), "com.apptreesoftware.barcode_scan") - if (registrar.activity() != null) { - val plugin = BarcodeScanPlugin(registrar.activity()) +class BarcodeScanPlugin(private val registrar: Registrar) : MethodCallHandler, PluginRegistry.ActivityResultListener { + var result: Result? = null + + companion object { + @JvmStatic + fun registerWith(registrar: Registrar) { + val channel = MethodChannel(registrar.messenger(), "com.apptreesoftware.barcode_scan") + val plugin = BarcodeScanPlugin(registrar) channel.setMethodCallHandler(plugin) registrar.addActivityResultListener(plugin) - } + } } - } - override fun onMethodCall(call: MethodCall, result: Result): Unit { - if (call.method.equals("scan")) { - this.result = result - showBarcodeView() - } else { - result.notImplemented() + override fun onMethodCall(call: MethodCall, result: Result) { + if (call.method == "scan") { + this.result = result + showBarcodeView() + } else { + result.notImplemented() + } } - } - private fun showBarcodeView() { - val intent = Intent(activity, BarcodeScannerActivity::class.java) - activity.startActivityForResult(intent, 100) - } - - override fun onActivityResult(code: Int, resultCode: Int, data: Intent?): Boolean { - if (code == 100) { - if (resultCode == Activity.RESULT_OK) { - val barcode = data?.getStringExtra("SCAN_RESULT") - barcode?.let { this.result?.success(barcode) } - } else { - val errorCode = data?.getStringExtra("ERROR_CODE") - this.result?.error(errorCode, null, null) - } - return true + private fun showBarcodeView() { + if (registrar.activity() == null) { + Log.e("BarcodeScanPlugin", "plugin can't launch scan activity, because plugin is not attached to any activity.") + return + } + val intent = Intent(registrar.activity(), BarcodeScannerActivity::class.java) + registrar.activity().startActivityForResult(intent, 100) + } + + override fun onActivityResult(code: Int, resultCode: Int, data: Intent?): Boolean { + if (code == 100) { + if (resultCode == Activity.RESULT_OK) { + val barcode = data?.getStringExtra("SCAN_RESULT") + barcode?.let { this.result?.success(barcode) } + } else { + val errorCode = data?.getStringExtra("ERROR_CODE") + this.result?.error(errorCode, null, null) + } + return true + } + return false } - return false - } } From e0cc5c3bc2d2aa1f3777280ef85082f42222d30a Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Sun, 12 Jan 2020 12:18:48 +0100 Subject: [PATCH 05/15] Fixed the size of the preview overlay --- ios/Classes/BarcodeScannerViewController.m | 1 + ios/Classes/ScannerOverlay.m | 26 ++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ios/Classes/BarcodeScannerViewController.m b/ios/Classes/BarcodeScannerViewController.m index 0366f0d..662c381 100644 --- a/ios/Classes/BarcodeScannerViewController.m +++ b/ios/Classes/BarcodeScannerViewController.m @@ -16,6 +16,7 @@ CGRect reversedBounds = CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.height, bounds.size.width); self.previewView.bounds = reversedBounds; self.previewView.frame = reversedBounds; + [self.scanRect stopAnimating]; [self.scanRect removeFromSuperview]; [self setupScanRect:reversedBounds]; [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; diff --git a/ios/Classes/ScannerOverlay.m b/ios/Classes/ScannerOverlay.m index ab4c121..eb8ca6f 100644 --- a/ios/Classes/ScannerOverlay.m +++ b/ios/Classes/ScannerOverlay.m @@ -83,13 +83,25 @@ } - (CGRect)scanRect { - CGRect rect = self.frame; - CGFloat heightMultiplier = 3.0/4.0; // 4:3 aspect ratio - CGFloat scanRectWidth = rect.size.width * 0.8f; - CGFloat scanRectHeight = scanRectWidth * heightMultiplier; - CGFloat scanRectOriginX = (rect.size.width / 2) - (scanRectWidth / 2); - CGFloat scanRectOriginY = (rect.size.height / 2) - (scanRectHeight / 2); - return CGRectMake(scanRectOriginX, scanRectOriginY, scanRectWidth, scanRectHeight); + CGRect rect = self.frame; + + CGFloat frameWidth = rect.size.width; + CGFloat frameHeight = rect.size.height; + + BOOL isLandscape = frameWidth > frameHeight; + CGFloat widthOnPotrait = isLandscape ? frameHeight : frameWidth; + CGFloat heightMultiplier = 3.0/4.0; // 4:3 aspect ratio + CGFloat scanRectWidth = widthOnPotrait * 0.8f; + CGFloat scanRectHeight = scanRectWidth * heightMultiplier; + + if(isLandscape) { + CGFloat navbarHeight = 32; + frameHeight += navbarHeight; + } + + CGFloat scanRectOriginX = (frameWidth - scanRectWidth) / 2; + CGFloat scanRectOriginY = (frameHeight - scanRectHeight) / 2; + return CGRectMake(scanRectOriginX, scanRectOriginY, scanRectWidth, scanRectHeight); } - (CGRect)scanLineRect { From 770bb47d6c7df86ae0adf69ba38e61d6b05fc95e Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Sun, 12 Jan 2020 12:34:25 +0100 Subject: [PATCH 06/15] Fixed the position of the scan line --- ios/Classes/ScannerOverlay.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/Classes/ScannerOverlay.m b/ios/Classes/ScannerOverlay.m index eb8ca6f..7c415b9 100644 --- a/ios/Classes/ScannerOverlay.m +++ b/ios/Classes/ScannerOverlay.m @@ -89,10 +89,10 @@ CGFloat frameHeight = rect.size.height; BOOL isLandscape = frameWidth > frameHeight; - CGFloat widthOnPotrait = isLandscape ? frameHeight : frameWidth; - CGFloat heightMultiplier = 3.0/4.0; // 4:3 aspect ratio - CGFloat scanRectWidth = widthOnPotrait * 0.8f; - CGFloat scanRectHeight = scanRectWidth * heightMultiplier; + CGFloat widthOnPortrait = isLandscape ? frameHeight : frameWidth; + CGFloat scanRectWidth = widthOnPortrait * 0.8f; + CGFloat aspectRatio = 3.0/4.0; + CGFloat scanRectHeight = scanRectWidth * aspectRatio; if(isLandscape) { CGFloat navbarHeight = 32; @@ -106,8 +106,8 @@ - (CGRect)scanLineRect { CGRect scanRect = [self scanRect]; - CGRect rect = self.frame; - return CGRectMake(scanRect.origin.x, rect.size.height / 2, scanRect.size.width, 1); + CGFloat positionY = scanRect.origin.y + (scanRect.size.height / 2); + return CGRectMake(scanRect.origin.x, positionY, scanRect.size.width, 1); } @end From e0c461d139483b7d2f9fccdd5abdfbac309f2fc4 Mon Sep 17 00:00:00 2001 From: Connectety-T Date: Sun, 9 Feb 2020 21:42:15 +0100 Subject: [PATCH 07/15] Added tiny addition in description to bring the length over 60. This brings the maintenance score up to 100, which will increase the overall score. See https://pub.dev/packages/barcode_scan#-analysis-tab- under Maintenance suggestions. --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 5cb50ce..b5664ed 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: barcode_scan -description: A flutter plugin for scanning 2D barcodes and QRCodes. +description: A flutter plugin for scanning 2D barcodes and QRCodes via camera. version: 1.0.0 author: Matthew Smith homepage: https://github.com/apptreesoftware/flutter_barcode_reader From ac4fbd2cf9aa344e091d57d24d1237e49108af0a Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Wed, 12 Feb 2020 09:17:12 -0800 Subject: [PATCH 08/15] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index a35c5a7..f0f2673 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +# This plugin is no longer maintained + +I no longer have time to maintain this plugin. In addition, other libraries have come along that I consider a better replacement, most notably the [MLKit based barcode detection plugin](https://pub.dev/packages/flutter_camera_ml_vision). + +If someone is interested in taking over this plugin and maintaining it please contact me and I will transfer ownership. + + # Barcode Scanner A flutter plugin for scanning 2D barcodes and QR codes. From 49cab03d37ded636360015870f6425e96d7ec325 Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Wed, 19 Feb 2020 17:10:45 +0100 Subject: [PATCH 09/15] Removed "unmaintained" notice --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index f0f2673..a35c5a7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,3 @@ -# This plugin is no longer maintained - -I no longer have time to maintain this plugin. In addition, other libraries have come along that I consider a better replacement, most notably the [MLKit based barcode detection plugin](https://pub.dev/packages/flutter_camera_ml_vision). - -If someone is interested in taking over this plugin and maintaining it please contact me and I will transfer ownership. - - # Barcode Scanner A flutter plugin for scanning 2D barcodes and QR codes. From fd166d9915c88feb40f8314dd7f8358a4936f050 Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Wed, 19 Feb 2020 21:49:23 +0100 Subject: [PATCH 10/15] Update CHANGELOG.md --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3df1299..f4d3a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +## Next + +Features: +- [Add-to-app support](https://github.com/mintware-de/flutter_barcode_reader/pull/168) - @santiihoyos + +Bugfixes: +- [Fixed rotation on iOS](https://github.com/mintware-de/flutter_barcode_reader/pull/167) - @mintware-de + - [#61 Rotating orientation on iPhones only shows half the screen](https://github.com/mintware-de/flutter_barcode_reader/issues/61) + +Changes: +- [Fix compile warning](https://github.com/apptreesoftware/flutter_barcode_reader/pull/127) - @lookfirst +- [Upgrade gradle](https://github.com/mintware-de/flutter_barcode_reader/pull/142) - @SuuSoJeat + - `com.android.tools.build:gradle`: 3.3.1 -> 3.5.0 + - `org.jetbrains.kotlin:kotlin-gradle-plugin`: 1.3.20 -> 1.3.50 + - `compileSdkVersion`: 28 -> 29 + - `targetSdkVersion`: 28 -> 29 + - `gradle`: 4.10.2 -> 5.4.1 +- [Package description updated](https://github.com/mintware-de/flutter_barcode_reader/pull/180) - @connectety + + ## [1.0.0] - 8/30/18 Breaking Change: Adds support for AndroidX From 14a744d0afb4065568244d44819904e6965fb9cf Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Wed, 19 Feb 2020 23:19:14 +0100 Subject: [PATCH 11/15] Owner changes: Android: Kotlin Package: `com.apptreesoftware.barcodescan` -> `de.mintware.barcode_scan` Manifest-Package: `com.yourcompany.barcodescan` -> `de.mintware.barcodescan` Activity: `com.apptreesoftware.barcodescan.BarcodeScannerActivity` -> `de.mintware.barcode_scan.BarcodeScannerActivity` iOS: Bundle ID: `com.apptreesoftware.barcode.plugin.example` -> `de.mintware.barcode_scan.plugin.example` Flutter: Method channel: `com.apptreesoftware.barcode_scan` -> `de.mintware.barcode_scan` pubspec.yaml: - homepage updated - deprecated author entry removed - comments removed - flutter.plugin.androidPackage: `com.apptreesoftware.barcode_scan` -> `de.mintware.barcode_scan` README.md updated and UPGRADE.md added --- .gitignore | 1 + CHANGELOG.md | 26 ++++---- LICENSE | 3 +- README.md | 61 +++++++++++-------- UPGRADE.md | 25 ++++++++ android/build.gradle | 6 +- android/src/main/AndroidManifest.xml | 4 +- .../barcode_scan}/BarcodeScanPlugin.kt | 4 +- .../barcode_scan}/BarcodeScannerActivity.kt | 2 +- example/.gitignore | 5 ++ example/android/app/build.gradle | 4 +- .../android/app/src/main/AndroidManifest.xml | 4 +- .../barcodescanexample/MainActivity.kt | 2 +- example/android/gradle.properties | 3 + example/ios/.gitignore | 2 +- example/ios/Podfile.lock | 29 --------- example/ios/Runner.xcodeproj/project.pbxproj | 9 +-- ios/Classes/BarcodeScanPlugin.m | 6 +- lib/barcode_scan.dart | 2 +- pubspec.yaml | 42 +------------ 20 files changed, 111 insertions(+), 129 deletions(-) create mode 100644 UPGRADE.md rename android/src/main/kotlin/{com/apptreesoftware/barcodescan => de/mintware/barcode_scan}/BarcodeScanPlugin.kt (96%) rename android/src/main/kotlin/{com/apptreesoftware/barcodescan => de/mintware/barcode_scan}/BarcodeScannerActivity.kt (99%) delete mode 100644 example/ios/Podfile.lock diff --git a/.gitignore b/.gitignore index 41c1683..79f2d39 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ build/ ios/.generated/ packages pubspec.lock +example/ios/Podfile.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d3a8d..4fcc6f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,14 @@ Features: - [Add-to-app support](https://github.com/mintware-de/flutter_barcode_reader/pull/168) - @santiihoyos +- Changed overlay to full screen in iOS 13 Bugfixes: - [Fixed rotation on iOS](https://github.com/mintware-de/flutter_barcode_reader/pull/167) - @mintware-de - [#61 Rotating orientation on iPhones only shows half the screen](https://github.com/mintware-de/flutter_barcode_reader/issues/61) Changes: -- [Fix compile warning](https://github.com/apptreesoftware/flutter_barcode_reader/pull/127) - @lookfirst +- [Fix compile warning](https://github.com/mintware-de/flutter_barcode_reader/pull/127) - @lookfirst - [Upgrade gradle](https://github.com/mintware-de/flutter_barcode_reader/pull/142) - @SuuSoJeat - `com.android.tools.build:gradle`: 3.3.1 -> 3.5.0 - `org.jetbrains.kotlin:kotlin-gradle-plugin`: 1.3.20 -> 1.3.50 @@ -16,40 +17,41 @@ Changes: - `targetSdkVersion`: 28 -> 29 - `gradle`: 4.10.2 -> 5.4.1 - [Package description updated](https://github.com/mintware-de/flutter_barcode_reader/pull/180) - @connectety +- README.md and LICENSE.md updated +- Since the project owner has been changed, the package names are different. Checkout the [UPGRADE.md](./UPGRADE.md) for details. - -## [1.0.0] - 8/30/18 +## v1.0.0 - 2018-08-30 Breaking Change: Adds support for AndroidX -## [0.0.8] - 8/30/18 +## v0.0.8 - 2018-08-30 -* Fixes [iOS: pressing cancel doesn't stop scanning](https://github.com/apptreesoftware/flutter_barcode_reader/issues/60) thanks to @tgezginis. +* Fixes [iOS: pressing cancel doesn't stop scanning](https://github.com/mintware-de/flutter_barcode_reader/issues/60) thanks to @tgezginis. -## [0.0.7] - 8/30/18 +## v0.0.7 - 2018-08-30 * Fix iOS barcodes not scanning -## [0.0.6] - 8/29/18 +## v0.0.6 - 2018-08-29 * Fix android dependencies * iOS scanner now looks like Android thanks to @dustin-graham -## [0.0.4] - 2/8/18 +## v0.0.4 - 2018-02-8 -* Fix missing gradle dependency (thanks to [toteto](https://github.com/apptreesoftware/flutter_barcode_reader/pull/15)) +* Fix missing gradle dependency (thanks to [toteto](https://github.com/mintware-de/flutter_barcode_reader/pull/15)) * Update gradle dependencies -## [0.0.3] - 2/8/17 +## v0.0.3 - 2017-02-8 * Improved permission handling (thanks to [BenSower](https://github.com/BenSower)) * Added MIT license -## [0.0.2] - 11/7/17 +## v0.0.2 - 2017-11-7 * Rewrite iOS scanner in Objective-C to avoid Swift use_frameworks! conflicts with other plugins (see https://github.com/flutter/flutter/issues/10968) -## [0.0.1] - 10/29/17 +## v0.0.1 - 2017-10-29 * Supports 2D & QR Codes * Control flash while scanning diff --git a/LICENSE b/LICENSE index 736d914..0ba4dc4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License -Copyright (c) 2018 AppTree Software http://www.apptreesoftware.com +Copyright (c) 2020 Julian Finkler https://www.mintware.de +Copyright (c) 2018-2019 AppTree Software http://www.apptreesoftware.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a35c5a7..8a2ae90 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +[![GitHub license](https://img.shields.io/github/license/mintware-de/flutter_barcode_reader.svg)](https://github.com/mintware-de/flutter_barcode_reader/blob/master/LICENSE) +[![GitHub stars](https://img.shields.io/github/stars/mintware-de/flutter_barcode_reader)](https://github.com/mintware-de/flutter_barcode_reader/stargazers) +[![Pub](https://img.shields.io/pub/v/barcode_scan.svg)](https://pub.dartlang.org/packages/barcode_scan) +[![GitHub forks](https://img.shields.io/github/forks/mintware-de/flutter_barcode_reader)](https://github.com/mintware-de/flutter_barcode_reader/network) + # Barcode Scanner A flutter plugin for scanning 2D barcodes and QR codes. @@ -13,7 +18,6 @@ Android: https://github.com/dm77/barcodescanner - [x] Scan QR codes - [x] Control the flash while scanning - [x] Permission handling -- [ ] Support multiple barcode libraries ## Getting Started @@ -24,44 +28,49 @@ For Android, you must do the following before you can use the plugin: `` -* Add the BarcodeScanner activity to your AndroidManifest.xml. Do NOT modify the name. - - `` - - * This plugin is written in Kotlin. Therefore, you need to add Kotlin support to your project. See [installing the Kotlin plugin](https://kotlinlang.org/docs/tutorials/kotlin-android.html#installing-the-kotlin-plugin). Edit your project-level build.gradle file to look like this: - - buildscript { - ext.kotlin_version = '1.3.21' - ... - dependencies { - ... - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } - } - ... +```groovy +buildscript { + ext.kotlin_version = '1.3.61' + // ... + dependencies { + // ... + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} +// ... +``` Edit your app-level build.gradle file to look like this: - apply plugin: 'kotlin-android' - ... - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - ... - } +```groovy +apply plugin: 'kotlin-android' +// ... +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + // ... +} +``` Now you can depend on the barcode_scan plugin in your pubspec.yaml file: - dependencies: - ... - barcode_scan: any - +```yaml +dependencies: + # ... + barcode_scan: any +``` Click "Packages get" in Android Studio or run `flutter packages get` in your project folder. ### iOS To use on iOS, you must add the the camera usage description to your Info.plist +```xml + + NSCameraUsageDescription Camera permission is required for barcode scanning. + + +``` \ No newline at end of file diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..acd1546 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,25 @@ +# Upgrade from 1.0.0 to 2.0.0 + +The simples way for upgrading is by replacing: +- `com.apptreesoftware.barcodescan` +- `com.yourcompany.barcodescan` +- `com.apptreesoftware.barcode_scan` + +With: `de.mintware.barcode_scan` + +Detailed changes: +Android: +Kotlin Package: `com.apptreesoftware.barcodescan` -> `de.mintware.barcode_scan` +Manifest-Package: `com.yourcompany.barcodescan` -> `de.mintware.barcodescan` +Activity: `com.apptreesoftware.barcodescan.BarcodeScannerActivity` -> `de.mintware.barcode_scan.BarcodeScannerActivity` + +iOS: +Bundle ID: `com.apptreesoftware.barcode.plugin.example` -> `de.mintware.barcode_scan.plugin.example` + +Flutter: +Method channel: `com.apptreesoftware.barcode_scan` -> `de.mintware.barcode_scan` +pubspec.yaml: + - homepage updated + - deprecated author entry removed + - comments removed + - flutter.plugin.androidPackage: `com.apptreesoftware.barcode_scan` -> `de.mintware.barcode_scan` diff --git a/android/build.gradle b/android/build.gradle index c1acc78..7f466be 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,4 +1,6 @@ -group 'com.apptreesoftware.barcodescan' +package android + +group 'de.mintware.barcode_scan' version '1.0-SNAPSHOT' buildscript { @@ -9,7 +11,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61" } } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index ff7847a..f84e395 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,9 +1,9 @@ + package="de.mintware.barcodescan"> - + diff --git a/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt b/android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScanPlugin.kt similarity index 96% rename from android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt rename to android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScanPlugin.kt index a72ec23..59539da 100644 --- a/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScanPlugin.kt +++ b/android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScanPlugin.kt @@ -1,4 +1,4 @@ -package com.apptreesoftware.barcodescan +package de.mintware.barcode_scan import android.app.Activity import android.content.Intent @@ -16,7 +16,7 @@ class BarcodeScanPlugin(private val registrar: Registrar) : MethodCallHandler, P companion object { @JvmStatic fun registerWith(registrar: Registrar) { - val channel = MethodChannel(registrar.messenger(), "com.apptreesoftware.barcode_scan") + val channel = MethodChannel(registrar.messenger(), "de.mintware.barcode_scan") val plugin = BarcodeScanPlugin(registrar) channel.setMethodCallHandler(plugin) registrar.addActivityResultListener(plugin) diff --git a/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScannerActivity.kt b/android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScannerActivity.kt similarity index 99% rename from android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScannerActivity.kt rename to android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScannerActivity.kt index 340e7db..3dcb1a8 100644 --- a/android/src/main/kotlin/com/apptreesoftware/barcodescan/BarcodeScannerActivity.kt +++ b/android/src/main/kotlin/de/mintware/barcode_scan/BarcodeScannerActivity.kt @@ -1,4 +1,4 @@ -package com.apptreesoftware.barcodescan +package de.mintware.barcode_scan import android.Manifest import android.app.Activity diff --git a/example/.gitignore b/example/.gitignore index eb15c3d..83b685b 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -8,3 +8,8 @@ ios/.generated/ packages pubspec.lock .flutter-plugins +.flutter-plugins-dependencies +ios/Flutter.podspec +ios/Flutter/Flutter.podspec +ios/Flutter/flutter_export_environment.sh +ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 614df20..5b6de5f 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -29,12 +29,12 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.yourcompany.barcodescanexample" + applicationId "de.mintware.barcode_scan_example" minSdkVersion 16 targetSdkVersion 28 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index b18be67..e70b91a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="de.mintware.barcode_scan_example"> -``` \ No newline at end of file +``` + + +## Common problems +### Android "Could not find org.jetbrains.kotlin:kotlin-stdlib-jre..." +Change `org.jetbrains.kotlin:kotlin-stdlib-jre` to `org.jetbrains.kotlin:kotlin-stdlib-jdk` +([StackOverflow](https://stackoverflow.com/a/53358817))