Skip to content

Commit

Permalink
Merge pull request #2361 from CruGlobal/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
levieggertcru authored Dec 9, 2024
2 parents b19574c + 0af8e34 commit bc6b38d
Show file tree
Hide file tree
Showing 48 changed files with 867 additions and 489 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: bundle exec fastlane cru_shared_lane_run_tests output_directory:fastlane_scan_output_directory result_bundle:true reset_simulator:true should_clear_derived_data:true

- name: Upload Xcode Code Coverage Report to CodeCov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1003.0)
aws-sdk-core (3.212.0)
aws-partitions (1.1018.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.95.0)
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.170.0)
aws-sdk-s3 (1.176.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -218,23 +218,23 @@ GEM
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-accept (1.7.0)
http-cookie (1.0.7)
http-cookie (1.0.8)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.8.1)
json (2.9.0)
jwt (2.9.3)
base64
logger (1.6.1)
logger (1.6.2)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1105)
mime-types-data (3.2024.1203)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
minitest (5.25.4)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.1)
Expand Down Expand Up @@ -265,7 +265,7 @@ GEM
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
securerandom (0.3.1)
securerandom (0.4.0)
security (0.1.5)
signet (0.19.0)
addressable (~> 2.8)
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://cdn.cocoapods.org/'
source 'https://github.com/CruGlobal/cocoapods-specs.git'

# Uncomment this line to define a global platform for your project
platform :ios, '14.0'
platform :ios, '15.0'

# Specs finder:
# https://github.com/CocoaPods/Specs/find/master
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ SPEC REPOS:
- GodToolsShared

SPEC CHECKSUMS:
GodToolsShared: 404a619e53dc1890091397ac4e1da69afb5eabcd
GodToolsShared: 6001489c49a3af8a0ae8b169bf2604ccf3009666

PODFILE CHECKSUM: 1816453b60fe876696e3cc9b1da49602bb07e16b
PODFILE CHECKSUM: 62029dbaa542f28b266404816e2713f7474b6cb7

COCOAPODS: 1.15.2
162 changes: 89 additions & 73 deletions godtools.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class AppLanguagesApi {
AppLanguageCodable(languageCode: "ko", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "lv", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "pt", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "ro", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "ru", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "sw", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "ur", languageDirection: .rightToLeft, languageScriptCode: nil),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ struct ToolDetailsSectionDescriptionTextView: View {

VStack(alignment: .center, spacing: 0) {

BackwardsCompatibleTextWithLinks(
geometry: geometry,
text: text,
textColor: textColor,
textFont: textFont,
fontSize: fontSize,
TextWithLinksView(
stringContainingUrls: text,
textColor: textColor.color,
font: textFont.font(size: fontSize),
lineSpacing: lineSpacing,
urlTappedClosure: { (url: URL) in
textAlignment: .leading,
handleUrlClosure: { (url: URL) in

viewModel.urlTapped(url: url)
}
Expand Down
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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class UserLessonProgressDataLayerDependencies {

// MARK: - Domain Interface

func getResumeLessonProgressModalInterfaceStringsRepositoryInterface() -> GetResumeLessonProgressModalInterfaceStringsRepositoryInterface {
return GetResumeLessonProgressModalInterfaceStringsRepository(
localizationServices: coreDataLayer.getLocalizationServices()
)
}

func getStoreUserLessonProgressRepositoryInterface() -> StoreUserLessonProgressRepositoryInterface {
return StoreUserLessonProgressRepository(
lessonProgressRepository: coreDataLayer.getUserLessonProgressRepository()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class UserLessonProgressDomainLayerDependencies {
self.coreDataLayer = coreDataLayer
}

func getResumeLessonProgressModalInterfaceStringsUseCase() -> GetResumeLessonProgressModalInterfaceStringsUseCase {
return GetResumeLessonProgressModalInterfaceStringsUseCase(
getResumeLessonModalInterfaceStringsRepo: dataLayer.getResumeLessonProgressModalInterfaceStringsRepositoryInterface()
)
}

func getStoreUserLessonProgressUseCase() -> StoreUserLessonProgressUseCase {
return StoreUserLessonProgressUseCase(
storeLessonProgressRepository: dataLayer.getStoreUserLessonProgressRepositoryInterface()
Expand Down
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: "")
}
}
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>
}
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()
}

}
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)
)
}
}

}
}
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)
}
}
Loading

0 comments on commit bc6b38d

Please sign in to comment.