-
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 branch 'develop' of https://github.com/CruGlobal/godtools-swift …
…into GT-2219-Languages-Available-Offline # Conflicts: # godtools.xcodeproj/project.pbxproj
- Loading branch information
Showing
47 changed files
with
557 additions
and
362 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
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
52 changes: 52 additions & 0 deletions
52
...es/AppLanguage/Data-DomainInterface/GetConfirmAppLanguageInterfaceStringsRepository.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,52 @@ | ||
// | ||
// GetConfirmAppLanguageInterfaceStringsRepository.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 1/27/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class GetConfirmAppLanguageInterfaceStringsRepository: GetConfirmAppLanguageInterfaceStringsRepositoryInterface { | ||
|
||
private let localizationServices: LocalizationServices | ||
private let localeLanguageName: LocaleLanguageName | ||
|
||
init(localizationServices: LocalizationServices, localeLanguageName: LocaleLanguageName) { | ||
|
||
self.localizationServices = localizationServices | ||
self.localeLanguageName = localeLanguageName | ||
} | ||
|
||
func getStringsPublisher(translateInAppLanguage: AppLanguageDomainModel, selectedLanguage: AppLanguageDomainModel) -> AnyPublisher<ConfirmAppLanguageInterfaceStringsDomainModel, Never> { | ||
|
||
let appLanguageLocaleId: String = translateInAppLanguage | ||
|
||
let interfaceStrings = ConfirmAppLanguageInterfaceStringsDomainModel( | ||
messageInNewlySelectedLanguage: getAttributedMessageStringPublisher(selectedLanguage: selectedLanguage, localeId: selectedLanguage), | ||
messageInCurrentLanguage: getAttributedMessageStringPublisher(selectedLanguage: selectedLanguage, localeId: appLanguageLocaleId), | ||
changeLanguageButtonText: localizationServices.stringForLocaleElseEnglish(localeIdentifier: appLanguageLocaleId, key: "languageSettings.confirmAppLanguage.changeLanguageButton.title"), | ||
nevermindButtonText: localizationServices.stringForLocaleElseEnglish(localeIdentifier: appLanguageLocaleId, key: "languageSettings.confirmAppLanguage.nevermindButton.title") | ||
) | ||
|
||
return Just(interfaceStrings) | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
private func getAttributedMessageStringPublisher(selectedLanguage: AppLanguageDomainModel, localeId: String) -> NSAttributedString { | ||
|
||
let formatString = localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "languageSettings.confirmAppLanguage.message") | ||
|
||
let languageName = self.localeLanguageName.getLanguageName(forLanguageCode: selectedLanguage, translatedInLanguageId: localeId) ?? "" | ||
let languageNameAttributed = NSAttributedString( | ||
string: languageName, | ||
attributes: [NSAttributedString.Key.foregroundColor: ColorPalette.gtBlue.uiColor] | ||
) | ||
|
||
let attributedString = NSAttributedString(format: NSAttributedString(string: formatString), args: languageNameAttributed) | ||
|
||
return attributedString | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
godtools/App/Features/AppLanguage/Domain/Entities/ViewConfirmAppLanguageDomainModel.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,14 @@ | ||
// | ||
// ViewConfirmAppLanguageDomainModel.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 1/26/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct ViewConfirmAppLanguageDomainModel { | ||
|
||
let interfaceStrings: ConfirmAppLanguageInterfaceStringsDomainModel | ||
} |
15 changes: 15 additions & 0 deletions
15
...pLanguage/Domain/Interface/GetConfirmAppLanguageInterfaceStringsRepositoryInterface.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 @@ | ||
// | ||
// GetConfirmAppLanguageInterfaceStringsRepositoryInterface.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 1/27/24. | ||
// Copyright © 2024 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
protocol GetConfirmAppLanguageInterfaceStringsRepositoryInterface { | ||
|
||
func getStringsPublisher(translateInAppLanguage: AppLanguageDomainModel, selectedLanguage: AppLanguageDomainModel) -> AnyPublisher<ConfirmAppLanguageInterfaceStringsDomainModel, Never> | ||
} |
91 changes: 0 additions & 91 deletions
91
...p/Features/AppLanguage/Domain/UseCases/GetConfirmAppLanguageInterfaceStringsUseCase.swift
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
godtools/App/Features/AppLanguage/Domain/UseCases/ViewConfirmAppLanguageUseCase.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,30 @@ | ||
// | ||
// ViewConfirmAppLanguageUseCase.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 10/23/23. | ||
// Copyright © 2023 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class ViewConfirmAppLanguageUseCase { | ||
|
||
private let getConfirmAppLanguageInterfaceStringsRepository: GetConfirmAppLanguageInterfaceStringsRepositoryInterface | ||
|
||
init(getConfirmAppLanguageInterfaceStringsRepository: GetConfirmAppLanguageInterfaceStringsRepositoryInterface) { | ||
|
||
self.getConfirmAppLanguageInterfaceStringsRepository = getConfirmAppLanguageInterfaceStringsRepository | ||
} | ||
|
||
func viewPublisher(appLanguage: AppLanguageDomainModel, selectedLanguage: AppLanguageDomainModel) -> AnyPublisher<ViewConfirmAppLanguageDomainModel, Never> { | ||
|
||
return getConfirmAppLanguageInterfaceStringsRepository.getStringsPublisher(translateInAppLanguage: appLanguage, selectedLanguage: selectedLanguage) | ||
.map { interfaceStrings in | ||
|
||
return ViewConfirmAppLanguageDomainModel(interfaceStrings: 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
Oops, something went wrong.