Skip to content

Commit

Permalink
Merge pull request #2336 from CruGlobal/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
levieggertcru authored Nov 8, 2024
2 parents 77db254 + ad53d63 commit af787bd
Show file tree
Hide file tree
Showing 22 changed files with 147 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.5
3.3.6
20 changes: 20 additions & 0 deletions godtools.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -2306,6 +2309,9 @@
457FEEFF2CBEA43B0092E84B /* CYOAPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CYOAPageView.swift; sourceTree = "<group>"; };
457FEF002CBEA43B0092E84B /* CYOAPageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CYOAPageViewModel.swift; sourceTree = "<group>"; };
4581657526F4DD4D000D660F /* MobileContentRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileContentRowView.swift; sourceTree = "<group>"; };
4581696C2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistUserToolLanguageSettingsDataLayerDependencies.swift; sourceTree = "<group>"; };
4581696D2CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistUserToolLanguageSettingsDiContainer.swift; sourceTree = "<group>"; };
4581696E2CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistUserToolLanguageSettingsDomainLayerDependencies.swift; sourceTree = "<group>"; };
4581D97E297AD21E00D056D6 /* JsonApiResponseData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonApiResponseData.swift; sourceTree = "<group>"; };
45828BC7279CCB5300F6B5F3 /* MobileContentCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobileContentCardView.swift; sourceTree = "<group>"; };
45828BC9279CCB6900F6B5F3 /* MobileContentCardViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileContentCardViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6714,6 +6720,16 @@
path = ContentRow;
sourceTree = "<group>";
};
4581696B2CDD008400039D03 /* DependencyContainer */ = {
isa = PBXGroup;
children = (
4581696D2CDD011600039D03 /* PersistUserToolLanguageSettingsDiContainer.swift */,
4581696C2CDD011600039D03 /* PersistUserToolLanguageSettingsDataLayerDependencies.swift */,
4581696E2CDD011600039D03 /* PersistUserToolLanguageSettingsDomainLayerDependencies.swift */,
);
path = DependencyContainer;
sourceTree = "<group>";
};
4581C58D285A5C7A0078425B /* ToolTraining */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -11327,6 +11343,7 @@
children = (
D4159D572C2CE1D50088A203 /* Data */,
D4159D562C2CE18C0088A203 /* Data-DomainInterface */,
4581696B2CDD008400039D03 /* DependencyContainer */,
D4159D522C2CE0B80088A203 /* Domain */,
);
path = PersistUserToolLanguageSettings;
Expand Down Expand Up @@ -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 */,
Expand Down
2 changes: 2 additions & 0 deletions godtools/App/DependencyContainer/AppDiContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -71,6 +72,7 @@ class AppDiContainer {
lessons: lessonsDiContainer,
lessonProgress: lessonProgressDiContainer,
onboarding: onboardingDiContainer,
persistFavoritedToolLanguageSettings: persistFavoritedToolLanguageSettingsDiContainer,
shareables: shareablesDiContainer,
shareGodTools: shareGodToolsDiContainer,
spotlightTools: spotlightToolsDiContainer,
Expand Down
4 changes: 3 additions & 1 deletion godtools/App/DependencyContainer/AppFeatureDiContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Combine

protocol AuthenticationProviderInterface {

func getPersistedResponse() -> AuthenticationProviderResponse?
func authenticatePublisher(presentingViewController: UIViewController) -> AnyPublisher<AuthenticationProviderResponse, Error>
func renewTokenPublisher() -> AnyPublisher<AuthenticationProviderResponse, Error>
func signOutPublisher() -> AnyPublisher<Void, Error>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuthenticationProviderResponse, Error> {

return authenticatePublisher()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuthenticationProviderResponse, Error> {

return authenticatePublisher(from: presentingViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuthenticationProviderResponse, Error> {

return authenticatePublisher(from: presentingViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bool, Never> {

return mobileContentAuthTokenRepository.getAuthTokenChangedPublisher()
Expand Down Expand Up @@ -62,10 +71,6 @@ class UserAuthentication {
return lastAuthenticatedProviderCache.getLastAuthenticatedProvider()
}

func getPersistedResponse() -> AuthenticationProviderResponse? {
return getLastAuthenticatedProvider()?.getPersistedResponse()
}

func renewTokenPublisher() -> AnyPublisher<MobileContentAuthTokenDataModel, MobileContentApiError> {

guard let lastAuthenticatedProvider = getLastAuthenticatedProviderType() else {
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
)
}
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
@@ -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()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion godtools/App/Flows/App/AppFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Loading

0 comments on commit af787bd

Please sign in to comment.