Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GT-2452 Add support for new page collection type #2425

Merged
merged 11 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 47 additions & 55 deletions godtools.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ class AppDataLayerDependencies {
api: MobileContentTranslationsApi(config: getAppConfig(), ignoreCacheSession: sharedIgnoreCacheSession),
cache: RealmTranslationsCache(realmDatabase: sharedRealmDatabase),
resourcesFileCache: getResourcesFileCache(),
trackDownloadedTranslationsRepository: getTrackDownloadedTranslationsRepository()
trackDownloadedTranslationsRepository: getTrackDownloadedTranslationsRepository(),
remoteConfigRepository: getRemoteConfigRepository()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

class ChooseYourOwnAdventureView: MobileContentPagesView {
class ChooseYourOwnAdventureView: MobileContentRendererView {

private let viewModel: ChooseYourOwnAdventureViewModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import GodToolsToolParser
import Combine

class ChooseYourOwnAdventureViewModel: MobileContentPagesViewModel {
class ChooseYourOwnAdventureViewModel: MobileContentRendererViewModel {

private var cancellables: Set<AnyCancellable> = Set()

Expand All @@ -22,7 +22,7 @@ class ChooseYourOwnAdventureViewModel: MobileContentPagesViewModel {
@Published var hidesHomeButton: Bool = false
@Published var hidesBackButton: Bool = true

init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, initialPage: MobileContentPagesPage?, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase, selectedLanguageIndex: Int?) {
init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, initialPage: MobileContentRendererInitialPage?, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase, selectedLanguageIndex: Int?) {

self.flowDelegate = flowDelegate

Expand All @@ -38,7 +38,7 @@ class ChooseYourOwnAdventureViewModel: MobileContentPagesViewModel {

languageFont = FontLibrary.systemUIFont(size: 14, weight: .regular)

super.init(renderer: renderer, initialPage: initialPage, initialPageConfig: nil, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, initialPageRenderingType: .chooseYourOwnAdventure, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: selectedLanguageIndex)
super.init(renderer: renderer, initialPage: initialPage, initialPageConfig: nil, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: selectedLanguageIndex)
}

deinit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

class TractView: MobileContentPagesView {
class TractView: MobileContentRendererView {

private let viewModel: TractViewModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import GodToolsToolParser
import Combine

class TractViewModel: MobileContentPagesViewModel {
class TractViewModel: MobileContentRendererViewModel {

static let isLiveShareStreamingKey: String = "TractViewModel.isLiveShareStreamKey"

Expand All @@ -33,7 +33,7 @@ class TractViewModel: MobileContentPagesViewModel {

@Published var hidesRemoteShareIsActive: Bool = true

init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, tractRemoteSharePublisher: TractRemoteSharePublisher, tractRemoteShareSubscriber: TractRemoteShareSubscriber, resourceViewsService: ResourceViewsService, trackActionAnalyticsUseCase: TrackActionAnalyticsUseCase, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, liveShareStream: String?, initialPage: MobileContentPagesPage?, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase, selectedLanguageIndex: Int?, persistUserToolLanguageSettingsUseCase: PersistUserToolLanguageSettingsUseCase, shouldPersistToolSettings: Bool) {
init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, tractRemoteSharePublisher: TractRemoteSharePublisher, tractRemoteShareSubscriber: TractRemoteShareSubscriber, resourceViewsService: ResourceViewsService, trackActionAnalyticsUseCase: TrackActionAnalyticsUseCase, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, liveShareStream: String?, initialPage: MobileContentRendererInitialPage?, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase, selectedLanguageIndex: Int?, persistUserToolLanguageSettingsUseCase: PersistUserToolLanguageSettingsUseCase, shouldPersistToolSettings: Bool) {

self.flowDelegate = flowDelegate
self.tractRemoteSharePublisher = tractRemoteSharePublisher
Expand All @@ -56,7 +56,7 @@ class TractViewModel: MobileContentPagesViewModel {

languageFont = FontLibrary.systemUIFont(size: 14, weight: .regular)

super.init(renderer: renderer, initialPage: initialPage, initialPageConfig: nil, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, initialPageRenderingType: .visiblePages, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: selectedLanguageIndex)
super.init(renderer: renderer, initialPage: initialPage, initialPageConfig: nil, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: selectedLanguageIndex)

setupBinding()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

class LessonView: MobileContentPagesView {
class LessonView: MobileContentRendererView {

private let viewModel: LessonViewModel
private let progressView: LessonProgressView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
import UIKit
import Combine

class LessonViewModel: MobileContentPagesViewModel {
class LessonViewModel: MobileContentRendererViewModel {

private weak var flowDelegate: FlowDelegate?
private let storeLessonProgressUseCase: StoreUserLessonProgressUseCase
private static var storeLessonProgressCancellable: AnyCancellable?

let progress: ObservableValue<AnimatableValue<CGFloat>> = ObservableValue(value: AnimatableValue(value: 0, animated: false))

init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, resource: ResourceModel, primaryLanguage: LanguageModel, initialPage: MobileContentPagesPage?, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, storeLessonProgressUseCase: StoreUserLessonProgressUseCase, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase) {
init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, resource: ResourceModel, primaryLanguage: LanguageModel, initialPage: MobileContentRendererInitialPage?, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, storeLessonProgressUseCase: StoreUserLessonProgressUseCase, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase) {

self.flowDelegate = flowDelegate
self.storeLessonProgressUseCase = storeLessonProgressUseCase

let initialPageConfig = MobileContentPagesInitialPageConfig(shouldNavigateToStartPageIfLastPage: true, shouldNavigateToPreviousVisiblePageIfHiddenPage: true)
let initialPageConfig = MobileContentRendererInitialPageConfig(shouldNavigateToStartPageIfLastPage: true, shouldNavigateToPreviousVisiblePageIfHiddenPage: true)

super.init(renderer: renderer, initialPage: initialPage, initialPageConfig: initialPageConfig, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, initialPageRenderingType: .visiblePages, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: nil)
super.init(renderer: renderer, initialPage: initialPage, initialPageConfig: initialPageConfig, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: nil)
}

deinit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ChooseYourOwnAdventureFlow: ToolNavigationFlow, ToolSettingsNavigationFlow
var tractFlow: TractFlow?
var downloadToolTranslationFlow: DownloadToolTranslationsFlow?

init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentPagesPage?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool) {
init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentRendererInitialPage?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool) {

self.flowDelegate = flowDelegate
self.appDiContainer = appDiContainer
Expand Down Expand Up @@ -76,7 +76,7 @@ class ChooseYourOwnAdventureFlow: ToolNavigationFlow, ToolSettingsNavigationFlow

extension ChooseYourOwnAdventureFlow {

private func getChooseYourOwnAdventureView(toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentPagesPage?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool) -> UIViewController {
private func getChooseYourOwnAdventureView(toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentRendererInitialPage?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool) -> UIViewController {

let navigation: MobileContentRendererNavigation = appDiContainer.getMobileContentRendererNavigation(
parentFlow: self,
Expand Down
8 changes: 4 additions & 4 deletions godtools/App/Flows/Lesson/LessonFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LessonFlow: ToolNavigationFlow, Flow {
var tractFlow: TractFlow?
var downloadToolTranslationFlow: DownloadToolTranslationsFlow?

init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, trainingTipsEnabled: Bool, initialPage: MobileContentPagesPage?) {
init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, trainingTipsEnabled: Bool, initialPage: MobileContentRendererInitialPage?) {

self.flowDelegate = flowDelegate
self.appDiContainer = appDiContainer
Expand Down Expand Up @@ -76,7 +76,7 @@ class LessonFlow: ToolNavigationFlow, Flow {
return appDiContainer.dataLayer.getUserLessonProgressRepository().getLessonProgress(lessonId: lesson.id)
}

private var userLessonProgressPage: MobileContentPagesPage? {
private var userLessonProgressPage: MobileContentRendererInitialPage? {

guard let pageId = userLessonProgress?.lastViewedPageId else {
return nil
Expand Down Expand Up @@ -145,7 +145,7 @@ class LessonFlow: ToolNavigationFlow, Flow {
}
}

private func navigateToLesson(initialPage: MobileContentPagesPage?, animated: Bool) {
private func navigateToLesson(initialPage: MobileContentRendererInitialPage?, animated: Bool) {

let lessonView = getLessonView(initialPage: initialPage)

Expand All @@ -164,7 +164,7 @@ class LessonFlow: ToolNavigationFlow, Flow {

extension LessonFlow {

private func getLessonView(initialPage: MobileContentPagesPage?) -> UIViewController {
private func getLessonView(initialPage: MobileContentRendererInitialPage?) -> UIViewController {

let navigation: MobileContentRendererNavigation = appDiContainer.getMobileContentRendererNavigation(
parentFlow: self,
Expand Down
6 changes: 3 additions & 3 deletions godtools/App/Flows/ToolNavigation/ToolNavigationFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extension ToolNavigationFlow {
)
}

func navigateToTool(appLanguage: AppLanguageDomainModel, resourceId: String, languageIds: [String], liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentPagesPage?, shouldPersistToolSettings: Bool) {
func navigateToTool(appLanguage: AppLanguageDomainModel, resourceId: String, languageIds: [String], liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentRendererInitialPage?, shouldPersistToolSettings: Bool) {

let determineToolTranslationsToDownload = DetermineToolTranslationsToDownload(
resourceId: resourceId,
Expand All @@ -61,7 +61,7 @@ extension ToolNavigationFlow {
)
}

private func navigateToToolAndDetermineToolTranslationsToDownload(appLanguage: AppLanguageDomainModel, determineToolTranslationsToDownload: DetermineToolTranslationsToDownloadType, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentPagesPage?, shouldPersistToolSettings: Bool) {
private func navigateToToolAndDetermineToolTranslationsToDownload(appLanguage: AppLanguageDomainModel, determineToolTranslationsToDownload: DetermineToolTranslationsToDownloadType, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentRendererInitialPage?, shouldPersistToolSettings: Bool) {

let didDownloadToolTranslationsClosure = { [weak self] (result: Result<ToolTranslationsDomainModel, Error>) in

Expand Down Expand Up @@ -96,7 +96,7 @@ extension ToolNavigationFlow {
self.downloadToolTranslationFlow = downloadToolTranslationFlow
}

private func navigateToTool(appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentPagesPage?, shouldPersistToolSettings: Bool) {
private func navigateToTool(appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentRendererInitialPage?, shouldPersistToolSettings: Bool) {

let resourceType: ResourceType = toolTranslations.tool.resourceTypeEnum

Expand Down
4 changes: 2 additions & 2 deletions godtools/App/Flows/Tract/TractFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TractFlow: ToolNavigationFlow, ToolSettingsNavigationFlow {
var downloadToolTranslationFlow: DownloadToolTranslationsFlow?
var toolSettingsFlow: ToolSettingsFlow?

init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController?, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentPagesPage?, shouldPersistToolSettings: Bool) {
init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController?, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentRendererInitialPage?, shouldPersistToolSettings: Bool) {

self.flowDelegate = flowDelegate
self.appDiContainer = appDiContainer
Expand Down Expand Up @@ -139,7 +139,7 @@ class TractFlow: ToolNavigationFlow, ToolSettingsNavigationFlow {

extension TractFlow {

private func getToolView(toolTranslations: ToolTranslationsDomainModel, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentPagesPage?, shouldPersistToolSettings: Bool) -> UIViewController {
private func getToolView(toolTranslations: ToolTranslationsDomainModel, liveShareStream: String?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool, initialPage: MobileContentRendererInitialPage?, shouldPersistToolSettings: Bool) -> UIViewController {

let navigation: MobileContentRendererNavigation = appDiContainer.getMobileContentRendererNavigation(
parentFlow: self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ class MobileContentRendererPageViewFactories: MobileContentPageViewFactoryType {

case .chooseYourOwnAdventure:

let chooseYourOwnAdventureViewFactory = ChooseYourOwnAdventurePageViewFactory(
trackScreenViewAnalyticsUseCase: trackScreenViewAnalyticsUseCase,
mobileContentAnalytics: mobileContentAnalytics
)

let trainingViewFactory: TrainingViewFactory = TrainingViewFactory(
mobileContentAnalytics: mobileContentAnalytics,
getTrainingTipCompletedUseCase: getTrainingTipCompletedUseCase
)

pageViewFactories = [chooseYourOwnAdventureViewFactory, trainingViewFactory]
pageViewFactories = [trainingViewFactory]

case .lesson:

Expand Down
Loading
Loading