Skip to content

Commit

Permalink
Add flow for ineligible scanner submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
c3bryant committed Jan 31, 2022
1 parent b2be37b commit 1de8123
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/app_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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';
Expand Down
5 changes: 4 additions & 1 deletion lib/core/providers/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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!);
Expand Down

0 comments on commit 1de8123

Please sign in to comment.