Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Fix/14334 location based revoked certificates have a cov pass check note #5120

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class HealthCertifiedPersonCellModel {
qrCodeViewModel = HealthCertificateQRCodeViewModel(
base45: decodingFailedHealthCertificate.base45,
shouldBlockCertificateCode: false,
shouldHideCovPassNotice: false,
imageAccessibilityTraits: .image,
accessibilityLabel: AppStrings.HealthCertificate.Overview.covidDescription,
qrCodeAccessibilityIdentifier: AccessibilityIdentifiers.HealthCertificate.qrCodeView(of: decodingFailedHealthCertificate.base45),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class HealthCertificateQRCodeView: UIView {
qrCodeImageView.accessibilityLabel = viewModel.accessibilityLabel
qrCodeImageView.accessibilityIdentifier = viewModel.qrCodeAccessibilityIdentifier
blockingView.isHidden = !viewModel.shouldBlockCertificateCode
covPassCheckInfoStackView.isHidden = viewModel.shouldBlockCertificateCode
covPassCheckInfoStackView.isHidden = viewModel.shouldBlockCertificateCode || viewModel.shouldHideCovPassNotice
onCovPassCheckInfoButtonTap = viewModel.onCovPassCheckInfoButtonTap

subscriptions.removeAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct HealthCertificateQRCodeViewModel {
onCovPassCheckInfoButtonTap: @escaping () -> Void
) {
self.shouldBlockCertificateCode = !healthCertificate.isUsable && !(showRealQRCodeIfValidityStateBlocked && healthCertificate.validityState == .blocked)
self.shouldHideCovPassNotice = healthCertificate.validityState == .revoked
self.imageAccessibilityTraits = imageAccessibilityTraits
self.accessibilityLabel = accessibilityLabel
self.qrCodeAccessibilityIdentifier = qrCodeAccessibilityIdentifier
Expand All @@ -31,13 +32,15 @@ struct HealthCertificateQRCodeViewModel {
init(
base45: Base45,
shouldBlockCertificateCode: Bool,
shouldHideCovPassNotice: Bool = false
imageAccessibilityTraits: UIAccessibilityTraits,
accessibilityLabel: String,
qrCodeAccessibilityIdentifier: String,
covPassCheckInfoPosition: CovPassCheckInfoPosition,
onCovPassCheckInfoButtonTap: @escaping () -> Void
) {
self.shouldBlockCertificateCode = shouldBlockCertificateCode
self.shouldHideCovPassNotice = shouldHideCovPassNotice
self.imageAccessibilityTraits = imageAccessibilityTraits
self.accessibilityLabel = accessibilityLabel
self.qrCodeAccessibilityIdentifier = qrCodeAccessibilityIdentifier
Expand All @@ -54,6 +57,7 @@ struct HealthCertificateQRCodeViewModel {
case bottom
}

let shouldHideCovPassNotice: Bool
let shouldBlockCertificateCode: Bool
let imageAccessibilityTraits: UIAccessibilityTraits
let accessibilityLabel: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,33 @@ class HealthCertificateQRCodeViewTests: XCTestCase {
// THEN
XCTAssertTrue(qrCodeView.covPassCheckInfoStackViewIsHidden)
}
func testGIVEN_QRCodeView_WHEN_ConfigureWithRevocedHealthcertificate_THEN_NoticeLabelIsNotisible() throws {
// GIVEN
let qrCodeView = HealthCertificateQRCodeView(frame: CGRect(x: 0, y: 0, width: 320, height: 240))

let healthCertificate = try HealthCertificate(
base45: try base45Fake(
digitalCovidCertificate: DigitalCovidCertificate.fake(
testEntries: [.fake()]
)
),
validityState: .revoked
)

let viewModel = HealthCertificateQRCodeViewModel(
healthCertificate: healthCertificate,
showRealQRCodeIfValidityStateBlocked: false,
imageAccessibilityTraits: .image,
accessibilityLabel: "",
qrCodeAccessibilityIdentifier: "",
covPassCheckInfoPosition: .top,
onCovPassCheckInfoButtonTap: {}
)

// WHEN
qrCodeView.configure(with: viewModel)

// THEN
XCTAssertTrue(qrCodeView.covPassCheckInfoStackViewIsHidden)
}
}