diff --git a/.vscode/settings.json b/.vscode/settings.json index 2692c62..3898a9c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,8 @@ "cmake.sourceDirectory": "${workspaceFolder}/ios/Classes/src", "files.associations": { "__config": "cpp", - "__nullptr": "cpp" + "__nullptr": "cpp", + "codecvt": "cpp", + "cmath": "cpp" } } \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index e6068f8..ff04a27 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'com.markosyan.flutter_zxing' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.0' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/pubspec.lock b/example/pubspec.lock index af05c23..a88cbdb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -104,13 +104,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_beep: - dependency: transitive - description: - name: flutter_beep - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" flutter_lints: dependency: "direct dev" description: diff --git a/lib/src/ui/reader_widget.dart b/lib/src/ui/reader_widget.dart index 332733e..63943f0 100644 --- a/lib/src/ui/reader_widget.dart +++ b/lib/src/ui/reader_widget.dart @@ -5,7 +5,7 @@ import 'dart:math'; import 'package:camera/camera.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_beep/flutter_beep.dart'; +// import 'package:flutter_beep/flutter_beep.dart'; import '../../generated_bindings.dart'; import '../logic/zxing.dart'; @@ -19,7 +19,6 @@ class ReaderWidget extends StatefulWidget { required this.onScan, this.onControllerCreated, this.codeFormat = Format.Any, - this.beep = true, this.showCroppingRect = true, this.scannerOverlay, this.showFlashlight = true, @@ -32,7 +31,6 @@ class ReaderWidget extends StatefulWidget { final Function(CodeResult) onScan; final Function(CameraController?)? onControllerCreated; final int codeFormat; - final bool beep; final bool showCroppingRect; final ScannerOverlay? scannerOverlay; final bool showFlashlight; @@ -163,9 +161,6 @@ class _ReaderWidgetState extends State cropPercent: widget.cropPercent, ); if (result.isValidBool) { - if (widget.beep) { - FlutterBeep.beep(); - } widget.onScan(result); setState(() {}); await Future.delayed(const Duration(seconds: 1)); diff --git a/pubspec.yaml b/pubspec.yaml index c9d0706..09d7977 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,6 @@ dependencies: ffi: ^2.0.0 flutter: sdk: flutter - flutter_beep: ^1.0.0 image: ^3.2.0 dev_dependencies: diff --git a/zxscanner/android/.gitignore b/zxscanner/android/.gitignore index 6f56801..9c4d443 100644 --- a/zxscanner/android/.gitignore +++ b/zxscanner/android/.gitignore @@ -11,3 +11,8 @@ GeneratedPluginRegistrant.java key.properties **/*.keystore **/*.jks + +/fastlane/report.xml +/fastlane/private +/fastlane/**/*.png +fastlane/metadata/android/screenshots.html \ No newline at end of file diff --git a/zxscanner/android/Gemfile.lock b/zxscanner/android/Gemfile.lock index ce460b7..8ba7d4c 100644 --- a/zxscanner/android/Gemfile.lock +++ b/zxscanner/android/Gemfile.lock @@ -8,8 +8,8 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.600.0) - aws-sdk-core (3.131.1) + aws-partitions (1.602.0) + aws-sdk-core (3.131.2) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) @@ -66,7 +66,7 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) fastimage (2.2.6) - fastlane (2.206.2) + fastlane (2.207.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -106,9 +106,9 @@ GEM xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.22.0) - google-apis-core (>= 0.5, < 2.a) - google-apis-core (0.6.0) + google-apis-androidpublisher_v3 (0.23.0) + google-apis-core (>= 0.6, < 2.a) + google-apis-core (0.7.0) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -117,19 +117,19 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.11.0) - google-apis-core (>= 0.5, < 2.a) - google-apis-playcustomapp_v1 (0.8.0) - google-apis-core (>= 0.5, < 2.a) - google-apis-storage_v1 (0.15.0) - google-apis-core (>= 0.5, < 2.a) + google-apis-iamcredentials_v1 (0.12.0) + google-apis-core (>= 0.6, < 2.a) + google-apis-playcustomapp_v1 (0.9.0) + google-apis-core (>= 0.6, < 2.a) + google-apis-storage_v1 (0.16.0) + google-apis-core (>= 0.6, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) google-cloud-errors (1.2.0) - google-cloud-storage (1.36.2) + google-cloud-storage (1.37.0) addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) @@ -137,7 +137,7 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.1.3) + googleauth (1.2.0) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) @@ -173,9 +173,9 @@ GEM ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.3) - signet (0.16.1) + signet (0.17.0) addressable (~> 2.8) - faraday (>= 0.17.5, < 3.0) + faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) simctl (1.6.8) @@ -196,7 +196,7 @@ GEM unicode-display_width (1.8.0) webrick (1.7.0) word_wrap (1.0.0) - xcodeproj (1.21.0) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) diff --git a/zxscanner/android/app/build.gradle b/zxscanner/android/app/build.gradle index dd18284..925a77e 100644 --- a/zxscanner/android/app/build.gradle +++ b/zxscanner/android/app/build.gradle @@ -57,6 +57,8 @@ android { targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { @@ -81,4 +83,14 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + + // Used tests to automatically generate screenshots using Fastlane Screengrab +// implementation 'androidx.test:core:1.4.0' + testImplementation 'junit:junit:4.13.2' +// testImplementation "com.google.truth:truth:1.0" + androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test:runner:1.4.0' + androidTestImplementation 'androidx.test:rules:1.4.0' + androidTestImplementation 'tools.fastlane:screengrab:2.1.1' } diff --git a/zxscanner/android/app/src/androidTest/java/com/markosyan/zxscanner/JUnit4StyleTests.kt b/zxscanner/android/app/src/androidTest/java/com/markosyan/zxscanner/JUnit4StyleTests.kt new file mode 100644 index 0000000..04ebfa8 --- /dev/null +++ b/zxscanner/android/app/src/androidTest/java/com/markosyan/zxscanner/JUnit4StyleTests.kt @@ -0,0 +1,48 @@ +package com.markosyan.zxscanner + +import androidx.test.ext.junit.rules.ActivityScenarioRule +import org.junit.* +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import tools.fastlane.screengrab.Screengrab +import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy +import tools.fastlane.screengrab.cleanstatusbar.BluetoothState +import tools.fastlane.screengrab.cleanstatusbar.CleanStatusBar +import tools.fastlane.screengrab.cleanstatusbar.MobileDataType +import tools.fastlane.screengrab.locale.LocaleTestRule + + +@RunWith(JUnit4::class) +class JUnit4StyleTests { + companion object { + @JvmStatic + @BeforeClass + fun beforeAll() { + Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy()) + CleanStatusBar() + .setMobileNetworkDataType(MobileDataType.LTE) + .setBluetoothState(BluetoothState.DISCONNECTED) + .enable() + } + + @JvmStatic + @AfterClass + fun afterAll() { + CleanStatusBar.disable() + } + } + + @get:Rule + var activityRule = ActivityScenarioRule(MainActivity::class.java) + + @Rule @JvmField + val localeTestRule = LocaleTestRule() + + @Test + fun testTakeScannerScreenshot() { + Thread.sleep(3000) + Screengrab.screenshot("01_scanner_screen") + Thread.sleep(3000) + Assert.assertTrue(true) + } +} diff --git a/zxscanner/android/app/src/debug/AndroidManifest.xml b/zxscanner/android/app/src/debug/AndroidManifest.xml index 26463ba..3af931a 100644 --- a/zxscanner/android/app/src/debug/AndroidManifest.xml +++ b/zxscanner/android/app/src/debug/AndroidManifest.xml @@ -5,4 +5,21 @@ to allow setting breakpoints, to provide hot reload, etc. --> + + + + + + + + + + + + + + + + + diff --git a/zxscanner/android/app/src/test/java/com/markosyan/zxscanner/ExampleTest.kt b/zxscanner/android/app/src/test/java/com/markosyan/zxscanner/ExampleTest.kt new file mode 100644 index 0000000..5683e9a --- /dev/null +++ b/zxscanner/android/app/src/test/java/com/markosyan/zxscanner/ExampleTest.kt @@ -0,0 +1,11 @@ +package com.markosyan.zxscanner + +import org.junit.Assert +import org.junit.Test + +class ExampleTest { + @Test + fun addition_isCorrect() { + Assert.assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/zxscanner/android/fastlane/Appfile b/zxscanner/android/fastlane/Appfile new file mode 100644 index 0000000..6d14f28 --- /dev/null +++ b/zxscanner/android/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("fastlane/private/pc-api-8902372433309418312-948-1346a3d81bee.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one +package_name("com.markosyan.zxscanner") # e.g. com.krausefx.app diff --git a/zxscanner/android/fastlane/Fastfile b/zxscanner/android/fastlane/Fastfile new file mode 100644 index 0000000..c60c52d --- /dev/null +++ b/zxscanner/android/fastlane/Fastfile @@ -0,0 +1,52 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:android) + +platform :android do + desc "Runs all the tests" + lane :test do + gradle(task: "test") + end + + desc "Submit a new Beta Build to Crashlytics Beta" + lane :beta do + gradle(task: "clean assembleRelease") + crashlytics + + # sh "your_script.sh" + # You can also use other beta testing services here + end + + desc "Deploy a new version to the Google Play" + lane :deploy do + gradle(task: "clean assembleRelease") + upload_to_play_store + end + + desc "Build debug and test APK for screenshots" + lane :screenshots do + # build_android_app( + # task: 'assemble', + # build_type: 'Debug' + # ) + # build_android_app( + # task: 'assemble', + # build_type: 'AndroidTest' + # ) + # screengrab() + frameit + end +end diff --git a/zxscanner/android/fastlane/README.md b/zxscanner/android/fastlane/README.md new file mode 100644 index 0000000..4bdd621 --- /dev/null +++ b/zxscanner/android/fastlane/README.md @@ -0,0 +1,56 @@ +fastlane documentation +---- + +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +```sh +xcode-select --install +``` + +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) + +# Available Actions + +## Android + +### android test + +```sh +[bundle exec] fastlane android test +``` + +Runs all the tests + +### android beta + +```sh +[bundle exec] fastlane android beta +``` + +Submit a new Beta Build to Crashlytics Beta + +### android deploy + +```sh +[bundle exec] fastlane android deploy +``` + +Deploy a new version to the Google Play + +### android screenshots + +```sh +[bundle exec] fastlane android screenshots +``` + +Build debug and test APK for screenshots + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/zxscanner/android/fastlane/Screengrabfile b/zxscanner/android/fastlane/Screengrabfile new file mode 100644 index 0000000..a452aff --- /dev/null +++ b/zxscanner/android/fastlane/Screengrabfile @@ -0,0 +1,15 @@ +# remove the leading '#' to uncomment lines + +app_package_name('com.markosyan.zxscanner') +# use_tests_in_packages(['your.screenshot.tests.package']) + +app_apk_path('/Users/khorenmarkosyan/Documents/Projects/flutter_zxing/zxscanner/build/app/outputs/apk/debug/app-debug.apk') +tests_apk_path('/Users/khorenmarkosyan/Documents/Projects/flutter_zxing/zxscanner/build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk') + +locales(['en-US']) + +# clear all previously generated screenshots in your local output directory before creating new ones +clear_previous_screenshots(true) + +# For more information about all available options run +# fastlane screengrab --help diff --git a/zxscanner/android/fastlane/metadata/android/background.jpg b/zxscanner/android/fastlane/metadata/android/background.jpg new file mode 100644 index 0000000..83dc07c Binary files /dev/null and b/zxscanner/android/fastlane/metadata/android/background.jpg differ diff --git a/zxscanner/android/fastlane/metadata/android/en-US/full_description.txt b/zxscanner/android/fastlane/metadata/android/en-US/full_description.txt new file mode 100644 index 0000000..986629c --- /dev/null +++ b/zxscanner/android/fastlane/metadata/android/en-US/full_description.txt @@ -0,0 +1,5 @@ +Barcode and QR code scanner that supports more than 15 types of codes. +- Scan barcode from camera stream +- Scan barcode from image path +- Create barcode from text +- Flashlight and pinch to zoom support \ No newline at end of file diff --git a/zxscanner/android/fastlane/metadata/android/en-US/keyword.strings b/zxscanner/android/fastlane/metadata/android/en-US/keyword.strings new file mode 100644 index 0000000..62322cd --- /dev/null +++ b/zxscanner/android/fastlane/metadata/android/en-US/keyword.strings @@ -0,0 +1,3 @@ +"01_scanner_screen" = "SCAN"; +"02_creator_screen" = "CREATE"; +"03_help_screen" = "HELP"; \ No newline at end of file diff --git a/zxscanner/android/fastlane/metadata/android/en-US/short_description.txt b/zxscanner/android/fastlane/metadata/android/en-US/short_description.txt new file mode 100644 index 0000000..39c5594 --- /dev/null +++ b/zxscanner/android/fastlane/metadata/android/en-US/short_description.txt @@ -0,0 +1 @@ +Barcode and QR Code Scanner \ No newline at end of file diff --git a/zxscanner/android/fastlane/metadata/android/en-US/title.strings b/zxscanner/android/fastlane/metadata/android/en-US/title.strings new file mode 100644 index 0000000..06e2b95 --- /dev/null +++ b/zxscanner/android/fastlane/metadata/android/en-US/title.strings @@ -0,0 +1,3 @@ +"01_scanner_screen" = "Scan Barcodes"; +"02_creator_screen" = "Create Your Barcodes"; +"03_help_screen" = "Introduction To Barcodes"; \ No newline at end of file diff --git a/zxscanner/android/fastlane/metadata/android/en-US/title.txt b/zxscanner/android/fastlane/metadata/android/en-US/title.txt new file mode 100644 index 0000000..59c7231 --- /dev/null +++ b/zxscanner/android/fastlane/metadata/android/en-US/title.txt @@ -0,0 +1 @@ +ZXScanner \ No newline at end of file diff --git a/zxscanner/android/fastlane/metadata/android/en-US/video.txt b/zxscanner/android/fastlane/metadata/android/en-US/video.txt new file mode 100644 index 0000000..e69de29 diff --git a/zxscanner/android/fastlane/metadata/android/framefile.json b/zxscanner/android/fastlane/metadata/android/framefile.json new file mode 100644 index 0000000..b759f08 --- /dev/null +++ b/zxscanner/android/fastlane/metadata/android/framefile.json @@ -0,0 +1,35 @@ +{ + "device_frame_version": "latest", + "default": { + "title": { + "color": "#545454" + }, + "background": "./background.jpg", + "padding": 30, + "show_complete_frame": false, + "stack_title" : true, + "title_below_image": false, + "frame": "BLACK" + }, + + "data": [ + { + "filter": "01_scanner_screen", + "keyword": { + "color": "#BF382A" + } + }, + { + "filter": "02_creator_screen", + "keyword": { + "color": "#26AD5E" + } + }, + { + "filter": "03_help_screen", + "keyword": { + "color": "#394C82" + } + } + ] +} diff --git a/zxscanner/android/gradle/wrapper/gradle-wrapper.properties b/zxscanner/android/gradle/wrapper/gradle-wrapper.properties index cc5527d..1eb4b36 100644 --- a/zxscanner/android/gradle/wrapper/gradle-wrapper.properties +++ b/zxscanner/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 23 08:50:38 CEST 2017 +#Thu Jul 07 11:06:28 AMT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/zxscanner/pubspec.lock b/zxscanner/pubspec.lock index 133fa34..aecc5cf 100644 --- a/zxscanner/pubspec.lock +++ b/zxscanner/pubspec.lock @@ -21,7 +21,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.3.0" + version: "3.1.11" args: dependency: transitive description: @@ -203,7 +203,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.0.1" cupertino_icons: dependency: "direct main" description: @@ -258,13 +258,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_beep: - dependency: transitive - description: - name: flutter_beep - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" flutter_lints: dependency: "direct dev" description: @@ -851,7 +844,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.0" universal_io: dependency: transitive description: diff --git a/zxscanner/pubspec.yaml b/zxscanner/pubspec.yaml index aeeb126..2ba7a04 100644 --- a/zxscanner/pubspec.yaml +++ b/zxscanner/pubspec.yaml @@ -1,6 +1,6 @@ name: zxscanner description: A barcode scanner application. -publish_to: 'none' +publish_to: "none" version: 1.0.0+4 @@ -37,15 +37,17 @@ flutter_intl: dev_dependencies: build_runner: ^2.1.11 + # espresso: ^0.2.0+2 flutter_lints: ^2.0.1 flutter_native_splash: ^2.2.4 # flutter pub run flutter_native_splash:create flutter_test: sdk: flutter hive_generator: icons_launcher: ^1.1.9 # flutter pub run icons_launcher:create + # integration_test: + # sdk: flutter mobx_codegen: - flutter: uses-material-design: true @@ -54,8 +56,8 @@ flutter_native_splash: color_dark: "#131d25" image: assets/images/app_logo.png info_plist_files: - - 'ios/Runner/Info-Debug.plist' - - 'ios/Runner/Info-Release.plist' + - "ios/Runner/Info-Debug.plist" + - "ios/Runner/Info-Release.plist" flutter_icons: android: true @@ -65,7 +67,7 @@ flutter_icons: web: false remove_alpha_ios: true image_path: "assets/images/app_icon_border.png" - image_path_ios: 'assets/images/app_icon.png' - adaptive_icon_background: '#4C9BBA' - adaptive_icon_foreground: 'assets/images/app_icon_adaptive.png' - adaptive_icon_round: 'assets/images/app_icon_round.png' \ No newline at end of file + image_path_ios: "assets/images/app_icon.png" + adaptive_icon_background: "#4C9BBA" + adaptive_icon_foreground: "assets/images/app_icon_adaptive.png" + adaptive_icon_round: "assets/images/app_icon_round.png"