Skip to content

Commit

Permalink
Merge branch 'develop' into GT-app-flow-tests-dev-merge
Browse files Browse the repository at this point in the history
# Conflicts:
#	godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolsFilterSelectionView/Subviews/ToolFilterButtonView/ToolFilterButtonView.swift
  • Loading branch information
levieggertcru committed Jul 25, 2024
2 parents 2de36a2 + 201f6c1 commit 750c0ea
Show file tree
Hide file tree
Showing 210 changed files with 4,047 additions and 1,609 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/download_onesky_translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true

jobs:
build:
download_and_commit_onesky_translations:
runs-on: macos-14
env:
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run Tests

on:
push:
branches: [ develop, master, feature/*, releases/* ]
branches: [ develop, master ]
pull_request:
branches: [ develop, master, feature/*, releases/* ]

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Distribute To Testflight

on:
push:
branches: [ master, releases/* ]
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -14,7 +14,6 @@ concurrency:
jobs:
distribute_to_testflight:
runs-on: macos-14
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60
steps:
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.956.0)
aws-sdk-core (3.201.1)
aws-partitions (1.957.0)
aws-sdk-core (3.201.2)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
Expand Down
320 changes: 316 additions & 4 deletions godtools.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions godtools.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "ea584b1bef2b49fac80bdd94fb9aac7b6ff751c9759d8b8ed77b399b7efa4bcf",
"originHash" : "01118c20edbf992410dbd18dc8543d268a2c5d52f8d92674de8f87566072017c",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand All @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "c218c2054299b15ae577e818bbba16084d3eabe6",
"version" : "10.18.2"
"revision" : "3b62f154d00019ae29a71e9738800bb6f18b236d",
"version" : "10.19.2"
}
},
{
Expand All @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/AppsFlyerSDK/AppsFlyerFramework-Strict",
"state" : {
"revision" : "beffb10e977bcf5881c282351772868f43d1fe1a",
"version" : "6.14.3"
"revision" : "622bb3a6d31f88e128ee2816c11f490d072473a7",
"version" : "6.14.5"
}
},
{
Expand Down Expand Up @@ -114,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "26c898aed8bed13b8a63057ee26500abbbcb8d55",
"version" : "7.13.1"
"revision" : "57a1d307f42df690fdef2637f3e5b776da02aad6",
"version" : "7.13.3"
}
},
{
Expand All @@ -132,8 +132,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "0382ca27f22fb3494cf657d8dc356dc282cd1193",
"version" : "3.4.1"
"revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b",
"version" : "3.5.0"
}
},
{
Expand All @@ -159,8 +159,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
"version" : "1.22.2"
"revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
"version" : "1.22.5"
}
},
{
Expand All @@ -186,8 +186,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
"version" : "2.30909.0"
"revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
"version" : "2.30910.0"
}
},
{
Expand Down Expand Up @@ -231,8 +231,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-swift.git",
"state" : {
"revision" : "2000569f03948c281afc83c36c710ab15e5dd33c",
"version" : "10.50.0"
"revision" : "6e0772315809ff0a11cd265126350039a6aac59d",
"version" : "10.50.1"
}
},
{
Expand Down Expand Up @@ -267,8 +267,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "f25867a208f459d3c5a06935dceb9083b11cd539",
"version" : "1.22.0"
"revision" : "d57a5aecf24a25b32ec4a74be2f5d0a995a47c4b",
"version" : "1.27.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ class AppDataLayerDependencies {

func getTranslatedToolCategory() -> GetTranslatedToolCategory {
return GetTranslatedToolCategory(
languagesRepository: getLanguagesRepository(),
localizationServices: getLocalizationServices(),
resourcesRepository: getResourcesRepository()
)
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 @@ -36,6 +36,7 @@ class AppDiContainer {
let globalActivityDiContainer = GlobalActivityDiContainer(coreDataLayer: dataLayer)
let learnToShareToolDiContainer = LearnToShareToolDiContainer(coreDataLayer: dataLayer)
let lessonEvaluationDiContainer = LessonEvaluationFeatureDiContainer(coreDataLayer: dataLayer)
let lessonFilterDiContainer = LessonFilterDiContainer(coreDataLayer: dataLayer)
let lessonsDiContainer = LessonsFeatureDiContainer(coreDataLayer: dataLayer)
let onboardingDiContainer = OnboardingDiContainer(coreDataLayer: dataLayer)
let shareablesDiContainer: ShareablesDiContainer = ShareablesDiContainer(coreDataLayer: dataLayer)
Expand All @@ -58,6 +59,7 @@ class AppDiContainer {
globalActivity: globalActivityDiContainer,
learnToShareTool: learnToShareToolDiContainer,
lessonEvaluation: lessonEvaluationDiContainer,
lessonFilter: lessonFilterDiContainer,
lessons: lessonsDiContainer,
onboarding: onboardingDiContainer,
shareables: shareablesDiContainer,
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 @@ -19,6 +19,7 @@ class AppFeatureDiContainer {
let globalActivity: GlobalActivityDiContainer
let learnToShareTool: LearnToShareToolDiContainer
let lessonEvaluation: LessonEvaluationFeatureDiContainer
let lessonFilter: LessonFilterDiContainer
let lessons: LessonsFeatureDiContainer
let onboarding: OnboardingDiContainer
let shareables: ShareablesDiContainer
Expand All @@ -31,7 +32,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, lessons: LessonsFeatureDiContainer, 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, onboarding: OnboardingDiContainer, 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 @@ -42,6 +43,7 @@ class AppFeatureDiContainer {
self.globalActivity = globalActivity
self.learnToShareTool = learnToShareTool
self.lessonEvaluation = lessonEvaluation
self.lessonFilter = lessonFilter
self.lessons = lessons
self.onboarding = onboarding
self.shareables = shareables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class DashboardPresentationLayerDependencies {
return LessonsViewModel(
flowDelegate: unwrappedFlowDelegate,
resourcesRepository: appDiContainer.dataLayer.getResourcesRepository(),
getCurrentAppLanguageUseCase: appDiContainer.feature.appLanguage.domainLayer.getCurrentAppLanguageUseCase(),
getCurrentAppLanguageUseCase: appDiContainer.feature.appLanguage.domainLayer.getCurrentAppLanguageUseCase(),
getUserLessonFiltersUseCase: appDiContainer.feature.lessonFilter.domainLayer.getUserLessonFiltersUseCase(),
viewLessonsUseCase: appDiContainer.feature.lessons.domainLayer.getViewLessonsUseCase(),
trackScreenViewAnalyticsUseCase: appDiContainer.domainLayer.getTrackScreenViewAnalyticsUseCase(),
trackActionAnalyticsUseCase: appDiContainer.domainLayer.getTrackActionAnalyticsUseCase(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ class ToolViewModel: MobileContentPagesViewModel {
.persistUserToolSettingsPublisher(
with: renderer.value.resource.id,
primaryLanguageId: languages.primaryLanguageId,
parallelLanguageId: languages.parallelLanguageId,
selectedLanguageId: languages.selectedLanguageId
parallelLanguageId: languages.parallelLanguageId
)
}
.switchToLatest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ struct ToolFilterButtonView: View {
private static let cornerRadius: CGFloat = height / 2

private let buttonTitle: String
private let width: CGFloat
private let width: CGFloat?
private let backgroundColor: Color = Color.white
private let accessibility: AccessibilityStrings.Button
private let tappedClosure: (() -> Void)?

init(title: String, width: CGFloat, accessibility: AccessibilityStrings.Button, tappedClosure: (() -> Void)?) {
init(title: String, width: CGFloat? = nil, accessibility: AccessibilityStrings.Button, tappedClosure: (() -> Void)?) {

self.buttonTitle = title
self.width = width
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// GetLessonFilterLanguagesInterfaceStringsRepository.swift
// godtools
//
// Created by Rachael Skeath on 6/29/24.
// Copyright © 2024 Cru. All rights reserved.
//

import Foundation
import Combine
import LocalizationServices

class GetLessonFilterLanguagesInterfaceStringsRepository: GetLessonFilterLanguagesInterfaceStringsRepositoryInterface {

private let localizationServices: LocalizationServicesInterface

init(localizationServices: LocalizationServicesInterface) {
self.localizationServices = localizationServices
}

func getStringsPublisher(translateInAppLanguage: AppLanguageDomainModel) -> AnyPublisher<LessonFilterLanguagesInterfaceStringsDomainModel, Never> {

let localeId = translateInAppLanguage.localeId

let interfaceStrings = LessonFilterLanguagesInterfaceStringsDomainModel(
navTitle: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LessonFilterStringKeys.navTitle.rawValue)
)

return Just(interfaceStrings)
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
//
// GetLessonFilterLanguagesRepository.swift
// godtools
//
// Created by Rachael Skeath on 7/1/24.
// Copyright © 2024 Cru. All rights reserved.
//

import Foundation
import Combine
import LocalizationServices

class GetLessonFilterLanguagesRepository: GetLessonFilterLanguagesRepositoryInterface {

private let resourcesRepository: ResourcesRepository
private let languagesRepository: LanguagesRepository
private let getTranslatedLanguageName: GetTranslatedLanguageName
private let localizationServices: LocalizationServicesInterface

init(resourcesRepository: ResourcesRepository, languagesRepository: LanguagesRepository, getTranslatedLanguageName: GetTranslatedLanguageName, localizationServices: LocalizationServicesInterface) {
self.resourcesRepository = resourcesRepository
self.languagesRepository = languagesRepository
self.getTranslatedLanguageName = getTranslatedLanguageName
self.localizationServices = localizationServices
}

func getLessonFilterLanguagesPublisher(translatedInAppLanguage: AppLanguageDomainModel) -> AnyPublisher<[LessonLanguageFilterDomainModel], Never> {

return resourcesRepository.getResourcesChangedPublisher()
.flatMap { _ in

let languageIds = self.resourcesRepository.getAllLessonLanguageIds()

let languages = self.createLessonLanguageFilterDomainModelList(from: languageIds, translatedInAppLanguage: translatedInAppLanguage)

return Just(languages)
}
.eraseToAnyPublisher()
}

func getLessonLanguageFilterFromLanguageCode(languageCode: String?, translatedInAppLanguage: AppLanguageDomainModel) -> LessonLanguageFilterDomainModel? {

guard let languageCode = languageCode,
let language = languagesRepository.getLanguage(code: languageCode)
else {
return nil
}

return createLessonLanguageFilterDomainModel(with: language, translatedInAppLanguage: translatedInAppLanguage)
}

func getLessonLanguageFilterFromLanguageId(languageId: String?, translatedInAppLanguage: AppLanguageDomainModel) -> LessonLanguageFilterDomainModel? {

guard let languageId = languageId,
let language = languagesRepository.getLanguage(id: languageId)
else {
return nil
}

return createLessonLanguageFilterDomainModel(with: language, translatedInAppLanguage: translatedInAppLanguage)
}
}

extension GetLessonFilterLanguagesRepository {

private func createLessonLanguageFilterDomainModelList(from languageIds: [String], translatedInAppLanguage: AppLanguageDomainModel) -> [LessonLanguageFilterDomainModel] {

let languages: [LessonLanguageFilterDomainModel] = languagesRepository.getLanguages(ids: languageIds)
.compactMap { languageModel in

let lessonsAvailableCount: Int = resourcesRepository.getAllLessonsCount(filterByLanguageId: languageModel.id)

guard lessonsAvailableCount > 0 else {
return nil
}

return self.createLessonLanguageFilterDomainModel(with: languageModel, translatedInAppLanguage: translatedInAppLanguage)
}
.sorted { language1, language2 in

return language1.translatedName.lowercased() < language2.translatedName.lowercased()
}

return languages
}

private func createLessonLanguageFilterDomainModel(with languageModel: LanguageModel, translatedInAppLanguage: AppLanguageDomainModel) -> LessonLanguageFilterDomainModel? {

let lessonsAvailableCount: Int = resourcesRepository.getAllLessonsCount(filterByLanguageId: languageModel.id)

let languageName = getTranslatedLanguageName.getLanguageName(language: languageModel.code, translatedInLanguage: languageModel.code)
let translatedLanguageName = getTranslatedLanguageName.getLanguageName(language: languageModel.code, translatedInLanguage: translatedInAppLanguage)

let lessonsAvailableText: String = getLessonsAvailableText(lessonsAvailableCount: lessonsAvailableCount, translatedInAppLanguage: translatedInAppLanguage)

return LessonLanguageFilterDomainModel(
languageId: languageModel.id,
languageName: languageName,
translatedName: translatedLanguageName,
lessonsAvailableText: lessonsAvailableText
)
}

func getLessonsAvailableText(lessonsAvailableCount: Int, translatedInAppLanguage: AppLanguageDomainModel) -> String {

let formatString = localizationServices.stringForLocaleElseSystemElseEnglish(
localeIdentifier: translatedInAppLanguage.localeId,
key: LessonFilterStringKeys.lessonsAvailableText.rawValue
)

let localizedString = String(format: formatString, locale: Locale(identifier: translatedInAppLanguage), lessonsAvailableCount)

return localizedString
}
}
Loading

0 comments on commit 750c0ea

Please sign in to comment.