-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2361 from CruGlobal/develop
Merge develop into master
- Loading branch information
Showing
48 changed files
with
867 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...rogress/Data-DomainInterface/GetResumeLessonProgressModalInterfaceStringsRepository.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// GetResumeLessonProgressModalInterfaceStringsRepository.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 11/14/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
import LocalizationServices | ||
|
||
class GetResumeLessonProgressModalInterfaceStringsRepository: GetResumeLessonProgressModalInterfaceStringsRepositoryInterface { | ||
|
||
private let localizationServices: LocalizationServices | ||
|
||
init(localizationServices: LocalizationServices) { | ||
self.localizationServices = localizationServices | ||
} | ||
|
||
func getStringsPublisher(translateInLanguage: AppLanguageDomainModel) -> AnyPublisher<ResumeLessonProgressModalInterfaceStringsDomainModel, Never> { | ||
|
||
let localeId: String = translateInLanguage.localeId | ||
|
||
let interfaceStrings = ResumeLessonProgressModalInterfaceStringsDomainModel( | ||
title: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "lessons.resumeLessonModal.title"), | ||
subtitle: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "lessons.resumeLessonModal.subtitle"), | ||
startOverButtonText: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "lessons.resumeLessonModal.startOverButton"), | ||
continueButtonText: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "lessons.resumeLessonModal.continueButton") | ||
) | ||
|
||
return Just(interfaceStrings) | ||
.eraseToAnyPublisher() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...LessonProgress/Domain/Entities/ResumeLessonProgressModalInterfaceStringsDomainModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// ResumeLessonProgressModalInterfaceStringsDomainModel.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 11/14/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct ResumeLessonProgressModalInterfaceStringsDomainModel { | ||
let title: String | ||
let subtitle: String | ||
let startOverButtonText: String | ||
let continueButtonText: String | ||
|
||
static func emptyStrings() -> ResumeLessonProgressModalInterfaceStringsDomainModel { | ||
return ResumeLessonProgressModalInterfaceStringsDomainModel(title: "", subtitle: "", startOverButtonText: "", continueButtonText: "") | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ss/Domain/Interface/GetResumeLessonProgressModalInterfaceStringsRepositoryInterface.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// GetResumeLessonProgressModalInterfaceStringsRepositoryInterface.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 11/14/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
protocol GetResumeLessonProgressModalInterfaceStringsRepositoryInterface { | ||
|
||
func getStringsPublisher(translateInLanguage: AppLanguageDomainModel) -> AnyPublisher<ResumeLessonProgressModalInterfaceStringsDomainModel, Never> | ||
} |
27 changes: 27 additions & 0 deletions
27
...rLessonProgress/Domain/UseCases/GetResumeLessonProgressModalInterfaceStringsUseCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// GetResumeLessonProgressModalInterfaceStringsUseCase.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 11/14/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class GetResumeLessonProgressModalInterfaceStringsUseCase { | ||
|
||
private let getResumeLessonModalInterfaceStringsRepo: GetResumeLessonProgressModalInterfaceStringsRepositoryInterface | ||
|
||
init(getResumeLessonModalInterfaceStringsRepo: GetResumeLessonProgressModalInterfaceStringsRepositoryInterface) { | ||
self.getResumeLessonModalInterfaceStringsRepo = getResumeLessonModalInterfaceStringsRepo | ||
} | ||
|
||
func getStringsPublisher(appLanguage: AppLanguageDomainModel) -> AnyPublisher<ResumeLessonProgressModalInterfaceStringsDomainModel, Never> { | ||
|
||
return getResumeLessonModalInterfaceStringsRepo | ||
.getStringsPublisher(translateInLanguage: appLanguage) | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
} |
73 changes: 73 additions & 0 deletions
73
...UserLessonProgress/Presentation/ResumeLessonProgressModal/ResumeLessonProgressModal.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// ResumeLessonProgressModal.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 10/29/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ResumeLessonProgressModal: View { | ||
|
||
private let buttonHeight: CGFloat = 48 | ||
private let modalInset: CGFloat = 28 | ||
private let buttonInset: CGFloat = 20 | ||
private let buttonSpace: CGFloat = 12 | ||
|
||
@ObservedObject private var viewModel: ResumeLessonProgressModalViewModel | ||
|
||
init(viewModel: ResumeLessonProgressModalViewModel) { | ||
self.viewModel = viewModel | ||
} | ||
|
||
var body: some View { | ||
GeometryReader { geometry in | ||
let totalSpaceAroundModal = modalInset * 2 | ||
let modalWidth = geometry.size.width - totalSpaceAroundModal | ||
let totalSpaceAroundButtons = (buttonInset * 2) + buttonSpace | ||
let buttonWidth = (modalWidth - totalSpaceAroundButtons) / 2 | ||
|
||
ZStack { | ||
Color.clear | ||
.edgesIgnoringSafeArea(.all) | ||
.background(.ultraThinMaterial) | ||
|
||
VStack(spacing: 0) { | ||
Text(viewModel.interfaceStringsDomainModel.title) | ||
.font(FontLibrary.sfProTextRegular.font(size: 28)) | ||
.foregroundColor(ColorPalette.gtGrey.color) | ||
.padding(.top, 30) | ||
.padding(.bottom, 15) | ||
|
||
Text(viewModel.interfaceStringsDomainModel.subtitle) | ||
.font(FontLibrary.sfProTextRegular.font(size: 16)) | ||
.foregroundColor(ColorPalette.gtGrey.color) | ||
.multilineTextAlignment(.center) | ||
.padding(.horizontal, buttonInset + 20) | ||
.padding(.bottom, 35) | ||
|
||
HStack(spacing: buttonSpace) { | ||
GTWhiteButton(title: viewModel.interfaceStringsDomainModel.startOverButtonText, fontSize: 15, width: buttonWidth, height: buttonHeight) { | ||
viewModel.startOverButtonTapped() | ||
} | ||
GTBlueButton(title: viewModel.interfaceStringsDomainModel.continueButtonText, fontSize: 15, width: buttonWidth, height: buttonHeight) { | ||
viewModel.continueButtonTapped() | ||
} | ||
} | ||
.padding(.horizontal, buttonInset) | ||
.padding(.bottom, 21) | ||
} | ||
.background(Color.white) | ||
.cornerRadius(6) | ||
.shadow(color: Color.black.opacity(0.25), radius: 3, y: 3) | ||
.frame(width: modalWidth) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 6) | ||
.strokeBorder(Color.clear, lineWidth: 2) | ||
) | ||
} | ||
} | ||
|
||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...nProgress/Presentation/ResumeLessonProgressModal/ResumeLessonProgressModalViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// ResumeLessonProgressModalViewModel.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 11/14/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class ResumeLessonProgressModalViewModel: ObservableObject { | ||
|
||
private weak var flowDelegate: FlowDelegate? | ||
private let getInterfaceStringsUseCase: GetResumeLessonProgressModalInterfaceStringsUseCase | ||
private let getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase | ||
|
||
private var cancellables: Set<AnyCancellable> = Set() | ||
|
||
@Published private var appLanguage: AppLanguageDomainModel = LanguageCodeDomainModel.english.rawValue | ||
|
||
@Published var interfaceStringsDomainModel: ResumeLessonProgressModalInterfaceStringsDomainModel = ResumeLessonProgressModalInterfaceStringsDomainModel.emptyStrings() | ||
|
||
init(flowDelegate: FlowDelegate, getInterfaceStringsUseCase: GetResumeLessonProgressModalInterfaceStringsUseCase, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase) { | ||
self.flowDelegate = flowDelegate | ||
self.getInterfaceStringsUseCase = getInterfaceStringsUseCase | ||
self.getCurrentAppLanguageUseCase = getCurrentAppLanguageUseCase | ||
|
||
getCurrentAppLanguageUseCase | ||
.getLanguagePublisher() | ||
.receive(on: DispatchQueue.main) | ||
.assign(to: &$appLanguage) | ||
|
||
$appLanguage | ||
.dropFirst() | ||
.map { appLanguage in | ||
getInterfaceStringsUseCase.getStringsPublisher(appLanguage: appLanguage) | ||
} | ||
.switchToLatest() | ||
.receive(on: DispatchQueue.main) | ||
.sink { [weak self] interfaceStrings in | ||
|
||
self?.interfaceStringsDomainModel = interfaceStrings | ||
} | ||
.store(in: &cancellables) | ||
} | ||
|
||
// MARK: - Inputs | ||
|
||
func startOverButtonTapped() { | ||
flowDelegate?.navigate(step: .startOverTappedFromResumeLessonModal) | ||
} | ||
|
||
func continueButtonTapped() { | ||
flowDelegate?.navigate(step: .continueTappedFromResumeLessonModal) | ||
} | ||
} |
Oops, something went wrong.