diff --git a/CoEpi/en.lproj/Localizable.strings b/CoEpi/en.lproj/Localizable.strings index 303009a..49eeb69 100644 --- a/CoEpi/en.lproj/Localizable.strings +++ b/CoEpi/en.lproj/Localizable.strings @@ -136,7 +136,7 @@ // what are exposure alerts "whatExposure.title" = "What are exposure alerts?"; -"whatExposure.HTMLbody" = "

Exposure alerts indicate that you have been in close proximity (e.g. within several feet) to someone with symptoms also using a compatible app.

How does CoEpi work?

CoEpi generates exposure alerts if your device has flagged another tracing app user who may have been infectious during your contact.

Based on the symptom report in the exposure alert, you can:

• Monitor yourself for symptoms in the days following the potential exposure

• Self-isolate within your household to reduce the risk of transmitting to others

• Talk with a healthcare provider about your exposure"; +"whatExposure.html_body" = "

Exposure alerts indicate that you have been in close proximity (e.g. within several feet) to someone with symptoms also using a compatible app.

How does CoEpi work?

CoEpi generates exposure alerts if your device has flagged another tracing app user who may have been infectious during your contact.

Based on the symptom report in the exposure alert, you can:

• Monitor yourself for symptoms in the days following the potential exposure

• Self-isolate within your household to reduce the risk of transmitting to others

• Talk with a healthcare provider about your exposure"; diff --git a/CoEpi/generated/strings.swift b/CoEpi/generated/strings.swift index eef49a5..7ea79cd 100644 --- a/CoEpi/generated/strings.swift +++ b/CoEpi/generated/strings.swift @@ -261,8 +261,8 @@ internal enum L10n { } internal enum WhatExposure { - ///

Exposure alerts indicate that you have been in close proximity (e.g. within several feet) to someone with symptoms also using a compatible app.

How does CoEpi work?

CoEpi generates exposure alerts if your device has flagged another tracing app user who may have been infectious during your contact.

Based on the symptom report in the exposure alert, you can:

• Monitor yourself for symptoms in the days following the potential exposure

• Self-isolate within your household to reduce the risk of transmitting to others

• Talk with a healthcare provider about your exposure

- internal static let htmLbody = L10n.tr("Localizable", "whatExposure.HTMLbody") + ///

Exposure alerts indicate that you have been in close proximity (e.g. within several feet) to someone with symptoms also using a compatible app.

How does CoEpi work?

CoEpi generates exposure alerts if your device has flagged another tracing app user who may have been infectious during your contact.

Based on the symptom report in the exposure alert, you can:

• Monitor yourself for symptoms in the days following the potential exposure

• Self-isolate within your household to reduce the risk of transmitting to others

• Talk with a healthcare provider about your exposure + internal static let htmlBody = L10n.tr("Localizable", "whatExposure.html_body") /// What are exposure alerts? internal static let title = L10n.tr("Localizable", "whatExposure.title") } diff --git a/CoEpi/ui/alerts/WhatAreAlertsViewController.swift b/CoEpi/ui/alerts/WhatAreAlertsViewController.swift index bb4280e..6af99c6 100644 --- a/CoEpi/ui/alerts/WhatAreAlertsViewController.swift +++ b/CoEpi/ui/alerts/WhatAreAlertsViewController.swift @@ -20,23 +20,27 @@ class WhatAreAlertsViewController: UIViewController { titleLabel.text = L10n.WhatExposure.title - bodyLabel.attributedText = L10n.WhatExposure.htmLbody.htmlToAttributedString + bodyLabel.attributedText = L10n.WhatExposure.htmlBody.htmlToAttributedString } } -extension String { +private extension String { var htmlToAttributedString: NSAttributedString? { - guard let data = data(using: .utf8) else { return NSAttributedString() } + guard let data = data(using: .utf8) else { + log.e("Couldn't encode string: \(self)") + return NSAttributedString() + } + do { return try NSAttributedString( data: data, - options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], + options: [.documentType: NSAttributedString.DocumentType.html, + .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil) - } catch { + + } catch let e { + log.e("Couldn't create attributed string with: \(self), e: \(e)") return NSAttributedString() } } - var htmlToString: String { - return htmlToAttributedString?.string ?? "" - } }