From 13a7c1a752570104bf203aba81e859dc27616238 Mon Sep 17 00:00:00 2001 From: Adam Wushensky Date: Mon, 15 Jun 2020 12:46:45 -0700 Subject: [PATCH] Update readme --- README.md | 60 +++++++++++++++++++----------------------- gradle.properties | 2 +- scan-camera-android | 2 +- scan-framework-android | 2 +- 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 75863ec..b31fcdd 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ These libraries are published in the [jcenter](https://jcenter.bintray.com/com/g ```gradle dependencies { - implementation 'com.getbouncer:scan-framework:2.0.0011' - implementation 'com.getbouncer:scan-camera:2.0.0011' - implementation 'com.getbouncer:scan-ui:2.0.0011' + implementation 'com.getbouncer:scan-framework:2.0.0012' + implementation 'com.getbouncer:scan-camera:2.0.0012' + implementation 'com.getbouncer:scan-ui:2.0.0012' } ``` @@ -49,11 +49,11 @@ This library provides a user interface through which cards (payment, driver lice class MyActivity : Activity { /** - * This method should be called as soon in the application as possible to give time for - * the SDK to warm up ML model processing. + * If you're planning to use name extraction, call this method to download the name extraction ML models onto the + * client device. Make sure you call this with ample time to download the models before launching the scan activity. */ override fun onCreate(savedInstanceState: Bundle?) { - CardScanActivity.warmUp(this) + CardScanActivity.initializeNameExtraction(this, "") } /** @@ -63,7 +63,8 @@ class MyActivity : Activity { CardScanActivity.start( activity = this, apiKey = "", - enableEnterCardManually = true + enableEnterCardManually = true, + enableNameExtraction = true ) } @@ -72,39 +73,32 @@ class MyActivity : Activity { */ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) { if (CardScanActivity.isScanResult(requestCode)) { - if (resultCode == Activity.RESULT_OK) { - handleCardScanSuccess(CardScanActivity.getScannedCard(data)) - } else if (resultCode == Activity.RESULT_CANCELED) { - handleCardScanCanceled(data.getIntExtra(RESULT_CANCELED_REASON, -1)) - } + CardScanActivity.parseScanResult(resultCode, data, this) } } - - private fun handleCardScanSuccess(result: ScanResult) { - // do something with the scanned credit card + + override fun cardScanned(scanId: String?, scanResult: CardScanActivityResult) { + // do something with the scanned card } - - private fun handleCardScanCanceled(reason: Int) = when (reason) { - CANCELED_REASON_USER -> handleUserCanceled() - CANCELED_REASON_ENTER_MANUALLY -> handleEnterCardManually() - CANCELED_REASON_CAMERA_ERROR -> handleCameraError() - else -> handleCardScanFailed() + + override fun enterManually(scanId: String?) { + // the user requested to enter a card number manually } - - private fun handleUserCanceled() { - // do something when the user cancels the card scan + + override fun userCanceled(scanId: String?) { + // the user canceled the scan } - - private fun handleEnterCardManually() { - // do something when the user wants to enter a card manually + + override fun cameraError(scanId: String?) { + // there was an error accessing or using the camera } - - private fun handleCameraError() { - // do something when camera had an error + + override fun analyzerFailure(scanId: String?) { + // something went wrong with scanning and the card could not be scanned } - - private fun handleCardScanFailed() { - // do something when scanning a card failed + + override fun canceledUnknown(scanId: String?) { + // the scan was canceled for some unknown reason } } ``` diff --git a/gradle.properties b/gradle.properties index 96cc7b9..e8e8b32 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,4 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -version=2.0.0011 +version=2.0.0012 diff --git a/scan-camera-android b/scan-camera-android index 2326f4a..6bf928c 160000 --- a/scan-camera-android +++ b/scan-camera-android @@ -1 +1 @@ -Subproject commit 2326f4ac1f15242113fa5ecf8100b79aad84d2da +Subproject commit 6bf928ca3b03d6c6db54c7ce2ec0d6f6af9a5fec diff --git a/scan-framework-android b/scan-framework-android index 66bdef7..18e6dc0 160000 --- a/scan-framework-android +++ b/scan-framework-android @@ -1 +1 @@ -Subproject commit 66bdef7094ec0c8a657ee5a7c943573789881294 +Subproject commit 18e6dc03469964b92f5267ebc2e750a03bffbbc1