From c8ea2e8d4a76404a706e7c180f1121fa9f9228c7 Mon Sep 17 00:00:00 2001 From: Ciprian Radu Date: Mon, 19 Sep 2022 12:16:39 +0300 Subject: [PATCH 1/2] Downgrade zxing:core to 3.3.0 --- android/build.gradle | 3 +- example/ios/Flutter/Generated.xcconfig | 13 ++++ .../ios/Flutter/flutter_export_environment.sh | 13 ++++ .../ios/Runner/GeneratedPluginRegistrant.h | 19 +++++ .../ios/Runner/GeneratedPluginRegistrant.m | 28 +++++++ example/pubspec.lock | 78 +++++++++---------- pubspec.lock | 62 +++++++-------- 7 files changed, 145 insertions(+), 71 deletions(-) create mode 100644 example/ios/Flutter/Generated.xcconfig create mode 100755 example/ios/Flutter/flutter_export_environment.sh create mode 100644 example/ios/Runner/GeneratedPluginRegistrant.h create mode 100644 example/ios/Runner/GeneratedPluginRegistrant.m diff --git a/android/build.gradle b/android/build.gradle index 20e711e..ed1d354 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -53,7 +53,8 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.journeyapps:zxing-android-embedded:4.3.0' + implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false } + implementation 'com.google.zxing:core:3.3.0' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' implementation "androidx.multidex:multidex:2.0.1" diff --git a/example/ios/Flutter/Generated.xcconfig b/example/ios/Flutter/Generated.xcconfig new file mode 100644 index 0000000..197d3b7 --- /dev/null +++ b/example/ios/Flutter/Generated.xcconfig @@ -0,0 +1,13 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/Users/ciprianradu/Development/flutter +FLUTTER_APPLICATION_PATH=/Users/ciprianradu/Development/ai_barcode/example +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=lib/main.dart +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=false +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..0d8c251 --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/ciprianradu/Development/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/ciprianradu/Development/ai_barcode/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/example/ios/Runner/GeneratedPluginRegistrant.h b/example/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000..7a89092 --- /dev/null +++ b/example/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,19 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +NS_ASSUME_NONNULL_END +#endif /* GeneratedPluginRegistrant_h */ diff --git a/example/ios/Runner/GeneratedPluginRegistrant.m b/example/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000..5513ea3 --- /dev/null +++ b/example/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,28 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#import "GeneratedPluginRegistrant.h" + +#if __has_include() +#import +#else +@import ai_barcode; +#endif + +#if __has_include() +#import +#else +@import permission_handler; +#endif + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + [AiBarcodePlugin registerWithRegistrar:[registry registrarForPlugin:@"AiBarcodePlugin"]]; + [PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]]; +} + +@end diff --git a/example/pubspec.lock b/example/pubspec.lock index 498a010..4a4d516 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,7 +5,7 @@ packages: dependency: "direct main" description: name: ai_awesome_message - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" ai_barcode: @@ -14,103 +14,103 @@ packages: path: ".." relative: true source: path - version: "3.2.2" + version: "3.2.4" ai_barcode_platform_interface: dependency: transitive description: name: ai_barcode_platform_interface - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" ai_barcode_web: dependency: transitive description: name: ai_barcode_web - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" air_design: dependency: "direct main" description: name: air_design - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" airoute: dependency: "direct main" description: name: airoute - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" async: dependency: transitive description: name: async - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.16.0" crypto: dependency: transitive description: name: crypto - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" flutter: @@ -132,77 +132,77 @@ packages: dependency: transitive description: name: html - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.15.0" js: dependency: transitive description: name: js - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.6.4" matcher: dependency: transitive description: name: matcher - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" path: dependency: transitive description: name: path - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "8.3.0" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.7.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" qr: dependency: transitive description: name: qr - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" qr_flutter: dependency: transitive description: name: qr_flutter - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" sky_engine: @@ -214,70 +214,70 @@ packages: dependency: transitive description: name: source_span - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.4.9" typed_data: dependency: transitive description: name: typed_data - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" universal_html: dependency: transitive description: name: universal_html - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.0.8" universal_io: dependency: transitive description: name: universal_io - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.0.4" vector_math: dependency: transitive description: name: vector_math - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" sdks: diff --git a/pubspec.lock b/pubspec.lock index f3be403..0a0e4fb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,77 +5,77 @@ packages: dependency: "direct main" description: name: ai_barcode_platform_interface - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" ai_barcode_web: dependency: "direct main" description: name: ai_barcode_web - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" async: dependency: transitive description: name: async - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.16.0" crypto: dependency: transitive description: name: crypto - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.17.2" fake_async: dependency: transitive description: name: fake_async - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" flutter: @@ -87,7 +87,7 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" flutter_test: @@ -104,63 +104,63 @@ packages: dependency: transitive description: name: html - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.15.0" js: dependency: transitive description: name: js - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.6.4" lints: dependency: transitive description: name: lints - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" matcher: dependency: transitive description: name: matcher - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" path: dependency: transitive description: name: path - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" qr: dependency: transitive description: name: qr - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" qr_flutter: dependency: transitive description: name: qr_flutter - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" sky_engine: @@ -172,70 +172,70 @@ packages: dependency: transitive description: name: source_span - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "0.4.9" typed_data: dependency: transitive description: name: typed_data - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" universal_html: dependency: transitive description: name: universal_html - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.0.8" universal_io: dependency: transitive description: name: universal_io - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.0.4" vector_math: dependency: transitive description: name: vector_math - url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" sdks: From 75f8bcb46304beb493f188f8780bcf3dcd750c88 Mon Sep 17 00:00:00 2001 From: Ciprian Radu Date: Tue, 20 Sep 2022 10:56:09 +0300 Subject: [PATCH 2/2] Removes force unwrap on barcode string value --- ios/Classes/AiBarcodeScannerView.swift | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ios/Classes/AiBarcodeScannerView.swift b/ios/Classes/AiBarcodeScannerView.swift index 027ac45..0d0c58d 100644 --- a/ios/Classes/AiBarcodeScannerView.swift +++ b/ios/Classes/AiBarcodeScannerView.swift @@ -121,12 +121,10 @@ class AiBarcodeScannerView:NSObject,FlutterPlatformView{ try self.scanner.startScanning(resultBlock: { codes in if let codes = codes { for code in codes { - let stringValue = code.stringValue! - if(self.flutterResult != nil){ - self.flutterResult?("\(stringValue)"); - } - - print("Found code: \(stringValue)") + if let stringValue = code.stringValue, self.flutterResult != nil { + self.flutterResult?("\(stringValue)"); + print("Found code: \(stringValue)") + } } } })