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

Commit

Permalink
Merge pull request #5110 from corona-warn-app/fix/14973-EOL-App-still…
Browse files Browse the repository at this point in the history
…-tries-to-update-the-hidden-local-statistics

Fix/14973 EOL - App still tries to update the hidden local statistics
  • Loading branch information
30mar authored Mar 23, 2023
2 parents 908665a + 05454c1 commit 5d3b071
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/xcode/ENA/ENA/Source/Scenes/Home/HomeState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ class HomeState: ENStateHandlerUpdating {
}

func updateStatistics() {
// Hibernation
guard !CWAHibernationProvider.shared.isHibernationState else {
Log.info("\(#function) will not execute in hibernation state.")
return
}

statisticsProvider.statistics()
.sink(
receiveCompletion: { [weak self] result in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ class LocalStatisticsProvider: LocalStatisticsProviding {
}

func updateLocalStatistics(completion: ((Result<Void, Error>) -> Void)? = nil) {
// Hibernation
guard !CWAHibernationProvider.shared.isHibernationState else {
Log.info("\(#function) will not execute in hibernation state.")
completion?(.success(()))
return
}

let fetchedLocalStatisticsQueue = DispatchQueue(label: "com.sap.LocalStatisticsProvider.fetchedLocalStatistics")

var _fetchedLocalStatistics = [LocalStatisticsMetadata]()
Expand Down Expand Up @@ -186,6 +193,12 @@ class LocalStatisticsProvider: LocalStatisticsProviding {
store: LocalStatisticsCaching,
groupID: StatisticsGroupIdentifier
) -> Bool {
// Hibernation
guard !CWAHibernationProvider.shared.isHibernationState else {
Log.info("\(#function) will not execute in hibernation state.")
return false
}

guard let localStatistics = self.store.localStatistics.first(where: { $0.groupID == groupID }) else {
return true
}
Expand Down

0 comments on commit 5d3b071

Please sign in to comment.