diff --git a/AnylineExamples/Anyline Examples Source/Tire/ViewController/ALTINScanViewController.m b/AnylineExamples/Anyline Examples Source/Tire/ViewController/ALTINScanViewController.m index 9a2aeaa55..370441d48 100644 --- a/AnylineExamples/Anyline Examples Source/Tire/ViewController/ALTINScanViewController.m +++ b/AnylineExamples/Anyline Examples Source/Tire/ViewController/ALTINScanViewController.m @@ -34,6 +34,8 @@ @interface ALTINScanViewController () *)recalledDOTs; + @end @@ -163,6 +165,20 @@ - (void)reloadScanView { [self changeScanViewMode:(ALTINScanMode)self.dialogIndexSelected]; } +// MARK: - Getters + +// A list of recalled DOT values outlined in https://anyline.atlassian.net/browse/SHOW-51 +// which should be treated especially with an extra result entry ++ (NSArray *)recalledDOTs { + return @[ + @"DOTUTY11M03119", + @"DOTA3E4WBYV2220", + @"DOTNB7T2T8W0403", + @"DOTHCXH03CX4618", + @"DOTFA4FJA90320", + ]; +} + // MARK: - Handle & present results - (void)scanPlugin:(ALScanPlugin *)scanPlugin resultReceived:(ALScanResult *)scanResult { @@ -172,7 +188,8 @@ - (void)scanPlugin:(ALScanPlugin *)scanPlugin resultReceived:(ALScanResult *)sca barcodeResult:nil image:[scanResult croppedImage] scanPlugin:scanPlugin viewPlugin:self.scanViewPlugin completion:^{ - NSArray *resultData = scanResult.pluginResult.fieldList.resultEntries; + NSArray *resultData = [self.class resultDataFromScanResult:scanResult]; + ALResultViewController *vc = [[ALResultViewController alloc] initWithResults:resultData]; vc.imagePrimary = scanResult.croppedImage; @@ -182,6 +199,26 @@ - (void)scanPlugin:(ALScanPlugin *)scanPlugin resultReceived:(ALScanResult *)sca }]; } ++ (NSArray *)resultDataFromScanResult:(ALScanResult *)scanResult { + NSMutableArray *resultEntries = [NSMutableArray arrayWithArray:scanResult.pluginResult.fieldList.resultEntries]; + // would add a Tire on Recall entry if the result falls in one of the few values hardcoded here. + BOOL needsRecalledEntry = NO; + for (ALResultEntry *res in resultEntries) { + if ([res.title isEqualToString:@"Tire Identification Number"]) { + // if result somehow split the scan result string with spaces, remove them first. + NSString *tin = [res.value stringByReplacingOccurrencesOfString:@" " withString:@""]; + if ([[self.class recalledDOTs] containsObject:tin]) { + needsRecalledEntry = YES; + } + } + } + if (needsRecalledEntry) { + // add it below the first entry + [resultEntries insertObject:[ALResultEntry withTitle:@"Tire on Recall" value:@"YES"] atIndex:1]; + } + return resultEntries; +} + // MARK: - Allow changing the scan mode - (void)showOptionsSelectionDialog { diff --git a/AnylineExamples/Anyline Examples Source/Utility/View/ResultScreen/ALResultCell.swift b/AnylineExamples/Anyline Examples Source/Utility/View/ResultScreen/ALResultCell.swift index 3c32c6b18..fb6b97645 100644 --- a/AnylineExamples/Anyline Examples Source/Utility/View/ResultScreen/ALResultCell.swift +++ b/AnylineExamples/Anyline Examples Source/Utility/View/ResultScreen/ALResultCell.swift @@ -93,8 +93,17 @@ class ALResultCell: UITableViewCell { titleStr = titleStr.replacingOccurrences(of: "@cyr", with: " Cyrillic", options: .caseInsensitive, range: titleRange) as NSString } - self.titleLabel.text = String(titleStr) - self.valueLabel.text = self.resultEntry?.value.replacingOccurrences(of: "\\n", with: "\n") + // Special formatting for TIN results https://anyline.atlassian.net/browse/SHOW-51 + // make it red, and the value bolded, if "Tire on Recall" = "YES" + if titleStr == "Tire on Recall" { + if self.resultEntry?.value == "YES" { + self.titleLabel.attributedText = .init(string: String(titleStr), attributes: [.foregroundColor : UIColor.red]) + self.valueLabel.attributedText = .init(string: "YES", attributes: [.foregroundColor : UIColor.red, .font: UIFont.boldSystemFont(ofSize: 16)]) + } + } else { + self.titleLabel.text = String(titleStr) + self.valueLabel.text = self.resultEntry?.value.replacingOccurrences(of: "\\n", with: "\n") + } if self.resultEntry?.shouldSpellOutValue == true && self.resultEntry?.isAvailable == true { if #available(iOS 13.0, *) { diff --git a/AnylineExamples/AnylineExamples.xcodeproj/project.pbxproj b/AnylineExamples/AnylineExamples.xcodeproj/project.pbxproj index 21735b1fe..842097e84 100644 --- a/AnylineExamples/AnylineExamples.xcodeproj/project.pbxproj +++ b/AnylineExamples/AnylineExamples.xcodeproj/project.pbxproj @@ -1384,7 +1384,7 @@ LIBRARY_SEARCH_PATHS = ( "$(SDKROOT)/System/Library/Frameworks", ); - MARKETING_VERSION = 51.0.1; + MARKETING_VERSION = 51.1.0; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = io.anyline.AnylineExamples.bundle; SDKROOT = iphoneos; @@ -1472,7 +1472,7 @@ LIBRARY_SEARCH_PATHS = ( "$(SDKROOT)/System/Library/Frameworks", ); - MARKETING_VERSION = 51.0.1; + MARKETING_VERSION = 51.1.0; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = io.anyline.AnylineExamples.bundle; SDKROOT = iphoneos; diff --git a/Documentation/html/Categories/NSArray+ALJSONExtras.html b/Documentation/html/Categories/NSArray+ALJSONExtras.html index b60d1e3fa..eb6db0cfc 100644 --- a/Documentation/html/Categories/NSArray+ALJSONExtras.html +++ b/Documentation/html/Categories/NSArray+ALJSONExtras.html @@ -106,7 +106,7 @@

Overview