From 042f13708bd0d3b5e1df0864de9f74a67c4c3e54 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 3 Oct 2024 09:48:24 -0400 Subject: [PATCH 1/2] Removed empty folder that still existed in pbxproj --- godtools.xcodeproj/project.pbxproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/godtools.xcodeproj/project.pbxproj b/godtools.xcodeproj/project.pbxproj index fb1f21ec9..5fc1e078b 100644 --- a/godtools.xcodeproj/project.pbxproj +++ b/godtools.xcodeproj/project.pbxproj @@ -11246,13 +11246,6 @@ path = Subviews; sourceTree = ""; }; - D40D77BD2AB23183008D3642 /* Models */ = { - isa = PBXGroup; - children = ( - ); - path = Models; - sourceTree = ""; - }; D4159D512C2CE0240088A203 /* PersistUserToolLanguageSettings */ = { isa = PBXGroup; children = ( @@ -11473,7 +11466,6 @@ D40D77B42AA900FB008D3642 /* ToolStringKeys.swift */, 45920D4E2A8D3D1800E336A8 /* ToolsView.swift */, 45920D4D2A8D3D1800E336A8 /* ToolsViewModel.swift */, - D40D77BD2AB23183008D3642 /* Models */, 45DD84C42A8BD53E0066A020 /* Subviews */, ); path = Tools; From caf4a4053262c9c5ff6570218baecbd056995da5 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 3 Oct 2024 09:49:30 -0400 Subject: [PATCH 2/2] If any error occurs during download, remove the DownloadedLanguage from the repository and then still allow the downloadError to propagate through --- .../DownloadToolLanguageRepository.swift | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/godtools/App/Features/AppLanguage/Data-DomainInterface/DownloadToolLanguageRepository.swift b/godtools/App/Features/AppLanguage/Data-DomainInterface/DownloadToolLanguageRepository.swift index c86a83198..43c61f96b 100644 --- a/godtools/App/Features/AppLanguage/Data-DomainInterface/DownloadToolLanguageRepository.swift +++ b/godtools/App/Features/AppLanguage/Data-DomainInterface/DownloadToolLanguageRepository.swift @@ -28,15 +28,31 @@ class DownloadToolLanguageRepository: DownloadToolLanguageRepositoryInterface { return toolLanguageDownloader .downloadToolLanguagePublisher(languageId: languageId) - .map { + .catch { (downloadError: Error) -> AnyPublisher in - let progress = $0.progress + return self.downloadedLanguagesRepository.deleteDownloadedLanguagePublisher(languageId: languageId) + .catch { (deleteError: Error) -> AnyPublisher in + + assertionFailure("Failed to delete object in RealmDatabase. \(deleteError.localizedDescription)") + + return Fail(error: downloadError) + .eraseToAnyPublisher() + } + .flatMap({ (void: Void) -> AnyPublisher in + return Fail(error: downloadError) + .eraseToAnyPublisher() + }) + .eraseToAnyPublisher() + } + .map { (dataModel: ToolDownloaderDataModel) in + + let progress = dataModel.progress if progress >= 1 { self.downloadedLanguagesRepository.storeDownloadedLanguage(languageId: languageId, downloadComplete: true) } - return $0.progress + return dataModel.progress } .eraseToAnyPublisher() }