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

Commit 0b70cb0

Browse files
authoredApr 12, 2023
Merge pull request #5158 from corona-warn-app/fix/15011-False-Frame-Color-for-INVALID-and-REVOKED-Certificates-after-RampDown-20230412
Fix/15011 False Frame Color for INVALID and REVOKED Certificates after RampDown
2 parents 8a24d2d + 0cffd85 commit 0b70cb0

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed
 

‎src/xcode/ENA/ENA/Source/AppDelegate & Globals/AppDelegate.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, CoronaWarnAppDelegate, Re
812812
$0.objectDidChange.send($0)
813813
}
814814
healthCertificateService.updatePublishersFromStore()
815-
healthCertificateService.updateValidityStatesAndNotifications(completion: { })
815+
healthCertificateService.updateValidityStatesAndNotifications(completion: { [weak self] in
816+
self?.healthCertificateService.updateGradients()
817+
})
816818
// Clear all notifications including deadman notification
817819
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
818820

‎src/xcode/ENA/ENA/Source/Services/HealthCertificate/HealthCertificateService.swift

+22-22
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,28 @@ class HealthCertificateService: HealthCertificateServiceServable {
665665
$0 == decodingFailedHealthCertificate
666666
}
667667
}
668+
669+
func updateGradients() {
670+
let gradientTypes: [GradientView.GradientType] = [.lightBlue, .mediumBlue, .darkBlue]
671+
self.healthCertifiedPersons
672+
.enumerated()
673+
.forEach { index, person in
674+
let healthCertificate = person.mostRelevantHealthCertificate
675+
676+
if healthCertificate?.validityState == .valid ||
677+
healthCertificate?.validityState == .expiringSoon ||
678+
(healthCertificate?.type == .test && healthCertificate?.validityState == .expired) {
679+
person.gradientType = gradientTypes[index % 3]
680+
} else {
681+
person.gradientType = .solidGrey
682+
}
683+
684+
// Overwrite the blue or grey with green when mask state is optional
685+
if person.isMaskOptional {
686+
person.gradientType = .green
687+
}
688+
}
689+
}
668690

669691
// MARK: - Private
670692

@@ -748,28 +770,6 @@ class HealthCertificateService: HealthCertificateServiceServable {
748770
}
749771
}
750772

751-
private func updateGradients() {
752-
let gradientTypes: [GradientView.GradientType] = [.lightBlue, .mediumBlue, .darkBlue]
753-
self.healthCertifiedPersons
754-
.enumerated()
755-
.forEach { index, person in
756-
let healthCertificate = person.mostRelevantHealthCertificate
757-
758-
if healthCertificate?.validityState == .valid ||
759-
healthCertificate?.validityState == .expiringSoon ||
760-
(healthCertificate?.type == .test && healthCertificate?.validityState == .expired) {
761-
person.gradientType = gradientTypes[index % 3]
762-
} else {
763-
person.gradientType = .solidGrey
764-
}
765-
766-
// Overwrite the blue or grey with green when mask state is optional
767-
if person.isMaskOptional {
768-
person.gradientType = .green
769-
}
770-
}
771-
}
772-
773773
private func updateDCCWalletInfo(for person: HealthCertifiedPerson, completion: (() -> Void)? = nil) {
774774
guard !CWAHibernationProvider.shared.isHibernationState else {
775775
completion?()

0 commit comments

Comments
 (0)
This repository has been archived.