From 6f550687eb229a7b860f0e962f19fadc6ffb31f1 Mon Sep 17 00:00:00 2001 From: Felix Schmidt Date: Tue, 2 May 2023 13:08:12 +0200 Subject: [PATCH] 14996: Show pandemic radar tile with a fresh CWA installation after EOL. --- .../Localization/bg.lproj/Localizable.links.strings | 2 ++ .../Localization/de.lproj/Localizable.links.strings | 2 ++ .../Localization/en.lproj/Localizable.links.strings | 2 ++ .../Localization/pl.lproj/Localizable.links.strings | 2 ++ .../Localization/ro.lproj/Localizable.links.strings | 2 ++ .../Localization/tr.lproj/Localizable.links.strings | 2 ++ .../Cells/Statistics/HomeStatisticsCellModel.swift | 13 +++++++++---- .../Statistics/HomeStatisticsTableViewCell.swift | 2 ++ .../Statistics/HomeStatisticsTableViewCell.xib | 1 + .../SAP_Internal_Stats_LinkCard+Mock.swift | 2 +- .../ENA/Source/Scenes/Home/HomeTableViewModel.swift | 2 +- .../ENA/ENA/Source/View Helpers/AppStrings.swift | 1 + 12 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/xcode/ENA/ENA/Resources/Localization/bg.lproj/Localizable.links.strings b/src/xcode/ENA/ENA/Resources/Localization/bg.lproj/Localizable.links.strings index dcc244d738f..e68115cac1d 100644 --- a/src/xcode/ENA/ENA/Resources/Localization/bg.lproj/Localizable.links.strings +++ b/src/xcode/ENA/ENA/Resources/Localization/bg.lproj/Localizable.links.strings @@ -69,3 +69,5 @@ "ExposureSubmission_WarnWithoutTAN_FAQLink" = "https://www.coronawarn.app/en/faq/results/#warn_without_tan"; "Home_EndOfLifeThankYouTile_FAQLink" = "https://www.coronawarn.app/en/faq/#ramp_down"; + +"Home_LinkCard_PandemicRadar_URL" = "https://corona-pandemieradar.de/en"; diff --git a/src/xcode/ENA/ENA/Resources/Localization/de.lproj/Localizable.links.strings b/src/xcode/ENA/ENA/Resources/Localization/de.lproj/Localizable.links.strings index 61b2cb739d0..5c0dfc2cc65 100644 --- a/src/xcode/ENA/ENA/Resources/Localization/de.lproj/Localizable.links.strings +++ b/src/xcode/ENA/ENA/Resources/Localization/de.lproj/Localizable.links.strings @@ -71,3 +71,5 @@ "ExposureSubmission_WarnWithoutTAN_FAQLink" = "https://www.coronawarn.app/de/faq/results/#warn_without_tan"; "Home_EndOfLifeThankYouTile_FAQLink" = "https://www.coronawarn.app/de/faq/#ramp_down"; + +"Home_LinkCard_PandemicRadar_URL" = "https://corona-pandemieradar.de/de"; diff --git a/src/xcode/ENA/ENA/Resources/Localization/en.lproj/Localizable.links.strings b/src/xcode/ENA/ENA/Resources/Localization/en.lproj/Localizable.links.strings index ba5dc036119..2a876ab998a 100644 --- a/src/xcode/ENA/ENA/Resources/Localization/en.lproj/Localizable.links.strings +++ b/src/xcode/ENA/ENA/Resources/Localization/en.lproj/Localizable.links.strings @@ -71,3 +71,5 @@ "ExposureSubmission_WarnWithoutTAN_FAQLink" = "https://www.coronawarn.app/en/faq/results/#warn_without_tan"; "Home_EndOfLifeThankYouTile_FAQLink" = "https://www.coronawarn.app/en/faq/#ramp_down"; + +"Home_LinkCard_PandemicRadar_URL" = "https://corona-pandemieradar.de/en"; diff --git a/src/xcode/ENA/ENA/Resources/Localization/pl.lproj/Localizable.links.strings b/src/xcode/ENA/ENA/Resources/Localization/pl.lproj/Localizable.links.strings index 909dde4de12..29c16c8387a 100644 --- a/src/xcode/ENA/ENA/Resources/Localization/pl.lproj/Localizable.links.strings +++ b/src/xcode/ENA/ENA/Resources/Localization/pl.lproj/Localizable.links.strings @@ -69,3 +69,5 @@ "ExposureSubmission_WarnWithoutTAN_FAQLink" = "https://www.coronawarn.app/en/faq/results/#warn_without_tan"; "Home_EndOfLifeThankYouTile_FAQLink" = "https://www.coronawarn.app/en/faq/#ramp_down"; + +"Home_LinkCard_PandemicRadar_URL" = "https://corona-pandemieradar.de/en"; diff --git a/src/xcode/ENA/ENA/Resources/Localization/ro.lproj/Localizable.links.strings b/src/xcode/ENA/ENA/Resources/Localization/ro.lproj/Localizable.links.strings index 0b4101174f4..32986a3e523 100644 --- a/src/xcode/ENA/ENA/Resources/Localization/ro.lproj/Localizable.links.strings +++ b/src/xcode/ENA/ENA/Resources/Localization/ro.lproj/Localizable.links.strings @@ -69,3 +69,5 @@ "ExposureSubmission_WarnWithoutTAN_FAQLink" = "https://www.coronawarn.app/en/faq/results/#warn_without_tan"; "Home_EndOfLifeThankYouTile_FAQLink" = "https://www.coronawarn.app/en/faq/#ramp_down"; + +"Home_LinkCard_PandemicRadar_URL" = "https://corona-pandemieradar.de/en"; diff --git a/src/xcode/ENA/ENA/Resources/Localization/tr.lproj/Localizable.links.strings b/src/xcode/ENA/ENA/Resources/Localization/tr.lproj/Localizable.links.strings index e67b1b6bf99..1c074c74620 100644 --- a/src/xcode/ENA/ENA/Resources/Localization/tr.lproj/Localizable.links.strings +++ b/src/xcode/ENA/ENA/Resources/Localization/tr.lproj/Localizable.links.strings @@ -69,3 +69,5 @@ "ExposureSubmission_WarnWithoutTAN_FAQLink" = "https://www.coronawarn.app/en/faq/results/#warn_without_tan"; "Home_EndOfLifeThankYouTile_FAQLink" = "https://www.coronawarn.app/en/faq/#ramp_down"; + +"Home_LinkCard_PandemicRadar_URL" = "https://corona-pandemieradar.de/en"; diff --git a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsCellModel.swift b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsCellModel.swift index 15a44cf33ec..b5808fe8677 100644 --- a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsCellModel.swift +++ b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsCellModel.swift @@ -23,10 +23,15 @@ class HomeStatisticsCellModel { statistics.keyFigureCards.first { $0.header.cardID == cardID } } - self?.linkCards = statistics.supportedLinkCardIDSequence - .compactMap { cardID in - statistics.linkCards.first { $0.header.cardID == cardID } - } + if CWAHibernationProvider.shared.isHibernationState, statistics.linkCards.isEmpty { + // In hibernation, we don't have a server response, thatswhy we use the information hard coded + self?.linkCards = [.mock(cardID: HomeLinkCard.bmgPandemicRadar.rawValue)] + } else { + self?.linkCards = statistics.supportedLinkCardIDSequence + .compactMap { cardID in + statistics.linkCards.first { $0.header.cardID == cardID } + } + } #if DEBUG if isUITesting { self?.setupMockLinkCards() diff --git a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.swift b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.swift index f2a96ed23c2..ea03c6af768 100644 --- a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.swift +++ b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.swift @@ -208,6 +208,7 @@ class HomeStatisticsTableViewCell: UITableViewCell { @IBOutlet private weak var scrollView: UIScrollView! @IBOutlet private weak var stackView: UIStackView! @IBOutlet private weak var trailingConstraint: NSLayoutConstraint! + @IBOutlet private weak var bottomConstraint: NSLayoutConstraint! private var cellModel: HomeStatisticsCellModel? private var subscriptions = Set() @@ -311,6 +312,7 @@ class HomeStatisticsTableViewCell: UITableViewCell { guard !CWAHibernationProvider.shared.isHibernationState else { trailingConstraint.constant = 12 + bottomConstraint.constant = 12 return } diff --git a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.xib b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.xib index 0f116f96ce5..de0af12f0ff 100644 --- a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.xib +++ b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/HomeStatisticsTableViewCell.xib @@ -58,6 +58,7 @@ + diff --git a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/__tests__/SAP_Internal_Stats_LinkCard+Mock.swift b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/__tests__/SAP_Internal_Stats_LinkCard+Mock.swift index f6ccb08708e..3264d2d8f68 100644 --- a/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/__tests__/SAP_Internal_Stats_LinkCard+Mock.swift +++ b/src/xcode/ENA/ENA/Source/Scenes/Home/Cells/Statistics/__tests__/SAP_Internal_Stats_LinkCard+Mock.swift @@ -3,7 +3,7 @@ // extension SAP_Internal_Stats_LinkCard { - static let bmgPandemicRadarURLMock: String = "https://corona-pandemieradar.de/de" + static let bmgPandemicRadarURLMock: String = AppStrings.Links.pandemicRadarLink /** Returns a mocked `SAP_Internal_Stats_LinkCard` diff --git a/src/xcode/ENA/ENA/Source/Scenes/Home/HomeTableViewModel.swift b/src/xcode/ENA/ENA/Source/Scenes/Home/HomeTableViewModel.swift index 228649ad940..2739737b079 100644 --- a/src/xcode/ENA/ENA/Source/Scenes/Home/HomeTableViewModel.swift +++ b/src/xcode/ENA/ENA/Source/Scenes/Home/HomeTableViewModel.swift @@ -147,7 +147,7 @@ class HomeTableViewModel { let isGlobalStatisticsNotLoaded = state.statistics.supportedStatisticsCardIDSequence.isEmpty let isLocalStatisticsNotCached = state.store.selectedLocalStatisticsRegions.isEmpty - if isStatisticsCell && isGlobalStatisticsNotLoaded && isLocalStatisticsNotCached { + if isStatisticsCell && isGlobalStatisticsNotLoaded && isLocalStatisticsNotCached, !CWAHibernationProvider.shared.isHibernationState { Log.debug("[Autolayout] Layout issues due to preloading of statistics cell! ", log: .ui) // if this causes (further?) crashes we have to refactor the preloading of the statistics cell return 0 diff --git a/src/xcode/ENA/ENA/Source/View Helpers/AppStrings.swift b/src/xcode/ENA/ENA/Source/View Helpers/AppStrings.swift index d1be77311f6..cb88d84a888 100644 --- a/src/xcode/ENA/ENA/Source/View Helpers/AppStrings.swift +++ b/src/xcode/ENA/ENA/Source/View Helpers/AppStrings.swift @@ -60,6 +60,7 @@ enum AppStrings { static let coronaWarnAppStoreLink = NSLocalizedString("TicketValidation_CoronaWarnAppLink", tableName: "Localizable.links", comment: "") static let stikoVaccinationRecommendations = NSLocalizedString("Stiko_VaccinationRecommendations", tableName: "Localizable.links", comment: "") static let warnWithoutTANFAQLink = NSLocalizedString("ExposureSubmission_WarnWithoutTAN_FAQLink", tableName: "Localizable.links", comment: "") + static let pandemicRadarLink = NSLocalizedString("Home_LinkCard_PandemicRadar_URL", comment: "") } enum QuickActions {