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

Fix/15011 False Frame Color for INVALID and REVOKED Certificates after RampDown #5158

Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -812,7 +812,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, CoronaWarnAppDelegate, Re
$0.objectDidChange.send($0)
}
healthCertificateService.updatePublishersFromStore()
healthCertificateService.updateValidityStatesAndNotifications(completion: { })
healthCertificateService.updateValidityStatesAndNotifications(completion: { [weak self] in
self?.healthCertificateService.updateGradients()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

})
// Clear all notifications including deadman notification
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,28 @@ class HealthCertificateService: HealthCertificateServiceServable {
$0 == decodingFailedHealthCertificate
}
}

func updateGradients() {
let gradientTypes: [GradientView.GradientType] = [.lightBlue, .mediumBlue, .darkBlue]
self.healthCertifiedPersons
.enumerated()
.forEach { index, person in
let healthCertificate = person.mostRelevantHealthCertificate

if healthCertificate?.validityState == .valid ||
healthCertificate?.validityState == .expiringSoon ||
(healthCertificate?.type == .test && healthCertificate?.validityState == .expired) {
person.gradientType = gradientTypes[index % 3]
} else {
person.gradientType = .solidGrey
}

// Overwrite the blue or grey with green when mask state is optional
if person.isMaskOptional {
person.gradientType = .green
}
}
}

// MARK: - Private

Expand Down Expand Up @@ -748,28 +770,6 @@ class HealthCertificateService: HealthCertificateServiceServable {
}
}

private func updateGradients() {
let gradientTypes: [GradientView.GradientType] = [.lightBlue, .mediumBlue, .darkBlue]
self.healthCertifiedPersons
.enumerated()
.forEach { index, person in
let healthCertificate = person.mostRelevantHealthCertificate

if healthCertificate?.validityState == .valid ||
healthCertificate?.validityState == .expiringSoon ||
(healthCertificate?.type == .test && healthCertificate?.validityState == .expired) {
person.gradientType = gradientTypes[index % 3]
} else {
person.gradientType = .solidGrey
}

// Overwrite the blue or grey with green when mask state is optional
if person.isMaskOptional {
person.gradientType = .green
}
}
}

private func updateDCCWalletInfo(for person: HealthCertifiedPerson, completion: (() -> Void)? = nil) {
guard !CWAHibernationProvider.shared.isHibernationState else {
completion?()
Expand Down