From 1de81239b4a0d80b7ed8bc886382b0d5aa824400 Mon Sep 17 00:00:00 2001 From: "Bryant, Charles" Date: Mon, 31 Jan 2022 11:55:00 -0800 Subject: [PATCH] Add flow for ineligible scanner submissions --- lib/app_constants.dart | 4 ++++ lib/core/providers/scanner.dart | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/app_constants.dart b/lib/app_constants.dart index e08c5632a..921b37984 100644 --- a/lib/app_constants.dart +++ b/lib/app_constants.dart @@ -98,6 +98,8 @@ class ErrorConstants { static const authorizedPostErrors = 'Failed to upload data: '; static const authorizedPutErrors = 'Failed to update data: '; static const invalidBearerToken = 'Invalid bearer token'; + static const notAcceptable = + 'DioError [DioErrorType.response]: Http status error [406]'; static const duplicateRecord = 'DioError [DioErrorType.response]: Http status error [409]'; static const invalidMedia = @@ -119,6 +121,8 @@ class ScannerConstants { static const loggedOut = 'An error occurred. Please try again.\nCode #1039'; static const unknownError = 'An error occurred. Please try again.\nCode #1040'; + static const notAcceptable = + 'Barcode cannot be accepted due to recent positive test result.\nCode #1041'; static const scannerReauthFailure = 'Your session has expired. Please login to submit a scan.'; static const noRecentScan = 'No scan submitted'; diff --git a/lib/core/providers/scanner.dart b/lib/core/providers/scanner.dart index 0eaf66008..568107259 100644 --- a/lib/core/providers/scanner.dart +++ b/lib/core/providers/scanner.dart @@ -142,7 +142,10 @@ class ScannerDataProvider extends ChangeNotifier { _didError = true; isLoading = false; - if (_barcodeService.error! + if (_barcodeService.error!.contains(ErrorConstants.notAcceptable)) { + errorText = ScannerConstants.notAcceptable; + _isValidBarcode = false; + } else if (_barcodeService.error! .contains(ErrorConstants.duplicateRecord)) { RegExp bloodScreenTest = RegExp(r'^ZAP'); bool isBloodScreen = bloodScreenTest.hasMatch(_barcode!);