Skip to content

Commit

Permalink
Merge pull request #2228 from minvws/bugfix/5280-line-break
Browse files Browse the repository at this point in the history
5280: Fixed line breaks in unique identifier
  • Loading branch information
Rool authored Jan 12, 2023
2 parents aca6de3 + af49bf5 commit dacc4d7
Showing 1 changed file with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class NegativeTestDetailsGenerator {
results += [EventDetails(field: EventDetailsTest.countryTestedIn, value: countryTestedIn)]
}

results += [EventDetails(field: EventDetailsTest.uniqueIdentifer, value: event.unique)]
results += [EventDetails(field: EventDetailsTest.uniqueIdentifer, value: event.nonBreakingUnique)]

return results
}
Expand Down Expand Up @@ -113,7 +113,7 @@ class PositiveTestDetailsGenerator {
results += [EventDetails(field: EventDetailsTest.countryTestedIn, value: countryTestedIn)]
}

results += [EventDetails(field: EventDetailsTest.uniqueIdentifer, value: event.unique)]
results += [EventDetails(field: EventDetailsTest.uniqueIdentifer, value: event.nonBreakingUnique)]

return results
}
Expand Down Expand Up @@ -177,7 +177,7 @@ class DCCTestDetailsGenerator {
EventDetails(field: EventDetailsDCCTest.facility, value: mappingManager.getDisplayFacility(test.testCenter)),
EventDetails(field: EventDetailsDCCTest.country, value: mappingManager.getDisplayCountry(test.country)),
EventDetails(field: EventDetailsDCCTest.issuer, value: mappingManager.getDisplayIssuer(test.issuer, country: test.country)),
EventDetails(field: EventDetailsDCCTest.certificateIdentifier, value: test.certificateIdentifier)
EventDetails(field: EventDetailsDCCTest.certificateIdentifier, value: test.nonBreakingCertificateIdentifier)
]
}
}
Expand Down Expand Up @@ -242,7 +242,7 @@ class VaccinationDetailsGenerator {
details += [EventDetails(field: EventDetailsVaccination.completionReason, value: event.vaccination?.completionStatus)]
details += [EventDetails(field: EventDetailsVaccination.date, value: formattedShotDate)]
details += [EventDetails(field: EventDetailsVaccination.country, value: country)]
details += [EventDetails(field: EventDetailsVaccination.uniqueIdentifer, value: event.unique)]
details += [EventDetails(field: EventDetailsVaccination.uniqueIdentifer, value: event.nonBreakingUnique)]

return details
}
Expand Down Expand Up @@ -284,7 +284,7 @@ class DCCVaccinationDetailsGenerator {
EventDetails(field: EventDetailsDCCVaccination.date, value: formattedVaccinationDate),
EventDetails(field: EventDetailsDCCVaccination.country, value: mappingManager.getDisplayCountry(vaccination.country)),
EventDetails(field: EventDetailsDCCVaccination.issuer, value: mappingManager.getDisplayIssuer(vaccination.issuer, country: vaccination.country)),
EventDetails(field: EventDetailsDCCVaccination.certificateIdentifier, value: vaccination.certificateIdentifier)
EventDetails(field: EventDetailsDCCVaccination.certificateIdentifier, value: vaccination.nonBreakingCertificateIdentifier)
]
}
}
Expand Down Expand Up @@ -313,7 +313,7 @@ class VaccinationAssessementDetailsGenerator {
if country != "" {
list.append(EventDetails(field: EventDetailsVaccinationAssessment.country, value: country))
}
list.append(EventDetails(field: EventDetailsVaccinationAssessment.uniqueIdentifer, value: event.unique))
list.append(EventDetails(field: EventDetailsVaccinationAssessment.uniqueIdentifer, value: event.nonBreakingUnique))
return list
}
}
Expand Down Expand Up @@ -342,7 +342,7 @@ class RecoveryDetailsGenerator {
EventDetails(field: EventDetailsRecovery.date, value: formattedShortTestDate),
EventDetails(field: EventDetailsRecovery.validFrom, value: formattedShortValidFromDate),
EventDetails(field: EventDetailsRecovery.validUntil, value: formattedShortValidUntilDate),
EventDetails(field: EventDetailsRecovery.uniqueIdentifer, value: event.unique)
EventDetails(field: EventDetailsRecovery.uniqueIdentifer, value: event.nonBreakingUnique)
]
}
}
Expand Down Expand Up @@ -372,11 +372,13 @@ class DCCRecoveryDetailsGenerator {
EventDetails(field: EventDetailsDCCRecovery.issuer, value: mappingManager.getDisplayIssuer(recovery.issuer, country: recovery.country)),
EventDetails(field: EventDetailsDCCRecovery.validFrom, value: formattedValidFromDate),
EventDetails(field: EventDetailsDCCRecovery.validUntil, value: formattedValidUntilDate),
EventDetails(field: EventDetailsDCCRecovery.certificateIdentifier, value: recovery.certificateIdentifier)
EventDetails(field: EventDetailsDCCRecovery.certificateIdentifier, value: recovery.nonBreakingCertificateIdentifier)
]
}
}

// MARK: - completion status

private extension EventFlow.VaccinationEvent {

/// Get a display version of the vaccination completion status
Expand All @@ -398,3 +400,36 @@ private extension EventFlow.VaccinationEvent {
}
}
}

// MARK: - Non breaking Unique / Identifier

extension EventFlow.Event {

public var nonBreakingUnique: String? {
if let unique {
return unique.replacingOccurrences(of: "-", with: "\u{2011}")
}
return nil
}
}

extension EuCredentialAttributes.Vaccination {

public var nonBreakingCertificateIdentifier: String {
return certificateIdentifier.replacingOccurrences(of: "-", with: "\u{2011}")
}
}

extension EuCredentialAttributes.RecoveryEntry {

public var nonBreakingCertificateIdentifier: String {
return certificateIdentifier.replacingOccurrences(of: "-", with: "\u{2011}")
}
}

extension EuCredentialAttributes.TestEntry {

public var nonBreakingCertificateIdentifier: String {
return certificateIdentifier.replacingOccurrences(of: "-", with: "\u{2011}")
}
}

0 comments on commit dacc4d7

Please sign in to comment.