From a70483003351c3c839544645bba2f175ab9d83f0 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 7 Nov 2024 09:13:20 -0500 Subject: [PATCH 1/8] Create dependency container for feature favorited tool language settings persistence --- godtools.xcodeproj/project.pbxproj | 20 +++++++++++ .../DependencyContainer/AppDiContainer.swift | 2 ++ .../AppFeatureDiContainer.swift | 4 ++- ...anguageSettingsDataLayerDependencies.swift | 35 +++++++++++++++++++ ...tUserToolLanguageSettingsDiContainer.swift | 21 +++++++++++ ...guageSettingsDomainLayerDependencies.swift | 25 +++++++++++++ .../ToolSettingsDataLayerDependencies.swift | 14 -------- .../ToolSettingsDomainLayerDependencies.swift | 6 ---- godtools/App/Flows/App/AppFlow.swift | 2 +- godtools/App/Flows/Tract/TractFlow.swift | 2 +- 10 files changed, 108 insertions(+), 23 deletions(-) create mode 100644 godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDataLayerDependencies.swift create mode 100644 godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDiContainer.swift create mode 100644 godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDomainLayerDependencies.swift diff --git a/godtools.xcodeproj/project.pbxproj b/godtools.xcodeproj/project.pbxproj index 622136d318..84639c9209 100644 --- a/godtools.xcodeproj/project.pbxproj +++ b/godtools.xcodeproj/project.pbxproj @@ -622,6 +622,9 @@ 457FEF032CBEA43B0092E84B /* CYOAPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 457FEF002CBEA43B0092E84B /* CYOAPageViewModel.swift */; }; 457FEF042CBEA43B0092E84B /* CYOAPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 457FEEFF2CBEA43B0092E84B /* CYOAPageView.swift */; }; 4581657626F4DD4D000D660F /* MobileContentRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4581657526F4DD4D000D660F /* MobileContentRowView.swift */; }; + 4581696F2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4581696C2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift */; }; + 458169702CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4581696D2CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift */; }; + 458169712CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4581696E2CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift */; }; 4581D97F297AD21E00D056D6 /* JsonApiResponseData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4581D97E297AD21E00D056D6 /* JsonApiResponseData.swift */; }; 4581EAA32BFBE194008115FF /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 4581EAA22BFBE194008115FF /* RealmSwift */; }; 4581EAA52BFBE257008115FF /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 4581EAA42BFBE257008115FF /* RealmSwift */; }; @@ -2306,6 +2309,9 @@ 457FEEFF2CBEA43B0092E84B /* CYOAPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CYOAPageView.swift; sourceTree = ""; }; 457FEF002CBEA43B0092E84B /* CYOAPageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CYOAPageViewModel.swift; sourceTree = ""; }; 4581657526F4DD4D000D660F /* MobileContentRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileContentRowView.swift; sourceTree = ""; }; + 4581696C2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistUserToolLanguageSettingsDataLayerDependencies.swift; sourceTree = ""; }; + 4581696D2CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistUserToolLanguageSettingsDiContainer.swift; sourceTree = ""; }; + 4581696E2CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistUserToolLanguageSettingsDomainLayerDependencies.swift; sourceTree = ""; }; 4581D97E297AD21E00D056D6 /* JsonApiResponseData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonApiResponseData.swift; sourceTree = ""; }; 45828BC7279CCB5300F6B5F3 /* MobileContentCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobileContentCardView.swift; sourceTree = ""; }; 45828BC9279CCB6900F6B5F3 /* MobileContentCardViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileContentCardViewModel.swift; sourceTree = ""; }; @@ -6714,6 +6720,16 @@ path = ContentRow; sourceTree = ""; }; + 4581696B2CDD008400039D03 /* DependencyContainer */ = { + isa = PBXGroup; + children = ( + 4581696D2CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift */, + 4581696C2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift */, + 4581696E2CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift */, + ); + path = DependencyContainer; + sourceTree = ""; + }; 4581C58D285A5C7A0078425B /* ToolTraining */ = { isa = PBXGroup; children = ( @@ -11327,6 +11343,7 @@ children = ( D4159D572C2CE1D50088A203 /* Data */, D4159D562C2CE18C0088A203 /* Data-DomainInterface */, + 4581696B2CDD008400039D03 /* DependencyContainer */, D4159D522C2CE0B80088A203 /* Domain */, ); path = PersistUserToolLanguageSettings; @@ -13525,6 +13542,9 @@ D4C2A5642C3090C10035AB4D /* LessonFilterLanguagesInterfaceStringsDomainModel.swift in Sources */, 45E3476A2A49BE230014CCD1 /* FlowDelegate.swift in Sources */, 45D4A6CD29B126BB00DED984 /* MobileContentPagesPage.swift in Sources */, + 4581696F2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift in Sources */, + 458169702CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift in Sources */, + 458169712CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift in Sources */, 4598BD0D2BF7DF6800196463 /* AppleAuthentication+AuthenticationProviderInterface.swift in Sources */, 45677783287DB21F0044AEB2 /* ToolTrainingAnimatedTransitioning.swift in Sources */, 45AD20BB25938F1A00A096A0 /* ObservableValue.swift in Sources */, diff --git a/godtools/App/DependencyContainer/AppDiContainer.swift b/godtools/App/DependencyContainer/AppDiContainer.swift index 04ade03a66..e077abc888 100644 --- a/godtools/App/DependencyContainer/AppDiContainer.swift +++ b/godtools/App/DependencyContainer/AppDiContainer.swift @@ -47,6 +47,7 @@ class AppDiContainer { let lessonsDiContainer = LessonsFeatureDiContainer(coreDataLayer: dataLayer) let lessonProgressDiContainer = UserLessonProgressDiContainer(coreDataLayer: dataLayer) let onboardingDiContainer = OnboardingDiContainer(coreDataLayer: dataLayer) + let persistFavoritedToolLanguageSettingsDiContainer = PersistUserToolLanguageSettingsDiContainer(coreDataLayer: dataLayer) let shareablesDiContainer: ShareablesDiContainer = ShareablesDiContainer(coreDataLayer: dataLayer) let shareGodToolsDiContainer = ShareGodToolsDiContainer(coreDataLayer: dataLayer) let spotlightToolsDiContainer = SpotlightToolsDiContainer(coreDataLayer: dataLayer) @@ -71,6 +72,7 @@ class AppDiContainer { lessons: lessonsDiContainer, lessonProgress: lessonProgressDiContainer, onboarding: onboardingDiContainer, + persistFavoritedToolLanguageSettings: persistFavoritedToolLanguageSettingsDiContainer, shareables: shareablesDiContainer, shareGodTools: shareGodToolsDiContainer, spotlightTools: spotlightToolsDiContainer, diff --git a/godtools/App/DependencyContainer/AppFeatureDiContainer.swift b/godtools/App/DependencyContainer/AppFeatureDiContainer.swift index 3b8befe4b8..32b8fe733c 100644 --- a/godtools/App/DependencyContainer/AppFeatureDiContainer.swift +++ b/godtools/App/DependencyContainer/AppFeatureDiContainer.swift @@ -23,6 +23,7 @@ class AppFeatureDiContainer { let lessons: LessonsFeatureDiContainer let lessonProgress: UserLessonProgressDiContainer let onboarding: OnboardingDiContainer + let persistFavoritedToolLanguageSettings: PersistUserToolLanguageSettingsDiContainer let shareables: ShareablesDiContainer let shareGodTools: ShareGodToolsDiContainer let spotlightTools: SpotlightToolsDiContainer @@ -33,7 +34,7 @@ class AppFeatureDiContainer { let toolShortcutLinks: ToolShortcutLinksDiContainer let tutorial: TutorialFeatureDiContainer - init(account: AccountDiContainer, appLanguage: AppLanguageFeatureDiContainer, dashboard: DashboardDiContainer, downloadToolProgress: DownloadToolProgressFeatureDiContainer, favorites: FavoritesDiContainer, featuredLessons: FeaturedLessonsDiContainer, globalActivity: GlobalActivityDiContainer, learnToShareTool: LearnToShareToolDiContainer, lessonEvaluation: LessonEvaluationFeatureDiContainer, lessonFilter: LessonFilterDiContainer, lessons: LessonsFeatureDiContainer, lessonProgress: UserLessonProgressDiContainer, onboarding: OnboardingDiContainer, shareables: ShareablesDiContainer, shareGodTools: ShareGodToolsDiContainer, spotlightTools: SpotlightToolsDiContainer, toolDetails: ToolDetailsFeatureDiContainer, toolScreenShare: ToolScreenShareFeatureDiContainer, toolSettings: ToolSettingsDiContainer, toolsFilter: ToolsFilterFeatureDiContainer, toolShortcutLinks: ToolShortcutLinksDiContainer, tutorial: TutorialFeatureDiContainer) { + init(account: AccountDiContainer, appLanguage: AppLanguageFeatureDiContainer, dashboard: DashboardDiContainer, downloadToolProgress: DownloadToolProgressFeatureDiContainer, favorites: FavoritesDiContainer, featuredLessons: FeaturedLessonsDiContainer, globalActivity: GlobalActivityDiContainer, learnToShareTool: LearnToShareToolDiContainer, lessonEvaluation: LessonEvaluationFeatureDiContainer, lessonFilter: LessonFilterDiContainer, lessons: LessonsFeatureDiContainer, lessonProgress: UserLessonProgressDiContainer, onboarding: OnboardingDiContainer, persistFavoritedToolLanguageSettings: PersistUserToolLanguageSettingsDiContainer, shareables: ShareablesDiContainer, shareGodTools: ShareGodToolsDiContainer, spotlightTools: SpotlightToolsDiContainer, toolDetails: ToolDetailsFeatureDiContainer, toolScreenShare: ToolScreenShareFeatureDiContainer, toolSettings: ToolSettingsDiContainer, toolsFilter: ToolsFilterFeatureDiContainer, toolShortcutLinks: ToolShortcutLinksDiContainer, tutorial: TutorialFeatureDiContainer) { self.account = account self.appLanguage = appLanguage @@ -48,6 +49,7 @@ class AppFeatureDiContainer { self.lessons = lessons self.lessonProgress = lessonProgress self.onboarding = onboarding + self.persistFavoritedToolLanguageSettings = persistFavoritedToolLanguageSettings self.shareables = shareables self.shareGodTools = shareGodTools self.spotlightTools = spotlightTools diff --git a/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDataLayerDependencies.swift b/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDataLayerDependencies.swift new file mode 100644 index 0000000000..af51acc803 --- /dev/null +++ b/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDataLayerDependencies.swift @@ -0,0 +1,35 @@ +// +// PersistUserToolLanguageSettingsDataLayerDependencies.swift +// godtools +// +// Created by Levi Eggert on 11/7/24. +// Copyright © 2024 Cru. All rights reserved. +// + +import Foundation + +class PersistUserToolLanguageSettingsDataLayerDependencies { + + private let coreDataLayer: AppDataLayerDependencies + + init(coreDataLayer: AppDataLayerDependencies) { + + self.coreDataLayer = coreDataLayer + } + + // MARK: - Data Layer Classes + + func getUserToolSettingsRepository() -> UserToolSettingsRepository { + return UserToolSettingsRepository( + cache: RealmUserToolSettingsCache(realmDatabase: coreDataLayer.getSharedRealmDatabase()) + ) + } + + // MARK: - Domain Interface + + func getPersistUserToolLanguageSettingsRepositoryInterface() -> PersistUserToolLanguageSettingsRepositoryInterface { + return PersistUserToolLanguageSettingsRepository( + userToolSettingsRepository: getUserToolSettingsRepository() + ) + } +} diff --git a/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDiContainer.swift b/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDiContainer.swift new file mode 100644 index 0000000000..4a017b2445 --- /dev/null +++ b/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDiContainer.swift @@ -0,0 +1,21 @@ +// +// PersistUserToolLanguageSettingsDiContainer.swift +// godtools +// +// Created by Levi Eggert on 11/7/24. +// Copyright © 2024 Cru. All rights reserved. +// + +import Foundation + +class PersistUserToolLanguageSettingsDiContainer { + + let dataLayer: PersistUserToolLanguageSettingsDataLayerDependencies + let domainLayer: PersistUserToolLanguageSettingsDomainLayerDependencies + + init(coreDataLayer: AppDataLayerDependencies) { + + dataLayer = PersistUserToolLanguageSettingsDataLayerDependencies(coreDataLayer: coreDataLayer) + domainLayer = PersistUserToolLanguageSettingsDomainLayerDependencies(dataLayer: dataLayer) + } +} diff --git a/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDomainLayerDependencies.swift b/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDomainLayerDependencies.swift new file mode 100644 index 0000000000..9f517c48dd --- /dev/null +++ b/godtools/App/Features/PersistUserToolLanguageSettings/DependencyContainer/PersistUserToolLanguageSettingsDomainLayerDependencies.swift @@ -0,0 +1,25 @@ +// +// PersistUserToolLanguageSettingsDomainLayerDependencies.swift +// godtools +// +// Created by Levi Eggert on 11/7/24. +// Copyright © 2024 Cru. All rights reserved. +// + +import Foundation + +class PersistUserToolLanguageSettingsDomainLayerDependencies { + + private let dataLayer: PersistUserToolLanguageSettingsDataLayerDependencies + + init(dataLayer: PersistUserToolLanguageSettingsDataLayerDependencies) { + + self.dataLayer = dataLayer + } + + func getPersistUserToolLanguageSettingsUseCase() -> PersistUserToolLanguageSettingsUseCase { + return PersistUserToolLanguageSettingsUseCase( + persistUserToolLanguageSettingsRepositoryInterface: dataLayer.getPersistUserToolLanguageSettingsRepositoryInterface() + ) + } +} diff --git a/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDataLayerDependencies.swift b/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDataLayerDependencies.swift index f91a711fec..82f1c558f7 100644 --- a/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDataLayerDependencies.swift +++ b/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDataLayerDependencies.swift @@ -19,22 +19,8 @@ class ToolSettingsDataLayerDependencies { // MARK: - Data Layer Classes - func getUserToolSettingsRepository() -> UserToolSettingsRepository { - return UserToolSettingsRepository(cache: getRealmUserToolSettingsCache()) - } - - func getRealmUserToolSettingsCache() -> RealmUserToolSettingsCache { - return RealmUserToolSettingsCache(realmDatabase: coreDataLayer.getSharedRealmDatabase()) - } - // MARK: - Domain Interface - func getPersistUserToolLanguageSettingsRepositoryInterface() -> PersistUserToolLanguageSettingsRepositoryInterface { - return PersistUserToolLanguageSettingsRepository( - userToolSettingsRepository: getUserToolSettingsRepository() - ) - } - func getShareToolInterfaceStringsRepositoryInterface() -> GetShareToolInterfaceStringsRepositoryInterface { return GetShareToolInterfaceStringsRepository( resourcesRepository: coreDataLayer.getResourcesRepository(), diff --git a/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDomainLayerDependencies.swift b/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDomainLayerDependencies.swift index 9a3a8edffc..1876a1e4e0 100644 --- a/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDomainLayerDependencies.swift +++ b/godtools/App/Features/ToolSettings/DependencyContainer/ToolSettingsDomainLayerDependencies.swift @@ -17,12 +17,6 @@ class ToolSettingsDomainLayerDependencies { self.dataLayer = dataLayer } - func getPersistUserToolLanguageSettingsUseCase() -> PersistUserToolLanguageSettingsUseCase { - return PersistUserToolLanguageSettingsUseCase( - persistUserToolLanguageSettingsRepositoryInterface: dataLayer.getPersistUserToolLanguageSettingsRepositoryInterface() - ) - } - func getViewShareToolUseCase() -> ViewShareToolUseCase { return ViewShareToolUseCase( getInterfaceStringsRepository: dataLayer.getShareToolInterfaceStringsRepositoryInterface() diff --git a/godtools/App/Flows/App/AppFlow.swift b/godtools/App/Flows/App/AppFlow.swift index 8d79786ca7..82650ac13e 100644 --- a/godtools/App/Flows/App/AppFlow.swift +++ b/godtools/App/Flows/App/AppFlow.swift @@ -763,7 +763,7 @@ extension AppFlow { private func navigateToToolWithUserToolLanguageSettingsApplied(toolDataModelId: String, trainingTipsEnabled: Bool) { - let userToolSettingsRepository: UserToolSettingsRepository = appDiContainer.feature.toolSettings.dataLayer.getUserToolSettingsRepository() + let userToolSettingsRepository: UserToolSettingsRepository = appDiContainer.feature.persistFavoritedToolLanguageSettings.dataLayer.getUserToolSettingsRepository() if let userToolSettings = userToolSettingsRepository.getUserToolSettings(toolId: toolDataModelId) { diff --git a/godtools/App/Flows/Tract/TractFlow.swift b/godtools/App/Flows/Tract/TractFlow.swift index 98960f21a9..abc8c1c6cb 100644 --- a/godtools/App/Flows/Tract/TractFlow.swift +++ b/godtools/App/Flows/Tract/TractFlow.swift @@ -176,7 +176,7 @@ extension TractFlow { trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: appDiContainer.domainLayer.getIncrementUserCounterUseCase(), selectedLanguageIndex: selectedLanguageIndex, - persistUserToolLanguageSettingsUseCase: appDiContainer.feature.toolSettings.domainLayer.getPersistUserToolLanguageSettingsUseCase(), + persistUserToolLanguageSettingsUseCase: appDiContainer.feature.persistFavoritedToolLanguageSettings.domainLayer.getPersistUserToolLanguageSettingsUseCase(), shouldPersistToolSettings: shouldPersistToolSettings ) From 141e68fae9a3e5f5bf74bd50b76a4f6472de9004 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 7 Nov 2024 09:23:53 -0500 Subject: [PATCH 2/8] Removed getPersistedResponse() and added isAuthenticated computed property on UserAuthentication to check if user is authenticated --- .../AuthenticationProviderInterface.swift | 1 - ...entication+AuthenticationProviderInterface.swift | 7 ------- ...entication+AuthenticationProviderInterface.swift | 12 ------------ ...entication+AuthenticationProviderInterface.swift | 12 ------------ .../UserAuthentication/UserAuthentication.swift | 13 +++++++++---- 5 files changed, 9 insertions(+), 36 deletions(-) diff --git a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/AuthenticationProviderInterface.swift b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/AuthenticationProviderInterface.swift index e1da147cb1..00452c3f41 100644 --- a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/AuthenticationProviderInterface.swift +++ b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/AuthenticationProviderInterface.swift @@ -12,7 +12,6 @@ import Combine protocol AuthenticationProviderInterface { - func getPersistedResponse() -> AuthenticationProviderResponse? func authenticatePublisher(presentingViewController: UIViewController) -> AnyPublisher func renewTokenPublisher() -> AnyPublisher func signOutPublisher() -> AnyPublisher diff --git a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift index 6df2eb9f54..c25beb1524 100644 --- a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift +++ b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift @@ -45,13 +45,6 @@ extension AppleAuthentication: AuthenticationProviderInterface { return .success(response) } - func getPersistedResponse() -> AuthenticationProviderResponse? { - - // TODO: - access token renewal will come through MobileContentAPI? - - return nil - } - func authenticatePublisher(presentingViewController: UIViewController) -> AnyPublisher { return authenticatePublisher() diff --git a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/FacebookAuthentication+AuthenticationProviderInterface.swift b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/FacebookAuthentication+AuthenticationProviderInterface.swift index 787c74ea45..c358186ac0 100644 --- a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/FacebookAuthentication+AuthenticationProviderInterface.swift +++ b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/FacebookAuthentication+AuthenticationProviderInterface.swift @@ -40,18 +40,6 @@ extension FacebookAuthentication: AuthenticationProviderInterface { return .success(response) } - func getPersistedResponse() -> AuthenticationProviderResponse? { - - switch getResponseForPersistedData() { - - case .success(let response): - return response - - case .failure( _): - return nil - } - } - func authenticatePublisher(presentingViewController: UIViewController) -> AnyPublisher { return authenticatePublisher(from: presentingViewController) diff --git a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/GoogleAuthentication+AuthenticationProviderInterface.swift b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/GoogleAuthentication+AuthenticationProviderInterface.swift index 03e5ed7db6..05cf4dc332 100644 --- a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/GoogleAuthentication+AuthenticationProviderInterface.swift +++ b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/GoogleAuthentication+AuthenticationProviderInterface.swift @@ -40,18 +40,6 @@ extension GoogleAuthentication: AuthenticationProviderInterface { return .success(response) } - func getPersistedResponse() -> AuthenticationProviderResponse? { - - switch getResponseForPersistedData() { - - case .success(let response): - return response - - case .failure( _): - return nil - } - } - func authenticatePublisher(presentingViewController: UIViewController) -> AnyPublisher { return authenticatePublisher(from: presentingViewController) diff --git a/godtools/App/Features/Account/Data/UserAuthentication/UserAuthentication.swift b/godtools/App/Features/Account/Data/UserAuthentication/UserAuthentication.swift index 20de3afffc..cef0bf85f8 100644 --- a/godtools/App/Features/Account/Data/UserAuthentication/UserAuthentication.swift +++ b/godtools/App/Features/Account/Data/UserAuthentication/UserAuthentication.swift @@ -23,6 +23,15 @@ class UserAuthentication { self.mobileContentAuthTokenRepository = mobileContentAuthTokenRepository } + var isAuthenticated: Bool { + + guard let authTokenData = mobileContentAuthTokenRepository.getCachedAuthTokenModel() else { + return false + } + + return !authTokenData.isExpired + } + func getIsAuthenticatedChangedPublisher() -> AnyPublisher { return mobileContentAuthTokenRepository.getAuthTokenChangedPublisher() @@ -62,10 +71,6 @@ class UserAuthentication { return lastAuthenticatedProviderCache.getLastAuthenticatedProvider() } - func getPersistedResponse() -> AuthenticationProviderResponse? { - return getLastAuthenticatedProvider()?.getPersistedResponse() - } - func renewTokenPublisher() -> AnyPublisher { guard let lastAuthenticatedProvider = getLastAuthenticatedProviderType() else { From c9fbf3702ee3cd9174e3e4246d1e4e3994a64fe8 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 7 Nov 2024 09:58:54 -0500 Subject: [PATCH 3/8] Remove temp filter of en-PH to fil-x-taglish now that mobile content api contains fil-x-taglish --- .../LanguagesRepository/Api/Models/LanguageModel.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift index 3957831fdd..cfb58ae19d 100644 --- a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift +++ b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift @@ -47,14 +47,7 @@ struct LanguageModel: LanguageModelType, Codable { } // attributes - - // TODO: (GT-2399) Remove tempCode override. This is a temporary Taglish label until production switches to the fil-x-taglish language tag. - var tempCode: String = try attributesContainer?.decodeIfPresent(BCP47LanguageIdentifier.self, forKey: .code) ?? "" - if tempCode == "en-PH" { - tempCode = "fil-x-taglish" - } - - code = tempCode// try attributesContainer?.decodeIfPresent(BCP47LanguageIdentifier.self, forKey: .code) ?? "" // TODO: (GT-2399) Remove tempCode and replace with commented out line. + code = try attributesContainer?.decodeIfPresent(BCP47LanguageIdentifier.self, forKey: .code) ?? "" directionString = try attributesContainer?.decodeIfPresent(String.self, forKey: .direction) ?? "" name = try attributesContainer?.decodeIfPresent(String.self, forKey: .name) ?? "" forceLanguageName = try attributesContainer?.decodeIfPresent(Bool.self, forKey: .forceLanguageName) ?? false From e08bb89a7ddc479c21e38412b2e079440c07787f Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 7 Nov 2024 13:10:34 -0500 Subject: [PATCH 4/8] Fix app language not getting set --- .../ReviewShareShareable/ReviewShareShareableViewModel.swift | 5 +++++ godtools/App/Flows/ArticleDeepLink/ArticleDeepLinkFlow.swift | 2 ++ 2 files changed, 7 insertions(+) diff --git a/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableViewModel.swift b/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableViewModel.swift index 4449cd365c..65eb441ed5 100644 --- a/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableViewModel.swift +++ b/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableViewModel.swift @@ -42,6 +42,11 @@ class ReviewShareShareableViewModel: ObservableObject { self.getShareableImageUseCase = getShareableImageUseCase self.trackShareShareableTapUseCase = trackShareShareableTapUseCase + getCurrentAppLanguageUseCase + .getLanguagePublisher() + .receive(on: DispatchQueue.main) + .assign(to: &$appLanguage) + $appLanguage .dropFirst() .map { (appLanguage: AppLanguageDomainModel) in diff --git a/godtools/App/Flows/ArticleDeepLink/ArticleDeepLinkFlow.swift b/godtools/App/Flows/ArticleDeepLink/ArticleDeepLinkFlow.swift index 459bcb45d1..bb0ee5808d 100644 --- a/godtools/App/Flows/ArticleDeepLink/ArticleDeepLinkFlow.swift +++ b/godtools/App/Flows/ArticleDeepLink/ArticleDeepLinkFlow.swift @@ -39,6 +39,8 @@ class ArticleDeepLinkFlow: Flow { .receive(on: DispatchQueue.main) .sink { [weak self] (appLanguage: AppLanguageDomainModel) in + self?.appLanguage = appLanguage + if let aemCacheObject = appDiContainer.dataLayer.getArticleAemRepository().getAemCacheObject(aemUri: aemUri) { self?.navigateToArticleWebView(aemCacheObject: aemCacheObject, animated: true) From a629db47bf9ba258f7d5a99f297d51775c1a946b Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Thu, 7 Nov 2024 13:10:53 -0500 Subject: [PATCH 5/8] Fix to button tap area by placing rectangle within Button --- .../ReviewShareShareableView.swift | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableView.swift b/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableView.swift index 6a88c4d380..c2d9d8deb2 100644 --- a/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableView.swift +++ b/godtools/App/Features/Shareables/Presentation/ReviewShareShareable/ReviewShareShareableView.swift @@ -12,6 +12,7 @@ struct ReviewShareShareableView: View { private let maxPreviewImageSize: CGFloat = 250 private let bottomSpacing: CGFloat = 50 + private let shareButtonSize: CGSize = CGSize(width: 200, height: 60) @ObservedObject private var viewModel: ReviewShareShareableViewModel @@ -50,15 +51,21 @@ struct ReviewShareShareableView: View { viewModel.shareImageTapped() }) { - HStack(alignment: .center, spacing: 8) { - Image(ImageCatalog.toolSettingsShareImageButtonIcon.name) - Text(viewModel.shareImageButtonTitle) - .foregroundColor(.white) + ZStack { + + Rectangle() + .fill(ColorPalette.gtBlue.color) + .frame(width: shareButtonSize.width, height: shareButtonSize.height) + .cornerRadius(6) + + HStack(alignment: .center, spacing: 8) { + Image(ImageCatalog.toolSettingsShareImageButtonIcon.name) + Text(viewModel.shareImageButtonTitle) + .foregroundColor(.white) + } } } - .frame(width: 200, height: 50, alignment: .center) - .background(ColorPalette.gtBlue.color) - .cornerRadius(6) + .frame(width: shareButtonSize.width, height: shareButtonSize.height, alignment: .center) } .frame(width: geometry.size.width) .padding(EdgeInsets(top: 0, leading: 0, bottom: bottomSpacing, trailing: 0)) From bd4ce2b401fef13144b87b311226689f4681ee6a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:24:55 +0000 Subject: [PATCH 6/8] Update dependency ruby to v3.3.6 --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index fa7adc7ac7..9c25013dbb 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.5 +3.3.6 From b819aa0690249d459fa8db5b1259ea27fe6c5d51 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Fri, 8 Nov 2024 09:11:08 -0500 Subject: [PATCH 7/8] Also check against code == Int(CFNetworkErrors.cfErrorHTTPConnectionLost.rawValue) when checking for network connection lost --- .../SharedAppleExtensions/Foundation/Error/Error+Code.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift index 99212b26ed..7755c13271 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift @@ -23,7 +23,7 @@ extension Error { } var isNetworkConnectionLost: Bool { - return code == Int(CFNetworkErrors.cfErrorHTTPConnectionLost.rawValue) + return code == Int(CFNetworkErrors.cfErrorHTTPConnectionLost.rawValue) || code == Int(CFNetworkErrors.cfurlErrorNetworkConnectionLost.rawValue) } var isUserCancelled: Bool { From 03a81e7cd7ee30bf45c525e60ee7cdb111920189 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Fri, 8 Nov 2024 09:14:56 -0500 Subject: [PATCH 8/8] Move default error title and message into else and attach error code to default error message --- .../Flow+PresentError/Flow+PresentError.swift | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/godtools/App/Flows/Flow+PresentError/Flow+PresentError.swift b/godtools/App/Flows/Flow+PresentError/Flow+PresentError.swift index 9b41fe855b..fe7f72e95f 100644 --- a/godtools/App/Flows/Flow+PresentError/Flow+PresentError.swift +++ b/godtools/App/Flows/Flow+PresentError/Flow+PresentError.swift @@ -21,13 +21,6 @@ extension Flow { let localizationServices: LocalizationServices = appDiContainer.dataLayer.getLocalizationServices() - let defaultErrorTitle: String = localizationServices.stringForLocaleElseEnglish( - localeIdentifier: appLanguage, - key: LocalizableStringKeys.error.key - ) - - let defaultErrorMessage: String = error.localizedDescription - let title: String let message: String @@ -57,8 +50,12 @@ extension Flow { } else { - title = defaultErrorTitle - message = defaultErrorMessage + title = localizationServices.stringForLocaleElseEnglish( + localeIdentifier: appLanguage, + key: LocalizableStringKeys.error.key + ) + + message = error.localizedDescription + "\n error code: \(error.code)" } presentAlert(