diff --git a/Modules/feature-common/Sources/Config/BiometricUiConfig.swift b/Modules/feature-common/Sources/Config/BiometricUiConfig.swift index 45c3bff6..5046f8bc 100644 --- a/Modules/feature-common/Sources/Config/BiometricUiConfig.swift +++ b/Modules/feature-common/Sources/Config/BiometricUiConfig.swift @@ -20,20 +20,20 @@ import Foundation public extension UIConfig { struct Biometry: UIConfigType, Equatable { - public let navigationTitle: LocalizableString.Key + public let navigationTitle: LocalizableStringKey public let displayLogo: Bool - public let title: LocalizableString.Key - public let caption: LocalizableString.Key - public let quickPinOnlyCaption: LocalizableString.Key + public let title: LocalizableStringKey + public let caption: LocalizableStringKey + public let quickPinOnlyCaption: LocalizableStringKey public let navigationSuccessType: ThreeWayNavigationType public let navigationBackType: ThreeWayNavigationType? public let isPreAuthorization: Bool public let shouldInitializeBiometricOnCreate: Bool public var log: String { - return "navigationTitle: \(LocalizableString.shared.get(with: navigationTitle))" + + return "navigationTitle: \(navigationTitle.toString)" + "displayLogo: \(displayLogo)" + - "title: \(LocalizableString.shared.get(with: title))" + + "title: \(title.toString)" + " onSuccessNav: \(navigationSuccessType.key)" + " onBackNav: \(navigationBackType?.key ?? "none")" + " isPreAuthorization: \(isPreAuthorization)" + @@ -41,11 +41,11 @@ public extension UIConfig { } public init( - navigationTitle: LocalizableString.Key, + navigationTitle: LocalizableStringKey, displayLogo: Bool = true, - title: LocalizableString.Key, - caption: LocalizableString.Key, - quickPinOnlyCaption: LocalizableString.Key, + title: LocalizableStringKey, + caption: LocalizableStringKey, + quickPinOnlyCaption: LocalizableStringKey, navigationSuccessType: ThreeWayNavigationType, navigationBackType: ThreeWayNavigationType?, isPreAuthorization: Bool, diff --git a/Modules/feature-common/Sources/Config/ScannerUiConfig.swift b/Modules/feature-common/Sources/Config/ScannerUiConfig.swift index 43a306b7..92b9b1eb 100644 --- a/Modules/feature-common/Sources/Config/ScannerUiConfig.swift +++ b/Modules/feature-common/Sources/Config/ScannerUiConfig.swift @@ -36,7 +36,7 @@ public extension ScannerUiConfig { case presentation case issuing(IssuanceFlowUiConfig) - var title: LocalizableString.Key { + var title: LocalizableStringKey { return switch self { case .presentation: .scannerQrTitlePresentation @@ -45,7 +45,7 @@ public extension ScannerUiConfig { } } - var caption: LocalizableString.Key { + var caption: LocalizableStringKey { return switch self { case .presentation: .scannerQrCaptionPresentation @@ -54,7 +54,7 @@ public extension ScannerUiConfig { } } - var informativeText: LocalizableString.Key { + var informativeText: LocalizableStringKey { return .qrScanInformativeText } diff --git a/Modules/feature-common/Sources/Config/SuccessUiConfig.swift b/Modules/feature-common/Sources/Config/SuccessUiConfig.swift index 8d59fc46..d7d7aa53 100644 --- a/Modules/feature-common/Sources/Config/SuccessUiConfig.swift +++ b/Modules/feature-common/Sources/Config/SuccessUiConfig.swift @@ -24,21 +24,21 @@ public extension UIConfig { struct Success: UIConfigType, Equatable { public let title: Title - public let subtitle: LocalizableString.Key + public let subtitle: LocalizableStringKey public let buttons: [Success.Button] public let visualKind: VisualKind public var log: String { - return "title: \(LocalizableString.shared.get(with: title.value))" + + return "title: \(title.value.toString)" + "title color: \(title.color)" + - " caption: \(LocalizableString.shared.get(with: subtitle))" + - " buttons: \(buttons.map({ LocalizableString.shared.get(with: $0.title) as String }).joined(separator: ","))" + + " caption: \(subtitle.toString)" + + " buttons: \(buttons.map({ $0.title.toString }).joined(separator: ","))" + " actions: \(buttons.map(\.navigationType.type).joined(separator: ","))" } public init( title: Title, - subtitle: LocalizableString.Key, + subtitle: LocalizableStringKey, buttons: [Success.Button], visualKind: VisualKind ) { @@ -52,11 +52,11 @@ public extension UIConfig { public extension UIConfig.Success { struct Title: Equatable, Sendable { - public let value: LocalizableString.Key + public let value: LocalizableStringKey public let color: Color public init( - value: LocalizableString.Key, + value: LocalizableStringKey, color: Color = Theme.shared.color.success ) { self.value = value @@ -77,7 +77,7 @@ public extension UIConfig.Success { @EquatableNoop public var id: UUID - public let title: LocalizableString.Key + public let title: LocalizableStringKey public let style: Style public let navigationType: UIConfig.DeepLinkNavigationType @@ -87,7 +87,7 @@ public extension UIConfig.Success { } public init( - title: LocalizableString.Key, + title: LocalizableStringKey, style: Style, navigationType: UIConfig.DeepLinkNavigationType ) { diff --git a/Modules/feature-common/Sources/UI/Component/AddNewDocumentCellView.swift b/Modules/feature-common/Sources/UI/Component/AddNewDocumentCellView.swift index 8a312a54..3e2f458b 100644 --- a/Modules/feature-common/Sources/UI/Component/AddNewDocumentCellView.swift +++ b/Modules/feature-common/Sources/UI/Component/AddNewDocumentCellView.swift @@ -20,14 +20,14 @@ public struct AddNewDocumentCellView: View { let isEnabled: Bool let icon: Image? - let title: LocalizableString.Key + let title: LocalizableStringKey let action: () -> Void let isLoading: Bool public init( isEnabled: Bool, icon: Image? = nil, - title: LocalizableString.Key, + title: LocalizableStringKey, isLoading: Bool, action: @autoclosure @escaping () -> Void ) { @@ -83,7 +83,7 @@ public struct AddNewDocumentCellView: View { AddNewDocumentCellView( isEnabled: true, icon: Image(systemName: "person.text.rectangle"), - title: LocalizableString.Key.addDocumentTitle, + title: LocalizableStringKey.addDocumentTitle, isLoading: false, action: {}() ) diff --git a/Modules/feature-common/Sources/UI/Document/AddDocumentOptionsViewModel.swift b/Modules/feature-common/Sources/UI/Document/AddDocumentOptionsViewModel.swift index 75ee3b55..43788106 100644 --- a/Modules/feature-common/Sources/UI/Document/AddDocumentOptionsViewModel.swift +++ b/Modules/feature-common/Sources/UI/Document/AddDocumentOptionsViewModel.swift @@ -22,7 +22,7 @@ public struct AddDocumentOptionsViewState: ViewState { let isLoading: Bool let error: ContentErrorView.Config? let config: IssuanceFlowUiConfig - let title: LocalizableString.Key + let title: LocalizableStringKey } open class AddDocumentOptionsViewModel: ViewModel { diff --git a/Modules/feature-common/Sources/UI/Loading/BaseLoadingViewModel.swift b/Modules/feature-common/Sources/UI/Loading/BaseLoadingViewModel.swift index 342d09ab..c154accf 100644 --- a/Modules/feature-common/Sources/UI/Loading/BaseLoadingViewModel.swift +++ b/Modules/feature-common/Sources/UI/Loading/BaseLoadingViewModel.swift @@ -52,11 +52,11 @@ open class BaseLoadingViewModel: ViewModel LocalizableString.Key { + open func getTitle() -> LocalizableStringKey { return .custom("") } - open func getCaption() -> LocalizableString.Key { + open func getCaption() -> LocalizableStringKey { return .custom("") } diff --git a/Modules/feature-common/Sources/UI/QuickPin/QuickPinView.swift b/Modules/feature-common/Sources/UI/QuickPin/QuickPinView.swift index 9e65715e..70ed473d 100644 --- a/Modules/feature-common/Sources/UI/QuickPin/QuickPinView.swift +++ b/Modules/feature-common/Sources/UI/QuickPin/QuickPinView.swift @@ -92,7 +92,7 @@ private func content( private func pinView( uiPinInputField: Binding, quickPinSize: Int, - pinError: LocalizableString.Key? + pinError: LocalizableStringKey? ) -> some View { VStack(spacing: .zero) { diff --git a/Modules/feature-common/Sources/UI/QuickPin/QuickPinViewModel.swift b/Modules/feature-common/Sources/UI/QuickPin/QuickPinViewModel.swift index 48c95c3f..bc46ff9d 100644 --- a/Modules/feature-common/Sources/UI/QuickPin/QuickPinViewModel.swift +++ b/Modules/feature-common/Sources/UI/QuickPin/QuickPinViewModel.swift @@ -26,15 +26,15 @@ enum QuickPinStep { @Copyable struct QuickPinState: ViewState { let config: QuickPinUiConfig - let navigationTitle: LocalizableString.Key - let title: LocalizableString.Key - let caption: LocalizableString.Key - let button: LocalizableString.Key - let success: LocalizableString.Key - let successButton: LocalizableString.Key + let navigationTitle: LocalizableStringKey + let title: LocalizableStringKey + let caption: LocalizableStringKey + let button: LocalizableStringKey + let success: LocalizableStringKey + let successButton: LocalizableStringKey let successNavigationType: UIConfig.DeepLinkNavigationType let isCancellable: Bool - let pinError: LocalizableString.Key? + let pinError: LocalizableStringKey? let isButtonActive: Bool let step: QuickPinStep let quickPinSize: Int @@ -161,7 +161,7 @@ final class QuickPinViewModel: ViewModel: ViewModel LocalizableString.Key { + open func getTitle() -> LocalizableStringKey { return .custom("") } - open func getRelyingParty() -> LocalizableString.Key { + open func getRelyingParty() -> LocalizableStringKey { return .custom("") } @@ -77,11 +77,11 @@ open class BaseRequestViewModel: ViewModel LocalizableString.Key { + open func getCaption() -> LocalizableStringKey { return .custom("") } - open func getDataRequestInfo() -> LocalizableString.Key { + open func getDataRequestInfo() -> LocalizableStringKey { return .custom("") } @@ -89,15 +89,15 @@ open class BaseRequestViewModel: ViewModel String { - return "" + open func getTitleCaption() -> LocalizableStringKey { + return .custom("") } - open func getTrustedRelyingParty() -> LocalizableString.Key { + open func getTrustedRelyingParty() -> LocalizableStringKey { return .custom("") } - open func getTrustedRelyingPartyInfo() -> LocalizableString.Key { + open func getTrustedRelyingPartyInfo() -> LocalizableStringKey { return .custom("") } @@ -145,8 +145,8 @@ open class BaseRequestViewModel: ViewModel some View { + ZStack { + VStack { + HStack(spacing: SPACING_MEDIUM) { - Theme.shared.image.errorIndicator - .renderingMode(.template) - .foregroundStyle(Theme.shared.color.white) + Theme.shared.image.errorIndicator + .renderingMode(.template) + .foregroundStyle(Theme.shared.color.onSurface) - Text(viewState.informativeTest) - .typography(Theme.shared.font.bodyLarge) - .foregroundStyle(Theme.shared.color.white) - .multilineTextAlignment(.center) + Text(viewState.informativeTest) + .typography(Theme.shared.font.bodyLarge) + .foregroundStyle(Theme.shared.color.onSurface) + .multilineTextAlignment(.center) - } } - .padding(.horizontal) - .padding(.bottom, SPACING_LARGE) - .frame(maxWidth: .infinity) } - .animation(.easeInOut, value: viewState.showInformativeText) + .padding() + .background(Theme.shared.color.surfaceContainer) + .clipShape(Theme.shared.shape.highCornerRadiusShape) + .opacity(viewState.showInformativeText ? 1.0 : 0.0) } - .ignoresSafeArea(.all, edges: .bottom) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom) + .padding(.bottom, SPACING_LARGE) } #Preview { diff --git a/Modules/feature-common/Sources/UI/Scanner/ScannerViewModel.swift b/Modules/feature-common/Sources/UI/Scanner/ScannerViewModel.swift index 30e9f3a1..9ae00d3c 100644 --- a/Modules/feature-common/Sources/UI/Scanner/ScannerViewModel.swift +++ b/Modules/feature-common/Sources/UI/Scanner/ScannerViewModel.swift @@ -22,17 +22,17 @@ import logic_business struct ScannerState: ViewState { let config: ScannerUiConfig - let error: LocalizableString.Key? + let error: LocalizableStringKey? let showInformativeText: Bool - let informativeTest: LocalizableString.Key + let informativeTest: LocalizableStringKey let allowScanning: Bool let failedScanAttempts: Int - var title: LocalizableString.Key { + var title: LocalizableStringKey { return config.flow.title } - var caption: LocalizableString.Key { + var caption: LocalizableStringKey { return config.flow.caption } } diff --git a/Modules/feature-common/Sources/UI/Success/Base/BaseSuccessViewModel.swift b/Modules/feature-common/Sources/UI/Success/Base/BaseSuccessViewModel.swift index 3b210c50..5058e683 100644 --- a/Modules/feature-common/Sources/UI/Success/Base/BaseSuccessViewModel.swift +++ b/Modules/feature-common/Sources/UI/Success/Base/BaseSuccessViewModel.swift @@ -22,7 +22,7 @@ public struct BaseSuccessState: ViewState { let config: DocumentSuccessUIConfig let relyingParty: RelyingPartyData let items: [ListItemSection] - let navigationTitle: String + let navigationTitle: LocalizableStringKey let isLoading: Bool } @@ -70,7 +70,9 @@ open class BaseSuccessViewModel: ViewModel(predicate: { attribute in @@ -149,7 +149,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.ORDER_BY_DESCENDING, - name: LocalizableString.shared.get(with: .descending), + name: LocalizableStringKey.descending.toString, selected: false, filterableAction: Sort(predicate: { attribute in attribute.sortingKey @@ -160,11 +160,11 @@ final class DashboardInteractorImpl: DashboardInteractor { ), SingleSelectionFilterGroup( id: FilterIds.FILTER_SORT_GROUP_ID, - name: LocalizableString.shared.get(with: .sortBy), + name: LocalizableStringKey.sortBy.toString, filters: [ FilterItem( id: FilterIds.FILTER_SORT_DEFAULT, - name: LocalizableString.shared.get(with: .defaultLabel), + name: LocalizableStringKey.defaultLabel.toString, selected: true, isDefault: true, filterableAction: Sort(predicate: { attribute in @@ -173,7 +173,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.FILTER_SORT_DATE_ISSUED, - name: LocalizableString.shared.get(with: .dateIssued), + name: LocalizableStringKey.dateIssued.toString, selected: false, filterableAction: Sort(predicate: { attribute in attribute.issuedDate @@ -181,7 +181,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.FILTER_SORT_EXPIRY_DATE, - name: LocalizableString.shared.get(with: .expiryDate), + name: LocalizableStringKey.expiryDate.toString, selected: false, filterableAction: Sort(predicate: { attribute in attribute.expiryDate @@ -192,11 +192,11 @@ final class DashboardInteractorImpl: DashboardInteractor { ), SingleSelectionFilterGroup( id: FilterIds.FILTER_BY_PERIOD_GROUP_ID, - name: LocalizableString.shared.get(with: .selectExpiryPeriod), + name: LocalizableStringKey.selectExpiryPeriod.toString, filters: [ FilterItem( id: FilterIds.FILTER_BY_PERIOD_DEFAULT, - name: LocalizableString.shared.get(with: .defaultLabel), + name: LocalizableStringKey.defaultLabel.toString, selected: true, isDefault: true, filterableAction: Filter(predicate: { _, _ in @@ -205,7 +205,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.FILTER_BY_PERIOD_NEXT_7, - name: LocalizableString.shared.get(with: .nextSevenDays), + name: LocalizableStringKey.nextSevenDays.toString, selected: false, filterableAction: Filter(predicate: { attributes, _ in guard let date = attributes.expiryDate else { return false } @@ -214,7 +214,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.FILTER_BY_PERIOD_NEXT_30, - name: LocalizableString.shared.get(with: .nextThirtyDays), + name: LocalizableStringKey.nextThirtyDays.toString, selected: false, filterableAction: Filter(predicate: { attributes, _ in guard let date = attributes.expiryDate else { return false } @@ -223,7 +223,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.FILTER_BY_PERIOD_BEYOND_30, - name: LocalizableString.shared.get(with: .beyondThiryDays), + name: LocalizableStringKey.beyondThiryDays.toString, selected: false, filterableAction: Filter(predicate: { attributes, _ in guard let date = attributes.expiryDate else { return false } @@ -232,7 +232,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), FilterItem( id: FilterIds.FILTER_BY_PERIOD_EXPIRED, - name: LocalizableString.shared.get(with: .beforeToday), + name: LocalizableStringKey.beforeToday.toString, selected: false, filterableAction: Filter(predicate: { attributes, _ in guard let date = attributes.expiryDate else { return false } @@ -244,7 +244,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), MultipleSelectionFilterGroup( id: FilterIds.FILTER_BY_ISSUER_GROUP_ID, - name: LocalizableString.shared.get(with: .filterByIssuer), + name: LocalizableStringKey.filterByIssuer.toString, filters: [], filterableAction: Filter(predicate: { attribute, filter in attribute.name == filter.name @@ -253,7 +253,7 @@ final class DashboardInteractorImpl: DashboardInteractor { ), MultipleSelectionFilterGroup( id: FilterIds.FILTER_BY_DOCUMENT_CATEGORY_GROUP_ID, - name: LocalizableString.shared.get(with: .filterByCategory), + name: LocalizableStringKey.filterByCategory.toString, filters: [], filterableAction: FilterMultipleAction(predicate: { attribute, filter in attribute.category == filter.name @@ -262,17 +262,17 @@ final class DashboardInteractorImpl: DashboardInteractor { ), MultipleSelectionFilterGroup( id: FilterIds.FILTER_BY_STATE_GROUP_ID, - name: LocalizableString.shared.get(with: .filterByState), + name: LocalizableStringKey.filterByState.toString, filters: [ FilterItem( id: FilterIds.FILTER_BY_STATE_VALID, - name: LocalizableString.shared.get(with: .valid), + name: LocalizableStringKey.valid.toString, selected: true, isDefault: true ), FilterItem( id: FilterIds.FILTER_BY_STATE_EXPIRED, - name: LocalizableString.shared.get(with: .expired), + name: LocalizableStringKey.expired.toString, selected: false, isDefault: false ) diff --git a/Modules/feature-dashboard/Sources/UI/Dashboard/Component/FiltersListView.swift b/Modules/feature-dashboard/Sources/UI/Dashboard/Component/FiltersListView.swift index b7e743b9..234ae67e 100644 --- a/Modules/feature-dashboard/Sources/UI/Dashboard/Component/FiltersListView.swift +++ b/Modules/feature-dashboard/Sources/UI/Dashboard/Component/FiltersListView.swift @@ -58,7 +58,7 @@ struct FiltersListView: View { } .listStyle(.grouped) .scrollIndicators(.hidden) - .navigationTitle(LocalizableString.shared.get(with: .filters)) + .navigationTitle(.filters) .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .navigationBarLeading) { diff --git a/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardView.swift b/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardView.swift index 71330ed0..1f6ad967 100644 --- a/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardView.swift +++ b/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardView.swift @@ -224,7 +224,7 @@ private func content( }) .tabItem { Label( - LocalizableString.shared.get(with: .home), + LocalizableStringKey.home.toString, systemImage: "house.fill" ) } @@ -249,15 +249,16 @@ private func content( } .tabItem { Label( - LocalizableString.shared.get(with: .documents), - systemImage: "doc.fill") + .documents, + systemImage: "doc.fill" + ) } .tag(SelectedTab.documents) TransactionTabView() .tabItem { Label( - LocalizableString.shared.get(with: .transactions), + .transactions, systemImage: "arrow.left.arrow.right" ) } diff --git a/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardViewModel.swift b/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardViewModel.swift index d29f89cc..44752153 100644 --- a/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardViewModel.swift +++ b/Modules/feature-dashboard/Sources/UI/Dashboard/DashboardViewModel.swift @@ -333,7 +333,7 @@ final class DashboardViewModel: ViewModel LocalizableString.Key { + func getNavigationTitle() -> LocalizableStringKey { switch selectedTab { case .documents: return .documents diff --git a/Modules/feature-dashboard/Sources/UI/Dashboard/Model/DocumentUIModel.swift b/Modules/feature-dashboard/Sources/UI/Dashboard/Model/DocumentUIModel.swift index a3289c94..d6ccd82e 100644 --- a/Modules/feature-dashboard/Sources/UI/Dashboard/Model/DocumentUIModel.swift +++ b/Modules/feature-dashboard/Sources/UI/Dashboard/Model/DocumentUIModel.swift @@ -36,7 +36,7 @@ public struct DocumentUIModel: Identifiable, Equatable, FilterableItemPayload { .init( mainText: .custom(value.title), overlineText: .custom(value.heading), - supportingText: .custom(supportingText()), + supportingText: supportingText(), supportingTextColor: supportingColor(), leadingIcon: .init( imageUrl: value.image?.url, @@ -47,17 +47,17 @@ public struct DocumentUIModel: Identifiable, Equatable, FilterableItemPayload { } } private extension DocumentUIModel { - func supportingText() -> String { + func supportingText() -> LocalizableStringKey { if value.hasExpired { - return LocalizableString.shared.get(with: .expired) + return .expired } else { switch value.state { case .issued: - return expiry.orEmpty + return .custom(expiry.orEmpty) case .pending: - return LocalizableString.shared.get(with: .pending) + return .pending case .failed: - return LocalizableString.shared.get(with: .issuanceFailed) + return .issuanceFailed } } } @@ -92,7 +92,7 @@ private extension DocumentUIModel { guard let expiresAt = value.expiresAt else { return nil } - return LocalizableString.shared.get(with: .validUntil([expiresAt])).replacingOccurrences(of: "\n", with: "") + return LocalizableStringKey.validUntil([expiresAt]).toString.replacingOccurrences(of: "\n", with: "") } } diff --git a/Modules/feature-dashboard/Sources/UI/Dashboard/Model/Filter/FilterUIModel.swift b/Modules/feature-dashboard/Sources/UI/Dashboard/Model/Filter/FilterUIModel.swift index e722c9f2..2268fbf3 100644 --- a/Modules/feature-dashboard/Sources/UI/Dashboard/Model/Filter/FilterUIModel.swift +++ b/Modules/feature-dashboard/Sources/UI/Dashboard/Model/Filter/FilterUIModel.swift @@ -38,7 +38,7 @@ public extension FilterUISection { case expiryPeriod case state - var sectionTitle: LocalizableString.Key { + var sectionTitle: LocalizableStringKey { switch self { case .issuedSortingDate: return .sortByIssuedDateSectionTitle @@ -57,8 +57,8 @@ public extension FilterUISection { switch self { case .issuedSortingDate: return [ - LocalizableString.shared.get(with: .ascending), - LocalizableString.shared.get(with: .descending) + LocalizableStringKey.ascending.toString, + LocalizableStringKey.descending.toString ] case .sortBy: return [] @@ -77,23 +77,23 @@ public extension FilterUISection { return [] case .sortBy: return [ - LocalizableString.shared.get(with: .defaultLabel), - LocalizableString.shared.get(with: .dateIssued), - LocalizableString.shared.get(with: .expiryDate) + LocalizableStringKey.defaultLabel.toString, + LocalizableStringKey.dateIssued.toString, + LocalizableStringKey.expiryDate.toString ] case .issuer(let options): return options case .expiryPeriod: return [ - LocalizableString.shared.get(with: .nextSevenDays), - LocalizableString.shared.get(with: .nextThirtyDays), - LocalizableString.shared.get(with: .beyondThiryDays), - LocalizableString.shared.get(with: .beforeToday) + LocalizableStringKey.nextSevenDays.toString, + LocalizableStringKey.nextThirtyDays.toString, + LocalizableStringKey.beyondThiryDays.toString, + LocalizableStringKey.beforeToday.toString ] case .state: return [ - LocalizableString.shared.get(with: .valid), - LocalizableString.shared.get(with: .expired) + LocalizableStringKey.valid.toString, + LocalizableStringKey.expired.toString ] } } diff --git a/Modules/feature-dashboard/Sources/UI/Dashboard/Tab/HomeTabView.swift b/Modules/feature-dashboard/Sources/UI/Dashboard/Tab/HomeTabView.swift index ef624262..cddcd562 100644 --- a/Modules/feature-dashboard/Sources/UI/Dashboard/Tab/HomeTabView.swift +++ b/Modules/feature-dashboard/Sources/UI/Dashboard/Tab/HomeTabView.swift @@ -53,10 +53,10 @@ public struct HomeTabView: View { .foregroundStyle(Theme.shared.color.onSurface) HomeCardView( - text: LocalizableString.Key.authenticateAuthoriseTransactions, - buttonText: LocalizableString.Key.authenticate, + text: LocalizableStringKey.authenticateAuthoriseTransactions, + buttonText: LocalizableStringKey.authenticate, illustration: Theme.shared.image.homeIdentity, - learnMoreText: LocalizableString.Key.learnMore, + learnMoreText: LocalizableStringKey.learnMore, learnMoreAction: { addDocumentAlert = true }, @@ -75,10 +75,10 @@ public struct HomeTabView: View { ) HomeCardView( - text: LocalizableString.Key.electronicallySignDigitalDocuments, - buttonText: LocalizableString.Key.signDocument, + text: LocalizableStringKey.electronicallySignDigitalDocuments, + buttonText: LocalizableStringKey.signDocument, illustration: Theme.shared.image.homeContract, - learnMoreText: LocalizableString.Key.learnMore, + learnMoreText: LocalizableStringKey.learnMore, learnMoreAction: { signDocumentAlert = true }, diff --git a/Modules/feature-dashboard/Sources/UI/SideMenu/Model/SideMenuItemUIModel.swift b/Modules/feature-dashboard/Sources/UI/SideMenu/Model/SideMenuItemUIModel.swift index 3ad210c3..4efc6211 100644 --- a/Modules/feature-dashboard/Sources/UI/SideMenu/Model/SideMenuItemUIModel.swift +++ b/Modules/feature-dashboard/Sources/UI/SideMenu/Model/SideMenuItemUIModel.swift @@ -20,14 +20,14 @@ import logic_resources public struct SideMenuItemUIModel: Identifiable { public let id: String - public let title: LocalizableString.Key + public let title: LocalizableStringKey public let showDivider: Bool public let isShareLink: Bool public let action: (() -> Void) public init( id: String = UUID().uuidString, - title: LocalizableString.Key, + title: LocalizableStringKey, showDivider: Bool = true, isShareLink: Bool = false, action: @escaping (() -> Void) diff --git a/Modules/feature-issuance/Sources/Interactor/AddDocumentInteractor.swift b/Modules/feature-issuance/Sources/Interactor/AddDocumentInteractor.swift index 6d99ca46..e69ac805 100644 --- a/Modules/feature-issuance/Sources/Interactor/AddDocumentInteractor.swift +++ b/Modules/feature-issuance/Sources/Interactor/AddDocumentInteractor.swift @@ -27,7 +27,7 @@ public protocol AddDocumentInteractor: Sendable { func getScopedDocument(configId: String) async throws -> ScopedDocument func getHoldersName(for documentIdentifier: String) -> String? - func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableString.Key? + func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableStringKey? func fetchStoredDocuments(documentIds: [String]) async -> DocumentsPartialState } @@ -63,7 +63,7 @@ final class AddDocumentInteractorImpl: AddDocumentInteractor { } func compare(_ first: AddDocumentUIModel, _ second: AddDocumentUIModel) -> Bool { - return LocalizableString.shared.get(with: first.listItem.mainText).lowercased() < LocalizableString.shared.get(with: second.listItem.mainText).lowercased() + return first.listItem.mainText.toString.lowercased() < second.listItem.mainText.toString.lowercased() } } @@ -129,7 +129,7 @@ final class AddDocumentInteractorImpl: AddDocumentInteractor { return "\(bearerName.first) \(bearerName.last)" } - public func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableString.Key? { + public func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableStringKey? { guard let document = walletController.fetchDocument(with: documentIdentifier) else { diff --git a/Modules/feature-issuance/Sources/Interactor/DocumentOfferInteractor.swift b/Modules/feature-issuance/Sources/Interactor/DocumentOfferInteractor.swift index d6743a5b..13bc8436 100644 --- a/Modules/feature-issuance/Sources/Interactor/DocumentOfferInteractor.swift +++ b/Modules/feature-issuance/Sources/Interactor/DocumentOfferInteractor.swift @@ -35,7 +35,7 @@ public protocol DocumentOfferInteractor: Sendable { ) async -> OfferDynamicIssuancePartialState func getHoldersName(for documentIdentifier: String) -> String? - func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableString.Key? + func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableStringKey? func fetchStoredDocuments(documentIds: [String]) async -> DocumentsPartialState } @@ -211,7 +211,7 @@ final class DocumentOfferInteractorImpl: DocumentOfferInteractor { return "\(bearerName.first) \(bearerName.last)" } - public func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableString.Key? { + public func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableStringKey? { guard let document = walletController.fetchDocument(with: documentIdentifier) else { @@ -265,10 +265,10 @@ final class DocumentOfferInteractorImpl: DocumentOfferInteractor { } private func retrieveDeferredRoute( - caption: LocalizableString.Key, + caption: LocalizableStringKey, successNavigation: UIConfig.TwoWayNavigationType, title: UIConfig.Success.Title, - buttonTitle: LocalizableString.Key, + buttonTitle: LocalizableStringKey, visualKind: UIConfig.Success.VisualKind ) -> AppRoute { var navigationType: UIConfig.DeepLinkNavigationType { diff --git a/Modules/feature-issuance/Sources/Interactor/DocumentSuccessInteractor.swift b/Modules/feature-issuance/Sources/Interactor/DocumentSuccessInteractor.swift index 4a5e2804..ec8619de 100644 --- a/Modules/feature-issuance/Sources/Interactor/DocumentSuccessInteractor.swift +++ b/Modules/feature-issuance/Sources/Interactor/DocumentSuccessInteractor.swift @@ -19,7 +19,7 @@ import logic_resources public protocol DocumentSuccessInteractor: Sendable { func getHoldersName(for documentIdentifier: String) -> String? - func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableString.Key? + func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableStringKey? func fetchStoredDocuments(documentIds: [String]) async -> DocumentsPartialState } @@ -40,7 +40,7 @@ final class DocumentSuccessInteractorImpl: DocumentSuccessInteractor { return "\(bearerName.first) \(bearerName.last)" } - public func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableString.Key? { + public func getDocumentSuccessCaption(for documentIdentifier: String) -> LocalizableStringKey? { guard let document = walletController.fetchDocument(with: documentIdentifier) else { diff --git a/Modules/feature-issuance/Sources/UI/Document/Add/AddDocumentViewModel.swift b/Modules/feature-issuance/Sources/UI/Document/Add/AddDocumentViewModel.swift index 0b07e3fd..92de1d78 100644 --- a/Modules/feature-issuance/Sources/UI/Document/Add/AddDocumentViewModel.swift +++ b/Modules/feature-issuance/Sources/UI/Document/Add/AddDocumentViewModel.swift @@ -224,7 +224,7 @@ final class AddDocumentViewModel: ViewModel: ViewModel LocalizableString.Key { + func alertTitle() -> LocalizableStringKey { if viewState.isBookmarked { return .savedToFavorites } else { @@ -182,7 +182,7 @@ final class DocumentDetailsViewModel: ViewModel LocalizableString.Key { + func alertMessage() -> LocalizableStringKey { if viewState.isBookmarked { return .savedToFavoritesMessage } else { diff --git a/Modules/feature-issuance/Sources/UI/Document/Details/Model/DocumentDetailsUIModel.swift b/Modules/feature-issuance/Sources/UI/Document/Details/Model/DocumentDetailsUIModel.swift index 1d43b72f..3bf90790 100644 --- a/Modules/feature-issuance/Sources/UI/Document/Details/Model/DocumentDetailsUIModel.swift +++ b/Modules/feature-issuance/Sources/UI/Document/Details/Model/DocumentDetailsUIModel.swift @@ -131,8 +131,7 @@ extension DocClaimsDecodable { .parseUserPseudonym() ) .sorted(by: { - LocalizableString.shared.get(with: $0.mainText) - .localizedCompare(LocalizableString.shared.get(with: $1.mainText)) == .orderedAscending + $0.mainText.toString.localizedCompare($1.mainText.toString) == .orderedAscending }) var bearerName: String { diff --git a/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferView.swift b/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferView.swift index 7d29ecd1..f2ad340d 100644 --- a/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferView.swift +++ b/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferView.swift @@ -143,7 +143,7 @@ private func noDocumentsFound(imageSize: CGFloat) -> some View { let viewState = DocumentOfferViewState( isLoading: false, documentOfferUiModel: .init( - issuerName: LocalizableString.shared.get(with: .unknownIssuer), + issuerName: LocalizableStringKey.unknownIssuer.toString, txCode: nil, uiOffers: [], docOffers: [] diff --git a/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferViewModel.swift b/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferViewModel.swift index c181876a..d4c7d688 100644 --- a/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferViewModel.swift +++ b/Modules/feature-issuance/Sources/UI/Document/Offer/DocumentOfferViewModel.swift @@ -31,7 +31,7 @@ struct DocumentOfferViewState: ViewState { let initialized: Bool let contentHeaderConfig: ContentHeaderConfig - var title: LocalizableString.Key { + var title: LocalizableStringKey { return .requestCredentialOfferTitle([documentOfferUiModel.issuerName]) } diff --git a/Modules/feature-issuance/Sources/UI/Document/Offer/Model/DocumentOfferUIModel.swift b/Modules/feature-issuance/Sources/UI/Document/Offer/Model/DocumentOfferUIModel.swift index 6f37ffa3..164746de 100644 --- a/Modules/feature-issuance/Sources/UI/Document/Offer/Model/DocumentOfferUIModel.swift +++ b/Modules/feature-issuance/Sources/UI/Document/Offer/Model/DocumentOfferUIModel.swift @@ -75,7 +75,7 @@ public extension DocumentOfferUIModel { public extension DocumentOfferUIModel { static func mock() -> DocumentOfferUIModel { return .init( - issuerName: LocalizableString.shared.get(with: .unknownIssuer), + issuerName: LocalizableStringKey.unknownIssuer.toString, txCode: nil, uiOffers: [ .init( diff --git a/Modules/feature-issuance/Tests/Mock/GeneratedMocks.swift b/Modules/feature-issuance/Tests/Mock/GeneratedMocks.swift index c64c63c1..9155d98f 100644 --- a/Modules/feature-issuance/Tests/Mock/GeneratedMocks.swift +++ b/Modules/feature-issuance/Tests/Mock/GeneratedMocks.swift @@ -1224,9 +1224,9 @@ public class MockAddDocumentInteractor: AddDocumentInteractor, Cuckoo.ProtocolMo ) } - public func getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key? { + public func getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey? { return cuckoo_manager.call( - "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", parameters: (p0), escapingParameters: (p0), superclassCall: Cuckoo.MockManager.crashOnProtocolSuperclassCall(), @@ -1291,10 +1291,10 @@ public class MockAddDocumentInteractor: AddDocumentInteractor, Cuckoo.ProtocolMo )) } - func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.ProtocolStubFunction<(String), LocalizableString.Key?> where M1.MatchedType == String { + func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.ProtocolStubFunction<(String), LocalizableStringKey?> where M1.MatchedType == String { let matchers: [Cuckoo.ParameterMatcher<(String)>] = [wrap(matchable: p0) { $0 }] return .init(stub: cuckoo_manager.createStub(for: MockAddDocumentInteractor.self, - method: "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + method: "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", parameterMatchers: matchers )) } @@ -1381,10 +1381,10 @@ public class MockAddDocumentInteractor: AddDocumentInteractor, Cuckoo.ProtocolMo @discardableResult - func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.__DoNotUse<(String), LocalizableString.Key?> where M1.MatchedType == String { + func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.__DoNotUse<(String), LocalizableStringKey?> where M1.MatchedType == String { let matchers: [Cuckoo.ParameterMatcher<(String)>] = [wrap(matchable: p0) { $0 }] return cuckoo_manager.verify( - "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", callMatcher: callMatcher, parameterMatchers: matchers, sourceLocation: sourceLocation @@ -1429,8 +1429,8 @@ public class AddDocumentInteractorStub:AddDocumentInteractor, @unchecked Sendabl return DefaultValueRegistry.defaultValue(for: (String?).self) } - public func getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key? { - return DefaultValueRegistry.defaultValue(for: (LocalizableString.Key?).self) + public func getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey? { + return DefaultValueRegistry.defaultValue(for: (LocalizableStringKey?).self) } public func fetchStoredDocuments(documentIds p0: [String]) async -> DocumentsPartialState { @@ -1744,9 +1744,9 @@ public class MockDocumentOfferInteractor: DocumentOfferInteractor, Cuckoo.Protoc ) } - public func getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key? { + public func getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey? { return cuckoo_manager.call( - "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", parameters: (p0), escapingParameters: (p0), superclassCall: Cuckoo.MockManager.crashOnProtocolSuperclassCall(), @@ -1803,10 +1803,10 @@ public class MockDocumentOfferInteractor: DocumentOfferInteractor, Cuckoo.Protoc )) } - func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.ProtocolStubFunction<(String), LocalizableString.Key?> where M1.MatchedType == String { + func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.ProtocolStubFunction<(String), LocalizableStringKey?> where M1.MatchedType == String { let matchers: [Cuckoo.ParameterMatcher<(String)>] = [wrap(matchable: p0) { $0 }] return .init(stub: cuckoo_manager.createStub(for: MockDocumentOfferInteractor.self, - method: "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + method: "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", parameterMatchers: matchers )) } @@ -1881,10 +1881,10 @@ public class MockDocumentOfferInteractor: DocumentOfferInteractor, Cuckoo.Protoc @discardableResult - func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.__DoNotUse<(String), LocalizableString.Key?> where M1.MatchedType == String { + func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.__DoNotUse<(String), LocalizableStringKey?> where M1.MatchedType == String { let matchers: [Cuckoo.ParameterMatcher<(String)>] = [wrap(matchable: p0) { $0 }] return cuckoo_manager.verify( - "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", callMatcher: callMatcher, parameterMatchers: matchers, sourceLocation: sourceLocation @@ -1925,8 +1925,8 @@ public class DocumentOfferInteractorStub:DocumentOfferInteractor, @unchecked Sen return DefaultValueRegistry.defaultValue(for: (String?).self) } - public func getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key? { - return DefaultValueRegistry.defaultValue(for: (LocalizableString.Key?).self) + public func getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey? { + return DefaultValueRegistry.defaultValue(for: (LocalizableStringKey?).self) } public func fetchStoredDocuments(documentIds p0: [String]) async -> DocumentsPartialState { @@ -1978,9 +1978,9 @@ public class MockDocumentSuccessInteractor: DocumentSuccessInteractor, Cuckoo.Pr ) } - public func getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key? { + public func getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey? { return cuckoo_manager.call( - "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", parameters: (p0), escapingParameters: (p0), superclassCall: Cuckoo.MockManager.crashOnProtocolSuperclassCall(), @@ -2013,10 +2013,10 @@ public class MockDocumentSuccessInteractor: DocumentSuccessInteractor, Cuckoo.Pr )) } - func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.ProtocolStubFunction<(String), LocalizableString.Key?> where M1.MatchedType == String { + func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.ProtocolStubFunction<(String), LocalizableStringKey?> where M1.MatchedType == String { let matchers: [Cuckoo.ParameterMatcher<(String)>] = [wrap(matchable: p0) { $0 }] return .init(stub: cuckoo_manager.createStub(for: MockDocumentSuccessInteractor.self, - method: "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + method: "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", parameterMatchers: matchers )) } @@ -2055,10 +2055,10 @@ public class MockDocumentSuccessInteractor: DocumentSuccessInteractor, Cuckoo.Pr @discardableResult - func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.__DoNotUse<(String), LocalizableString.Key?> where M1.MatchedType == String { + func getDocumentSuccessCaption(for p0: M1) -> Cuckoo.__DoNotUse<(String), LocalizableStringKey?> where M1.MatchedType == String { let matchers: [Cuckoo.ParameterMatcher<(String)>] = [wrap(matchable: p0) { $0 }] return cuckoo_manager.verify( - "getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key?", + "getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey?", callMatcher: callMatcher, parameterMatchers: matchers, sourceLocation: sourceLocation @@ -2087,8 +2087,8 @@ public class DocumentSuccessInteractorStub:DocumentSuccessInteractor, @unchecked return DefaultValueRegistry.defaultValue(for: (String?).self) } - public func getDocumentSuccessCaption(for p0: String) -> LocalizableString.Key? { - return DefaultValueRegistry.defaultValue(for: (LocalizableString.Key?).self) + public func getDocumentSuccessCaption(for p0: String) -> LocalizableStringKey? { + return DefaultValueRegistry.defaultValue(for: (LocalizableStringKey?).self) } public func fetchStoredDocuments(documentIds p0: [String]) async -> DocumentsPartialState { diff --git a/Modules/feature-presentation/Sources/UI/Presentation/Loading/PresentationLoadingViewModel.swift b/Modules/feature-presentation/Sources/UI/Presentation/Loading/PresentationLoadingViewModel.swift index 58cd3f11..900aac4a 100644 --- a/Modules/feature-presentation/Sources/UI/Presentation/Loading/PresentationLoadingViewModel.swift +++ b/Modules/feature-presentation/Sources/UI/Presentation/Loading/PresentationLoadingViewModel.swift @@ -69,11 +69,11 @@ final class PresentationLoadingViewModel: BaseLoadingViewMod } } - override func getTitle() -> LocalizableString.Key { + override func getTitle() -> LocalizableStringKey { .requestDataTitle([relyingParty]) } - override func getCaption() -> LocalizableString.Key { + override func getCaption() -> LocalizableStringKey { .requestsTheFollowing } diff --git a/Modules/feature-presentation/Sources/UI/Presentation/Request/PresentationRequestViewModel.swift b/Modules/feature-presentation/Sources/UI/Presentation/Request/PresentationRequestViewModel.swift index 012c7f7d..844980bb 100644 --- a/Modules/feature-presentation/Sources/UI/Presentation/Request/PresentationRequestViewModel.swift +++ b/Modules/feature-presentation/Sources/UI/Presentation/Request/PresentationRequestViewModel.swift @@ -106,7 +106,7 @@ final class PresentationRequestViewModel: BaseRequestViewMod navigationSuccessType: .push( .featurePresentationModule( .presentationLoader( - relyingParty: LocalizableString.shared.get(with: getRelyingParty()), + relyingParty: getRelyingParty().toString, relyingPartyisTrusted: getRelyingPartyIsTrusted(), presentationCoordinator: remoteSessionCoordinator, originator: getOriginator(), @@ -128,19 +128,19 @@ final class PresentationRequestViewModel: BaseRequestViewMod return getOriginator() } - override func getTitle() -> LocalizableString.Key { + override func getTitle() -> LocalizableStringKey { .dataSharingRequest } - override func getCaption() -> LocalizableString.Key { + override func getCaption() -> LocalizableStringKey { .requestsTheFollowing } - override func getDataRequestInfo() -> LocalizableString.Key { + override func getDataRequestInfo() -> LocalizableStringKey { .requestDataInfoNotice } - override func getRelyingParty() -> LocalizableString.Key { + override func getRelyingParty() -> LocalizableStringKey { viewState.relyingParty } @@ -148,15 +148,15 @@ final class PresentationRequestViewModel: BaseRequestViewMod viewState.isTrusted } - override func getTitleCaption() -> String { - LocalizableString.shared.get(with: .requestDataTitle([""])) + override func getTitleCaption() -> LocalizableStringKey { + .requestDataTitle([""]) } - override func getTrustedRelyingParty() -> LocalizableString.Key { + override func getTrustedRelyingParty() -> LocalizableStringKey { .requestDataVerifiedEntity } - override func getTrustedRelyingPartyInfo() -> LocalizableString.Key { + override func getTrustedRelyingPartyInfo() -> LocalizableStringKey { .requestDataVerifiedEntityMessage } diff --git a/Modules/feature-proximity/Sources/UI/Presentation/Loading/ProximityLoadingViewModel.swift b/Modules/feature-proximity/Sources/UI/Presentation/Loading/ProximityLoadingViewModel.swift index b2b4b078..545519d8 100644 --- a/Modules/feature-proximity/Sources/UI/Presentation/Loading/ProximityLoadingViewModel.swift +++ b/Modules/feature-proximity/Sources/UI/Presentation/Loading/ProximityLoadingViewModel.swift @@ -68,11 +68,11 @@ final class ProximityLoadingViewModel: BaseLoadingViewModel< } } - override func getTitle() -> LocalizableString.Key { + override func getTitle() -> LocalizableStringKey { .requestDataTitle([relyingParty]) } - override func getCaption() -> LocalizableString.Key { + override func getCaption() -> LocalizableStringKey { .requestsTheFollowing } diff --git a/Modules/feature-proximity/Sources/UI/Presentation/Request/ProximityRequestViewModel.swift b/Modules/feature-proximity/Sources/UI/Presentation/Request/ProximityRequestViewModel.swift index b5c4f3a5..dd7e8c0b 100644 --- a/Modules/feature-proximity/Sources/UI/Presentation/Request/ProximityRequestViewModel.swift +++ b/Modules/feature-proximity/Sources/UI/Presentation/Request/ProximityRequestViewModel.swift @@ -122,7 +122,7 @@ final class ProximityRequestViewModel: BaseRequestViewModel< navigationSuccessType: .push( .featureProximityModule( .proximityLoader( - relyingParty: LocalizableString.shared.get(with: getRelyingParty()), + relyingParty: getRelyingParty().toString, relyingPartyisTrusted: getRelyingPartyIsTrusted(), presentationCoordinator: proximitySessionCoordinator, originator: getOriginator(), @@ -145,31 +145,31 @@ final class ProximityRequestViewModel: BaseRequestViewModel< return getOriginator() } - override func getTitle() -> LocalizableString.Key { + override func getTitle() -> LocalizableStringKey { .dataSharingRequest } - override func getCaption() -> LocalizableString.Key { + override func getCaption() -> LocalizableStringKey { .requestsTheFollowing } - override func getDataRequestInfo() -> LocalizableString.Key { + override func getDataRequestInfo() -> LocalizableStringKey { .requestDataInfoNotice } - override func getRelyingParty() -> LocalizableString.Key { + override func getRelyingParty() -> LocalizableStringKey { viewState.relyingParty } - override func getTitleCaption() -> String { - LocalizableString.shared.get(with: .requestDataTitle([""])) + override func getTitleCaption() -> LocalizableStringKey { + .requestDataTitle([""]) } - override func getTrustedRelyingParty() -> LocalizableString.Key { + override func getTrustedRelyingParty() -> LocalizableStringKey { .requestDataVerifiedEntity } - override func getTrustedRelyingPartyInfo() -> LocalizableString.Key { + override func getTrustedRelyingPartyInfo() -> LocalizableStringKey { .requestDataVerifiedEntityMessage } diff --git a/Modules/logic-authentication/Sources/Error/AuthenticationError.swift b/Modules/logic-authentication/Sources/Error/AuthenticationError.swift index 40cd0ab5..8a7ce090 100644 --- a/Modules/logic-authentication/Sources/Error/AuthenticationError.swift +++ b/Modules/logic-authentication/Sources/Error/AuthenticationError.swift @@ -23,7 +23,7 @@ public enum AuthenticationError: LocalizedError { public var errorDescription: String? { return switch self { case .quickPinInvalid: - LocalizableString.shared.get(with: .invalidQuickPin) + LocalizableStringKey.invalidQuickPin.toString } } } diff --git a/Modules/logic-business/Sources/Error/RuntimeError.swift b/Modules/logic-business/Sources/Error/RuntimeError.swift index 54e8a1e0..4e6a1e6a 100644 --- a/Modules/logic-business/Sources/Error/RuntimeError.swift +++ b/Modules/logic-business/Sources/Error/RuntimeError.swift @@ -26,7 +26,7 @@ public enum RuntimeError: LocalizedError { case .customError(let message): message case .genericError: - LocalizableString.shared.get(with: .genericErrorDesc) + LocalizableStringKey.genericErrorDesc.toString } } } diff --git a/Modules/logic-core/Sources/Controller/WalletKitController.swift b/Modules/logic-core/Sources/Controller/WalletKitController.swift index ad7dd5fa..9f03e880 100644 --- a/Modules/logic-core/Sources/Controller/WalletKitController.swift +++ b/Modules/logic-core/Sources/Controller/WalletKitController.swift @@ -352,7 +352,7 @@ extension WalletKitController { ) -> DocValue { guard let document = fetchDocument(with: documentId) else { - return .unavailable(LocalizableString.shared.get(with: .errorUnableFetchDocument)) + return .unavailable(LocalizableStringKey.errorUnableFetchDocument.toString) } let claims = document.docClaims @@ -367,7 +367,7 @@ extension WalletKitController { .parseUserPseudonym() guard let element = claims.first(where: { $0.name == elementIdentifier }) else { - return .unavailable(LocalizableString.shared.get(with: .unavailableField)) + return .unavailable(LocalizableStringKey.unavailableField.toString) } if let image = element.dataValue.image { diff --git a/Modules/logic-core/Sources/Coordinator/ProximitySessionCoordinator.swift b/Modules/logic-core/Sources/Coordinator/ProximitySessionCoordinator.swift index 58806e96..62b5be59 100644 --- a/Modules/logic-core/Sources/Coordinator/ProximitySessionCoordinator.swift +++ b/Modules/logic-core/Sources/Coordinator/ProximitySessionCoordinator.swift @@ -124,8 +124,8 @@ final class ProximitySessionCoordinatorImpl: ProximitySessionCoordinator { private func createRequest() -> PresentationRequest { PresentationRequest( items: session.disclosedDocuments, - relyingParty: session.readerCertIssuer ?? LocalizableString.shared.get(with: .unknownVerifier), - dataRequestInfo: session.readerCertValidationMessage ?? LocalizableString.shared.get(with: .requestDataInfoNotice), + relyingParty: session.readerCertIssuer ?? LocalizableStringKey.unknownVerifier.toString, + dataRequestInfo: session.readerCertValidationMessage ?? LocalizableStringKey.requestDataInfoNotice.toString, isTrusted: session.readerCertIssuerValid == true ) } diff --git a/Modules/logic-core/Sources/Coordinator/RemoteSessionCoordinator.swift b/Modules/logic-core/Sources/Coordinator/RemoteSessionCoordinator.swift index 744f0cec..c13b4c81 100644 --- a/Modules/logic-core/Sources/Coordinator/RemoteSessionCoordinator.swift +++ b/Modules/logic-core/Sources/Coordinator/RemoteSessionCoordinator.swift @@ -106,8 +106,8 @@ final class RemoteSessionCoordinatorImpl: RemoteSessionCoordinator { private func createRequest() -> PresentationRequest { PresentationRequest( items: session.disclosedDocuments, - relyingParty: session.readerCertIssuer ?? LocalizableString.shared.get(with: .unknownVerifier), - dataRequestInfo: session.readerCertValidationMessage ?? LocalizableString.shared.get(with: .requestDataInfoNotice), + relyingParty: session.readerCertIssuer ?? LocalizableStringKey.unknownVerifier.toString, + dataRequestInfo: session.readerCertValidationMessage ?? LocalizableStringKey.requestDataInfoNotice.toString, isTrusted: session.readerCertIssuerValid == true ) } diff --git a/Modules/logic-core/Sources/Error/WalletCoreError.swift b/Modules/logic-core/Sources/Error/WalletCoreError.swift index 8403f232..2c10b376 100644 --- a/Modules/logic-core/Sources/Error/WalletCoreError.swift +++ b/Modules/logic-core/Sources/Error/WalletCoreError.swift @@ -27,17 +27,17 @@ public enum WalletCoreError: LocalizedError { public var errorDescription: String? { return switch self { case .unableFetchDocuments: - LocalizableString.shared.get(with: .errorUnableFetchDocuments) + LocalizableStringKey.errorUnableFetchDocuments.toString case .unableFetchDocument: - LocalizableString.shared.get(with: .errorUnableFetchDocument) + LocalizableStringKey.errorUnableFetchDocument.toString case .missingPid: - LocalizableString.shared.get(with: .missingPid) + LocalizableStringKey.missingPid.toString case .unableToIssueAndStore: - LocalizableString.shared.get(with: .unableToIssueAndStore) + LocalizableStringKey.unableToIssueAndStore.toString case .transactionCodeFormat(let args): - LocalizableString.shared.get(with: .transactionCodeFormatError(args)) + LocalizableStringKey.transactionCodeFormatError(args).toString case .unableToPresentAndShare: - LocalizableString.shared.get(with: .unableToPresentAndShare) + LocalizableStringKey.unableToPresentAndShare.toString } } } diff --git a/Modules/logic-core/Sources/Model/DocumentCategory.swift b/Modules/logic-core/Sources/Model/DocumentCategory.swift index 3582ae65..b12389d6 100644 --- a/Modules/logic-core/Sources/Model/DocumentCategory.swift +++ b/Modules/logic-core/Sources/Model/DocumentCategory.swift @@ -28,7 +28,7 @@ public enum DocumentCategory: Sendable, Equatable { case Retail case Other - public var title: LocalizableString.Key { + public var title: LocalizableStringKey { return switch self { case .Government: .categoryGovernment @@ -50,24 +50,7 @@ public enum DocumentCategory: Sendable, Equatable { } public var filterAttribute: String { - return switch self { - case .Government: - LocalizableString.shared.get(with: .categoryGovernment) - case .Travel: - LocalizableString.shared.get(with: .categoryTravel) - case .Finance: - LocalizableString.shared.get(with: .categoryFinance) - case .Education: - LocalizableString.shared.get(with: .categoryEducation) - case .Health: - LocalizableString.shared.get(with: .categoryHealth) - case .SocialSecurity: - LocalizableString.shared.get(with: .categorySocialSecurity) - case .Retail: - LocalizableString.shared.get(with: .categoryRetail) - case .Other: - LocalizableString.shared.get(with: .categoryOther) - } + return self.title.toString } public var order: Int { diff --git a/Modules/logic-resources/Sources/Extension/Button+Extensions.swift b/Modules/logic-resources/Sources/Extension/Button+Extensions.swift index fa0d7ccf..d1d3e96e 100644 --- a/Modules/logic-resources/Sources/Extension/Button+Extensions.swift +++ b/Modules/logic-resources/Sources/Extension/Button+Extensions.swift @@ -16,10 +16,10 @@ import SwiftUI public extension Button where Label == Text { - init(_ key: LocalizableString.Key, action: @escaping @MainActor () -> Void) { - self.init(LocalizableString.shared.get(with: key), action: action) + init(_ key: LocalizableStringKey, action: @escaping @MainActor () -> Void) { + self.init(key.toString, action: action) } - init(_ key: LocalizableString.Key, role: ButtonRole?, action: @escaping @MainActor () -> Void) { - self.init(LocalizableString.shared.get(with: key), role: role, action: action) + init(_ key: LocalizableStringKey, role: ButtonRole?, action: @escaping @MainActor () -> Void) { + self.init(key.toString, role: role, action: action) } } diff --git a/Modules/logic-resources/Sources/Extension/Label+Extensions.swift b/Modules/logic-resources/Sources/Extension/Label+Extensions.swift new file mode 100644 index 00000000..16a9f30b --- /dev/null +++ b/Modules/logic-resources/Sources/Extension/Label+Extensions.swift @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023 European Commission + * + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European + * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work + * except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the Licence for the specific language + * governing permissions and limitations under the Licence. + */ +import SwiftUI + +public extension Label where Title == Text, Icon == Image { + init(_ titleKey: LocalizableStringKey, systemImage name: String) { + self.init(titleKey.toLocalizedStringKey, systemImage: name) + } +} diff --git a/Modules/logic-resources/Sources/Extension/Text+Extensions.swift b/Modules/logic-resources/Sources/Extension/Text+Extensions.swift index 2a846c06..9d680312 100644 --- a/Modules/logic-resources/Sources/Extension/Text+Extensions.swift +++ b/Modules/logic-resources/Sources/Extension/Text+Extensions.swift @@ -30,7 +30,7 @@ public extension Text { } public extension Text { - init(_ key: LocalizableString.Key) { - self.init(verbatim: LocalizableString.shared.get(with: key)) + init(_ key: LocalizableStringKey) { + self.init(verbatim: key.toString) } } diff --git a/Modules/logic-resources/Sources/Extension/View+Extensions.swift b/Modules/logic-resources/Sources/Extension/View+Extensions.swift index 32ecfbab..91e78780 100644 --- a/Modules/logic-resources/Sources/Extension/View+Extensions.swift +++ b/Modules/logic-resources/Sources/Extension/View+Extensions.swift @@ -16,18 +16,18 @@ import SwiftUI public extension View { - func navigationTitle(_ key: LocalizableString.Key) -> some View { - return self.navigationTitle(LocalizableString.shared.get(with: key)) + func navigationTitle(_ key: LocalizableStringKey) -> some View { + return self.navigationTitle(key.toString) } func confirmationDialog( - _ key: LocalizableString.Key, + _ key: LocalizableStringKey, isPresented: Binding, titleVisibility: Visibility = .automatic, @ViewBuilder actions: () -> A, @ViewBuilder message: () -> M ) -> some View where A: View, M: View { return self.confirmationDialog( - LocalizableString.shared.get(with: key), + key.toString, isPresented: isPresented, titleVisibility: titleVisibility, actions: actions, diff --git a/Modules/logic-resources/Sources/Localizable/LocalizableStringKey.swift b/Modules/logic-resources/Sources/Localizable/LocalizableStringKey.swift new file mode 100644 index 00000000..223946db --- /dev/null +++ b/Modules/logic-resources/Sources/Localizable/LocalizableStringKey.swift @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2023 European Commission + * + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European + * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work + * except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the Licence for the specific language + * governing permissions and limitations under the Licence. + */ +import SwiftUI + +public enum LocalizableStringKey: Equatable, Sendable { + case dynamic(key: String) + case custom(String) + case space + case search + case genericErrorTitle + case genericErrorDesc + case biometryOpenSettings + case biometryConfirmRequest + case invalidQuickPin + case tryAgain + case shareButton + case cancelButton + case requestDataCaption + case requestDataInfoNotice + case requestDataTitle([String]) + case documentAdded + case requestDataSheetCaption + case okButton + case shareDataReview + case success + case successfullySharedFollowingInformation + case incompleteRequestDataSelection + case addDoc + case filters + case sortByIssuedDateSectionTitle + case issuerSectionTitle + case showResults + case showQRTap + case welcomeBack([String]) + case viewDocumentDetails + case pleaseWait + case requestDataShareQuickPinCaption + case requestDataShareBiometryCaption + case addDocumentTitle + case addDocumentSubtitle + case addDocumentRequest + case proximityConnectivityCaption + case unavailableField + case requestDataVerifiedEntity + case requestDataVerifiedEntityMessage + case moreOptions + case changeQuickPinOption + case quickPinSetTitle + case quickPinEnterPin + case quickPinConfirmPin + case quickPinSetCaptionOne + case quickPinSetCaptionTwo + case quickPinNextButton + case quickPinConfirmButton + case quickPinSetSuccess + case loginTitle + case loginCaptionQuickPinOnly + case loginCaption + case quickPinSetSuccessButton + case quickPinDoNotMatch + case quickPinUpdateTitle + case quickPinUpdateCaptionOne + case quickPinUpdateCaptionTwo + case quickPinUpdateCaptionThree + case quickPinUpdateSuccess + case quickPinUpdateSuccessButton + case quickPinUpdateCancellationTitle + case quickPinUpdateCancellationCaption + case quickPinUpdateCancellationContinue + case issuanceDetailsContinueButton + case successTitlePunctuated + case issuanceSuccessCaption([String]) + case issuanceSuccessNextButton + case issuerWantWalletAddition + case unknownVerifier + case unknownIssuer + case genericIssuer + case filterByIssuer + case yes + case no + case scanQrCode + case signDocument + case signDocumentSubtitle + case selectDocument + case validUntil([String]) + case bleDisabledModalTitle + case bleDisabledModalCaption + case bleDisabledModalButton + case requestDataNoDocument + case issuanceDetailsDeletionTitle([String]) + case deleteDocument + case issuanceDetailsDeletionCaption([String]) + case errorUnableFetchDocuments + case errorUnableFetchDocument + case scannerQrTitleIssuing + case scannerQrTitlePresentation + case scannerQrCaptionIssuing + case scannerQrCaptionPresentation + case scannerQrTitle + case scannerQrCaption + case cameraError + case missingPid + case requestCredentialOfferTitle([String]) + case requestCredentialOfferCaption + case requestCredentialOfferNoDocument + case unableToIssueAndStore + case issueButton + case cancelIssueSheetTitle + case cancelIssueSheetCaption + case cancelIssueSheetContinue + case credentialOfferSuccessButton + case credentialOfferSuccessCaption([String]) + case credentialOfferPartialSuccessCaption([String]) + case issuanceCodeTitle([String]) + case issuanceCodeCaption([String]) + case transactionCodeFormatError([String]) + case inProgress + case scopedIssuanceSuccessDeferredCaption + case scopedIssuanceSuccessDeferredCaptionDocName([String]) + case scopedIssuanceSuccessDeferredCaptionDocNameAndIssuer([String]) + case issuanceSuccessDeferredCaption([String]) + case pending + case issuanceFailed + case deferredDocumentsIssuedModalTitle + case defferedDocumentsIssuedModalCaption + case retrieveLogs + case qrScanInformativeText + case unableToPresentAndShare + case itemNotFoundInStorage + case itemsNotFoundInStorage + case home + case documents + case transactions + case authenticateAuthoriseTransactions + case electronicallySignDigitalDocuments + case learnMore + case chooseFromList + case chooseFromListTitle + case addDocumentsToWallet + case details + case dataSharingRequest + case dataShared + case doneButton + case dataSharingTitle + case close + case reset + case all + case descending + case ascending + case issuanceSuccessHeaderDescriptionWhenError + case trustedRelyingParty + case trustedRelyingPartyDescription + case alertAccessOnlineServices + case alertAccessOnlineServicesMessage + case alertSignDocumentsSafely + case alertSignDocumentsSafelyMessage + case authenticate + case inPerson + case online + case fromDevice + case autodashboardAuthenticateDialogMessage + case deleteButton + case savedToFavorites + case succesfullyAddedFollowingToWallet + case removedFromFavorites + case savedToFavoritesMessage + case removedFromFavoritesMessages + case viewDetails + case requestsTheFollowing + case walletIsSecured + case noResults + case noResultsDescription + case proximityConnectionNfcDescription + case orShareViaNfc + case expiryPeriodSectionTitle + case selectExpiryPeriod + case filterByState + case sortBy + case deleteDocumentConfirmDialog + case defaultLabel + case valid + case revoke + case expired + case dateIssued + case expiryDate + case nextSevenDays + case nextThirtyDays + case beyondThiryDays + case beforeToday + case issuanceRequest + case myEuWallet + case categoryGovernment + case categoryHealth + case categoryEducation + case categoryFinance + case categoryRetail + case categoryOther + case categorySocialSecurity + case categoryTravel + case changelog + case orderBy + case filterByCategory + case searchDocuments +} + +public extension LocalizableStringKey { + var toString: String { + LocalizableManager.shared.get(with: self) + } + var toLocalizedStringKey: LocalizedStringKey { + LocalizedStringKey(self.toString) + } +} diff --git a/Modules/logic-resources/Sources/LocalizableString.swift b/Modules/logic-resources/Sources/Manager/LocalizableManager.swift similarity index 75% rename from Modules/logic-resources/Sources/LocalizableString.swift rename to Modules/logic-resources/Sources/Manager/LocalizableManager.swift index d3742a22..fafd7de8 100644 --- a/Modules/logic-resources/Sources/LocalizableString.swift +++ b/Modules/logic-resources/Sources/Manager/LocalizableManager.swift @@ -15,17 +15,15 @@ */ import Foundation -import SwiftUI -public protocol LocalizableStringType: Sendable { - static var shared: LocalizableStringType { get } - func get(with key: LocalizableString.Key) -> String - func get(with key: LocalizableString.Key) -> LocalizedStringKey +protocol LocalizableManagerType: Sendable { + static var shared: LocalizableManagerType { get } + func get(with key: LocalizableStringKey) -> String } -public final class LocalizableString: LocalizableStringType { +final class LocalizableManager: LocalizableManagerType { - public static let shared: LocalizableStringType = LocalizableString() + static let shared: LocalizableManagerType = LocalizableManager() private let bundle: Bundle @@ -33,7 +31,7 @@ public final class LocalizableString: LocalizableStringType { self.bundle = .assetsBundle } - public func get(with key: Key) -> String { + func get(with key: LocalizableStringKey) -> String { return switch key { case .dynamic(let key): bundle.localizedString(forKey: key) @@ -433,219 +431,6 @@ public final class LocalizableString: LocalizableStringType { bundle.localizedString(forKey: "search_documents") } } - - public func get(with key: Key) -> LocalizedStringKey { - return self.get(with: key).toLocalizedStringKey - } -} - -public extension LocalizableString { - enum Key: Equatable, Sendable { - case dynamic(key: String) - case custom(String) - case space - case search - case genericErrorTitle - case genericErrorDesc - case biometryOpenSettings - case biometryConfirmRequest - case invalidQuickPin - case tryAgain - case shareButton - case cancelButton - case requestDataCaption - case requestDataInfoNotice - case requestDataTitle([String]) - case documentAdded - case requestDataSheetCaption - case okButton - case shareDataReview - case success - case successfullySharedFollowingInformation - case incompleteRequestDataSelection - case addDoc - case filters - case sortByIssuedDateSectionTitle - case issuerSectionTitle - case showResults - case showQRTap - case welcomeBack([String]) - case viewDocumentDetails - case pleaseWait - case requestDataShareQuickPinCaption - case requestDataShareBiometryCaption - case addDocumentTitle - case addDocumentSubtitle - case addDocumentRequest - case proximityConnectivityCaption - case unavailableField - case requestDataVerifiedEntity - case requestDataVerifiedEntityMessage - case moreOptions - case changeQuickPinOption - case quickPinSetTitle - case quickPinEnterPin - case quickPinConfirmPin - case quickPinSetCaptionOne - case quickPinSetCaptionTwo - case quickPinNextButton - case quickPinConfirmButton - case quickPinSetSuccess - case loginTitle - case loginCaptionQuickPinOnly - case loginCaption - case quickPinSetSuccessButton - case quickPinDoNotMatch - case quickPinUpdateTitle - case quickPinUpdateCaptionOne - case quickPinUpdateCaptionTwo - case quickPinUpdateCaptionThree - case quickPinUpdateSuccess - case quickPinUpdateSuccessButton - case quickPinUpdateCancellationTitle - case quickPinUpdateCancellationCaption - case quickPinUpdateCancellationContinue - case issuanceDetailsContinueButton - case successTitlePunctuated - case issuanceSuccessCaption([String]) - case issuanceSuccessNextButton - case issuerWantWalletAddition - case unknownVerifier - case unknownIssuer - case genericIssuer - case filterByIssuer - case yes - case no - case scanQrCode - case signDocument - case signDocumentSubtitle - case selectDocument - case validUntil([String]) - case bleDisabledModalTitle - case bleDisabledModalCaption - case bleDisabledModalButton - case requestDataNoDocument - case issuanceDetailsDeletionTitle([String]) - case deleteDocument - case issuanceDetailsDeletionCaption([String]) - case errorUnableFetchDocuments - case errorUnableFetchDocument - case scannerQrTitleIssuing - case scannerQrTitlePresentation - case scannerQrCaptionIssuing - case scannerQrCaptionPresentation - case scannerQrTitle - case scannerQrCaption - case cameraError - case missingPid - case requestCredentialOfferTitle([String]) - case requestCredentialOfferCaption - case requestCredentialOfferNoDocument - case unableToIssueAndStore - case issueButton - case cancelIssueSheetTitle - case cancelIssueSheetCaption - case cancelIssueSheetContinue - case credentialOfferSuccessButton - case credentialOfferSuccessCaption([String]) - case credentialOfferPartialSuccessCaption([String]) - case issuanceCodeTitle([String]) - case issuanceCodeCaption([String]) - case transactionCodeFormatError([String]) - case inProgress - case scopedIssuanceSuccessDeferredCaption - case scopedIssuanceSuccessDeferredCaptionDocName([String]) - case scopedIssuanceSuccessDeferredCaptionDocNameAndIssuer([String]) - case issuanceSuccessDeferredCaption([String]) - case pending - case issuanceFailed - case deferredDocumentsIssuedModalTitle - case defferedDocumentsIssuedModalCaption - case retrieveLogs - case qrScanInformativeText - case unableToPresentAndShare - case itemNotFoundInStorage - case itemsNotFoundInStorage - case home - case documents - case transactions - case authenticateAuthoriseTransactions - case electronicallySignDigitalDocuments - case learnMore - case chooseFromList - case chooseFromListTitle - case addDocumentsToWallet - case details - case dataSharingRequest - case dataShared - case doneButton - case dataSharingTitle - case close - case reset - case all - case descending - case ascending - case issuanceSuccessHeaderDescriptionWhenError - case trustedRelyingParty - case trustedRelyingPartyDescription - case alertAccessOnlineServices - case alertAccessOnlineServicesMessage - case alertSignDocumentsSafely - case alertSignDocumentsSafelyMessage - case authenticate - case inPerson - case online - case fromDevice - case autodashboardAuthenticateDialogMessage - case deleteButton - case savedToFavorites - case succesfullyAddedFollowingToWallet - case removedFromFavorites - case savedToFavoritesMessage - case removedFromFavoritesMessages - case viewDetails - case requestsTheFollowing - case walletIsSecured - case noResults - case noResultsDescription - case proximityConnectionNfcDescription - case orShareViaNfc - case expiryPeriodSectionTitle - case selectExpiryPeriod - case filterByState - case sortBy - case deleteDocumentConfirmDialog - case defaultLabel - case valid - case revoke - case expired - case dateIssued - case expiryDate - case nextSevenDays - case nextThirtyDays - case beyondThiryDays - case beforeToday - case issuanceRequest - case myEuWallet - case categoryGovernment - case categoryHealth - case categoryEducation - case categoryFinance - case categoryRetail - case categoryOther - case categorySocialSecurity - case categoryTravel - case changelog - case orderBy - case filterByCategory - case searchDocuments - } -} - -fileprivate extension String { - var toLocalizedStringKey: LocalizedStringKey { - LocalizedStringKey(self) - } } fileprivate extension Bundle { diff --git a/Modules/logic-storage/Sources/Error/StorageError.swift b/Modules/logic-storage/Sources/Error/StorageError.swift index 425dbdeb..f0a13c9d 100644 --- a/Modules/logic-storage/Sources/Error/StorageError.swift +++ b/Modules/logic-storage/Sources/Error/StorageError.swift @@ -24,9 +24,9 @@ public enum StorageError: LocalizedError { public var errorDescription: String? { return switch self { case .itemNotFound: - LocalizableString.shared.get(with: .itemNotFoundInStorage) + LocalizableStringKey.itemNotFoundInStorage.toString case .itemsNotFound: - LocalizableString.shared.get(with: .itemsNotFoundInStorage) + LocalizableStringKey.itemsNotFoundInStorage.toString } } } diff --git a/Modules/logic-ui/Sources/DesignSystem/Button/FloatingActionButtonView.swift b/Modules/logic-ui/Sources/DesignSystem/Button/FloatingActionButtonView.swift index 2de1ccf0..4680dc5c 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Button/FloatingActionButtonView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Button/FloatingActionButtonView.swift @@ -18,7 +18,7 @@ import logic_resources public struct FloatingActionButtonView: View { - private let title: LocalizableString.Key + private let title: LocalizableStringKey private let textColor: Color private let backgroundColor: Color private let icon: Image @@ -27,7 +27,7 @@ public struct FloatingActionButtonView: View { private let action: () -> Void public init( - title: LocalizableString.Key, + title: LocalizableStringKey, textColor: Color = Theme.shared.color.onSurface, backgroundColor: Color = Theme.shared.color.primary, icon: Image, @@ -75,7 +75,7 @@ public struct FloatingActionButtonView: View { public struct FloatingActionButtonModifier: ViewModifier { - private let title: LocalizableString.Key + private let title: LocalizableStringKey private let textColor: Color private let backgroundColor: Color private let icon: Image @@ -86,7 +86,7 @@ public struct FloatingActionButtonModifier: ViewModifier { private let trailingPadding: CGFloat public init( - title: LocalizableString.Key, + title: LocalizableStringKey, textColor: Color = Theme.shared.color.onSurface, backgroundColor: Color = Theme.shared.color.secondary, icon: Image, @@ -130,14 +130,14 @@ public struct FloatingActionButtonModifier: ViewModifier { #Preview { Group { FloatingActionButtonView( - title: LocalizableString.Key.addDocumentSubtitle, + title: LocalizableStringKey.addDocumentSubtitle, icon: Image(systemName: "calendar"), action: {} ) .lightModePreview() FloatingActionButtonView( - title: LocalizableString.Key.addDocumentSubtitle, + title: LocalizableStringKey.addDocumentSubtitle, icon: Image(systemName: "calendar"), action: {} ) diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Alert/AlertView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Alert/AlertView.swift index 608095fe..c8182d50 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Alert/AlertView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Alert/AlertView.swift @@ -18,9 +18,9 @@ import logic_resources struct AlertAlertViewModifier: ViewModifier { @Binding var isPresented: Bool - let title: LocalizableString.Key - let message: LocalizableString.Key - let buttonText: LocalizableString.Key + let title: LocalizableStringKey + let message: LocalizableStringKey + let buttonText: LocalizableStringKey let onDismiss: (() -> Void)? func body(content: Content) -> some View { @@ -43,9 +43,9 @@ struct AlertAlertViewModifier: ViewModifier { public extension View { func alertView( isPresented: Binding, - title: LocalizableString.Key, - message: LocalizableString.Key, - buttonText: LocalizableString.Key = .close, + title: LocalizableStringKey, + message: LocalizableStringKey, + buttonText: LocalizableStringKey = .close, onDismiss: (() -> Void)? = nil ) -> some View { self.modifier( diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/ConfirmationDialog/ConfirmationDialog.swift b/Modules/logic-ui/Sources/DesignSystem/Component/ConfirmationDialog/ConfirmationDialog.swift index 1b2bad5f..4fd06e52 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/ConfirmationDialog/ConfirmationDialog.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/ConfirmationDialog/ConfirmationDialog.swift @@ -18,10 +18,10 @@ import logic_resources public extension View { func confirmationDialog( - title: LocalizableString.Key, - message: LocalizableString.Key, - destructiveText: LocalizableString.Key? = nil, - baseText: LocalizableString.Key, + title: LocalizableStringKey, + message: LocalizableStringKey, + destructiveText: LocalizableStringKey? = nil, + baseText: LocalizableStringKey, isPresented: Binding, destructiveAction: (() -> Void)? = nil, baseAction: @escaping () -> Void @@ -41,10 +41,10 @@ public extension View { } struct ConfirmationDialogModifier: ViewModifier { - let title: LocalizableString.Key - let message: LocalizableString.Key - let destructiveText: LocalizableString.Key? - let baseText: LocalizableString.Key + let title: LocalizableStringKey + let message: LocalizableStringKey + let destructiveText: LocalizableStringKey? + let baseText: LocalizableStringKey let isPresented: Binding let destructiveAction: (() -> Void)? let baseAction: () -> Void diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentCaptionView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentCaptionView.swift index afb4284b..9f1d3e5e 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentCaptionView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentCaptionView.swift @@ -18,12 +18,12 @@ import logic_resources public struct ContentCaptionView: View { - private let caption: LocalizableString.Key + private let caption: LocalizableStringKey private let captionColor: Color private let isLoading: Bool public init( - caption: LocalizableString.Key, + caption: LocalizableStringKey, captionColor: Color = Theme.shared.color.onSurfaceVariant, isLoading: Bool = false ) { @@ -49,12 +49,12 @@ public struct ContentCaptionView: View { #Preview { Group { ContentCaptionView( - caption: LocalizableString.Key.tryAgain + caption: LocalizableStringKey.tryAgain ) .lightModePreview() ContentCaptionView( - caption: LocalizableString.Key.tryAgain + caption: LocalizableStringKey.tryAgain ) .darkModePreview() } diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentEmptyView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentEmptyView.swift index 0ee5936c..874cf746 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentEmptyView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentEmptyView.swift @@ -18,14 +18,14 @@ import logic_resources public struct ContentEmptyView: View { - private let title: LocalizableString.Key + private let title: LocalizableStringKey private let image: Image private let iconColor: Color private let textColor: Color private let onClick: (() -> Void)? public init( - title: LocalizableString.Key, + title: LocalizableStringKey, image: Image = Theme.shared.image.exclamationmarkCircle, iconColor: Color = Theme.shared.color.background, textColor: Color = Theme.shared.color.onSurface, @@ -60,13 +60,13 @@ public struct ContentEmptyView: View { #Preview { Group { ContentEmptyView( - title: LocalizableString.Key.tryAgain, + title: LocalizableStringKey.tryAgain, image: Theme.shared.image.checkmarkCircleFill ) .lightModePreview() ContentEmptyView( - title: LocalizableString.Key.tryAgain, + title: LocalizableStringKey.tryAgain, image: Theme.shared.image.checkmarkCircleFill ) .darkModePreview() diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentErrorView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentErrorView.swift index 699eb505..083dde4f 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentErrorView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentErrorView.swift @@ -51,16 +51,16 @@ public struct ContentErrorView: View { public extension ContentErrorView { struct Config { - let title: LocalizableString.Key - let description: LocalizableString.Key - let button: LocalizableString.Key + let title: LocalizableStringKey + let description: LocalizableStringKey + let button: LocalizableStringKey let cancelAction: () -> Void let action: (() -> Void)? public init( - title: LocalizableString.Key = .genericErrorTitle, - description: LocalizableString.Key = .genericErrorDesc, - button: LocalizableString.Key = .tryAgain, + title: LocalizableStringKey = .genericErrorTitle, + description: LocalizableStringKey = .genericErrorDesc, + button: LocalizableStringKey = .tryAgain, cancelAction: @escaping @autoclosure () -> Void, action: (() -> Void)? = nil ) { diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentExpandableView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentExpandableView.swift index eb7a2c10..304c3db2 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentExpandableView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentExpandableView.swift @@ -22,11 +22,11 @@ public struct ContentExpandableView: View { @State private var isExpanded = false - let title: LocalizableString.Key + let title: LocalizableStringKey let content: Content public init( - title: LocalizableString.Key, + title: LocalizableStringKey, @ViewBuilder content: () -> Content ) { self.title = title @@ -77,7 +77,7 @@ public struct ContentExpandableView: View { #Preview { Group { ContentExpandableView( - title: LocalizableString.Key.addDocumentTitle + title: LocalizableStringKey.addDocumentTitle ) { VStack { Text("title") @@ -87,7 +87,7 @@ public struct ContentExpandableView: View { .lightModePreview() ContentExpandableView( - title: LocalizableString.Key.addDocumentTitle + title: LocalizableStringKey.addDocumentTitle ) { VStack { Text("title") diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/ContentHeader.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/ContentHeader.swift index 85b55368..66f5236e 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/ContentHeader.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/ContentHeader.swift @@ -18,18 +18,18 @@ import logic_resources public struct ContentHeaderConfig { public let appIconAndTextData: AppIconAndTextData - public let description: LocalizableString.Key? + public let description: LocalizableStringKey? public let descriptionTextConfig: TextConfig? - public let mainText: LocalizableString.Key? + public let mainText: LocalizableStringKey? public let icon: RemoteImageView.ImageContentOption public let mainTextConfig: TextConfig? public let relyingPartyData: RelyingPartyData? public init( appIconAndTextData: AppIconAndTextData, - description: LocalizableString.Key? = nil, + description: LocalizableStringKey? = nil, descriptionTextConfig: TextConfig? = nil, - mainText: LocalizableString.Key? = nil, + mainText: LocalizableStringKey? = nil, icon: RemoteImageView.ImageContentOption = .none, mainTextConfig: TextConfig? = nil, relyingPartyData: RelyingPartyData? = nil diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/RelyingParty.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/RelyingParty.swift index e3e761e8..e2551c5c 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/RelyingParty.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeader/RelyingParty.swift @@ -19,17 +19,17 @@ import logic_resources public struct RelyingPartyData { public let logo: RemoteImageView.ImageContentOption? public let isVerified: Bool - public let name: LocalizableString.Key? + public let name: LocalizableStringKey? public let nameTextConfig: TextConfig? - public let description: LocalizableString.Key? + public let description: LocalizableStringKey? public let descriptionTextConfig: TextConfig? public init( logo: RemoteImageView.ImageContentOption? = nil, isVerified: Bool, - name: LocalizableString.Key? = nil, + name: LocalizableStringKey? = nil, nameTextConfig: TextConfig? = nil, - description: LocalizableString.Key? = nil, + description: LocalizableStringKey? = nil, descriptionTextConfig: TextConfig? = nil ) { self.logo = logo diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeaderView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeaderView.swift index 4c2b9122..4e237951 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeaderView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentHeaderView.swift @@ -18,14 +18,14 @@ import logic_resources public struct ContentHeaderView: View { - private let title: LocalizableString.Key? + private let title: LocalizableStringKey? private let dismissIcon: Image private let foregroundColor: Color private let actions: [Action]? private let onBack: (() -> Void)? public init( - title: LocalizableString.Key? = nil, + title: LocalizableStringKey? = nil, dismissIcon: Image = Theme.shared.image.arrowLeft, foregroundColor: Color = Theme.shared.color.primary, actions: [Action]? = nil, @@ -113,7 +113,7 @@ public extension ContentHeaderView { #Preview { Group { ContentHeaderView( - title: LocalizableString.Key.loginTitle, + title: LocalizableStringKey.loginTitle, actions: [ ContentHeaderView.Action( image: Image(systemName: "person"), @@ -125,7 +125,7 @@ public extension ContentHeaderView { .lightModePreview() ContentHeaderView( - title: LocalizableString.Key.loginTitle, + title: LocalizableStringKey.loginTitle, actions: [ ContentHeaderView.Action( image: Image(systemName: "person"), diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentScreenView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentScreenView.swift index 31c8e2cf..09368f01 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentScreenView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentScreenView.swift @@ -27,7 +27,7 @@ public struct ContentScreenView: View { private let allowBackGesture: Bool private let errorConfig: ContentErrorView.Config? private let background: Color - private let navigationTitle: LocalizableString.Key? + private let navigationTitle: LocalizableStringKey? private let isLoading: Bool private let toolbarContent: ToolBarContent? @@ -38,7 +38,7 @@ public struct ContentScreenView: View { allowBackGesture: Bool = false, errorConfig: ContentErrorView.Config? = nil, background: Color = Theme.shared.color.background, - navigationTitle: LocalizableString.Key? = nil, + navigationTitle: LocalizableStringKey? = nil, isLoading: Bool = false, toolbarContent: ToolBarContent? = nil, @ViewBuilder content: () -> Content diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentTitleView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentTitleView.swift index 3e42a401..27377ff3 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentTitleView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Content/ContentTitleView.swift @@ -21,7 +21,7 @@ public struct ContentTitleView: View { public typealias TapListener = (() -> Void)? public enum TitleDecoration { - case plain(LocalizableString.Key) + case plain(LocalizableStringKey) case icon(decorated: String, icon: Image, text: String?) } @@ -29,7 +29,7 @@ public struct ContentTitleView: View { private let titleFont: TypographyStyle private let titleDecoration: TitleDecoration private let decorationColor: Color - private let caption: LocalizableString.Key? + private let caption: LocalizableStringKey? private let titleColor: Color private let captionColor: Color private let textAlignment: Alignment @@ -38,10 +38,10 @@ public struct ContentTitleView: View { private let onTap: TapListener public init( - title: LocalizableString.Key, + title: LocalizableStringKey, titleFont: TypographyStyle = Theme.shared.font.titleLarge, titleWeight: Font.Weight = .regular, - caption: LocalizableString.Key? = nil, + caption: LocalizableStringKey? = nil, decorationColor: Color = Theme.shared.color.primary, titleColor: Color = Theme.shared.color.onSurface, captionColor: Color = Theme.shared.color.onSurfaceVariant, @@ -67,7 +67,7 @@ public struct ContentTitleView: View { titleDecoration: TitleDecoration, titleFont: TypographyStyle = Theme.shared.font.titleLarge, titleWeight: Font.Weight = .regular, - caption: LocalizableString.Key? = nil, + caption: LocalizableStringKey? = nil, decorationColor: Color = Theme.shared.color.primary, titleColor: Color = Theme.shared.color.onSurface, captionColor: Color = Theme.shared.color.onSurfaceVariant, @@ -154,14 +154,14 @@ public extension ContentTitleView { #Preview { Group { ContentTitleView( - title: LocalizableString.Key.tryAgain, - caption: LocalizableString.Key.tryAgain + title: LocalizableStringKey.tryAgain, + caption: LocalizableStringKey.tryAgain ) .lightModePreview() ContentTitleView( - title: LocalizableString.Key.tryAgain, - caption: LocalizableString.Key.tryAgain + title: LocalizableStringKey.tryAgain, + caption: LocalizableStringKey.tryAgain ) .darkModePreview() } diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/List/ActionCardView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/List/ActionCardView.swift index 5b629557..2eae18ac 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/List/ActionCardView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/List/ActionCardView.swift @@ -18,12 +18,12 @@ import logic_resources public struct ActionCard: View { private let icon: Image - private let title: LocalizableString.Key + private let title: LocalizableStringKey private let action: () -> Void public init( icon: Image, - title: LocalizableString.Key, + title: LocalizableStringKey, action: @escaping () -> Void ) { self.icon = icon diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/List/CardViewWithLogo.swift b/Modules/logic-ui/Sources/DesignSystem/Component/List/CardViewWithLogo.swift index 867253f9..4080b7e0 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/List/CardViewWithLogo.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/List/CardViewWithLogo.swift @@ -20,7 +20,7 @@ public struct CardViewWithLogo: View { private let cornerRadius: CGFloat private let backgroundColor: Color private let icon: RemoteImageView.ImageContentOption - private let title: LocalizableString.Key + private let title: LocalizableStringKey private let isVerified: Bool private let isLoading: Bool private let action: (() -> Void)? @@ -29,7 +29,7 @@ public struct CardViewWithLogo: View { cornerRadius: CGFloat = 13, backgroundColor: Color = Theme.shared.color.surfaceContainer, icon: RemoteImageView.ImageContentOption = .none, - title: LocalizableString.Key, + title: LocalizableStringKey, isVerified: Bool = false, isLoading: Bool = false, action: (() -> Void)? = nil diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/List/ExpandableCardView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/List/ExpandableCardView.swift index 06852d54..efde059c 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/List/ExpandableCardView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/List/ExpandableCardView.swift @@ -17,8 +17,8 @@ import SwiftUI import logic_resources public struct ExpandableCardView: View { - private let title: LocalizableString.Key - private let subtitle: LocalizableString.Key + private let title: LocalizableStringKey + private let subtitle: LocalizableStringKey private let backgroundColor: Color private let mainTextVerticalPadding: CGFloat? private let isLoading: Bool @@ -26,8 +26,8 @@ public struct ExpandableCardView: View { public init( backgroundColor: Color = Theme.shared.color.surfaceContainer, - title: LocalizableString.Key, - subtitle: LocalizableString.Key, + title: LocalizableStringKey, + subtitle: LocalizableStringKey, mainTextVerticalPadding: CGFloat? = nil, isLoading: Bool = false, @ViewBuilder content: @escaping () -> Content diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/List/HomeCardView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/List/HomeCardView.swift index cca65b87..cb8cc696 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/List/HomeCardView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/List/HomeCardView.swift @@ -17,20 +17,20 @@ import SwiftUI import logic_resources public struct HomeCardView: View { - private let text: LocalizableString.Key - private let buttonText: LocalizableString.Key + private let text: LocalizableStringKey + private let buttonText: LocalizableStringKey private let illustration: Image? private let buttonViewStyle: ButtonViewStyle - private let learnMoreText: LocalizableString.Key? + private let learnMoreText: LocalizableStringKey? private let learnMoreAction: (() -> Void)? private let action: () -> Void public init( - text: LocalizableString.Key, - buttonText: LocalizableString.Key, + text: LocalizableStringKey, + buttonText: LocalizableStringKey, illustration: Image? = nil, buttonViewStyle: ButtonViewStyle = .primary, - learnMoreText: LocalizableString.Key? = nil, + learnMoreText: LocalizableStringKey? = nil, learnMoreAction: (() -> Void)? = nil, action: @escaping () -> Void ) { @@ -96,17 +96,17 @@ public struct HomeCardView: View { ScrollView { VStack { HomeCardView( - text: LocalizableString.Key.authenticateAuthoriseTransactions, - buttonText: LocalizableString.Key.addDocumentTitle, + text: LocalizableStringKey.authenticateAuthoriseTransactions, + buttonText: LocalizableStringKey.addDocumentTitle, illustration: Image(systemName: "person.fill"), - learnMoreText: LocalizableString.Key.learnMore, + learnMoreText: LocalizableStringKey.learnMore, learnMoreAction: {}, action: {} ) HomeCardView( - text: LocalizableString.Key.authenticateAuthoriseTransactions, - buttonText: LocalizableString.Key.addDocumentTitle, + text: LocalizableStringKey.authenticateAuthoriseTransactions, + buttonText: LocalizableStringKey.addDocumentTitle, illustration: Image(systemName: "person.fill"), buttonViewStyle: .secondary, learnMoreAction: {}, @@ -114,15 +114,15 @@ public struct HomeCardView: View { ) HomeCardView( - text: LocalizableString.Key.authenticateAuthoriseTransactions, - buttonText: LocalizableString.Key.addDocumentTitle, + text: LocalizableStringKey.authenticateAuthoriseTransactions, + buttonText: LocalizableStringKey.addDocumentTitle, illustration: Image(systemName: "person.fill"), action: {} ) HomeCardView( - text: LocalizableString.Key.authenticateAuthoriseTransactions, - buttonText: LocalizableString.Key.addDocumentTitle, + text: LocalizableStringKey.authenticateAuthoriseTransactions, + buttonText: LocalizableStringKey.addDocumentTitle, action: {} ) } diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/List/ListItemData.swift b/Modules/logic-ui/Sources/DesignSystem/Component/List/ListItemData.swift index e0b59a3e..aa459eee 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/List/ListItemData.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/List/ListItemData.swift @@ -25,10 +25,10 @@ public struct ListItemData: Identifiable, Sendable, Equatable { @EquatableNoop public var id: String - public let mainText: LocalizableString.Key + public let mainText: LocalizableStringKey public let mainStyle: MainStyle - public let overlineText: LocalizableString.Key? - public let supportingText: LocalizableString.Key? + public let overlineText: LocalizableStringKey? + public let supportingText: LocalizableStringKey? public let supportingTextColor: Color public let overlineTextColor: Color public let leadingIcon: LeadingIcon? @@ -38,10 +38,10 @@ public struct ListItemData: Identifiable, Sendable, Equatable { public init( id: String = UUID().uuidString, - mainText: LocalizableString.Key, + mainText: LocalizableStringKey, mainStyle: MainStyle = .plain, - overlineText: LocalizableString.Key? = nil, - supportingText: LocalizableString.Key? = nil, + overlineText: LocalizableStringKey? = nil, + supportingText: LocalizableStringKey? = nil, supportingTextColor: Color = Theme.shared.color.onSurfaceVariant, overlineTextColor: Color = Theme.shared.color.onSurfaceVariant, leadingIcon: LeadingIcon? = nil, diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/List/TappableCellView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/List/TappableCellView.swift index 7af72bbc..419b40d1 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/List/TappableCellView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/List/TappableCellView.swift @@ -17,13 +17,13 @@ import SwiftUI import logic_resources public struct TappableCellView: View { - public let title: LocalizableString.Key + public let title: LocalizableStringKey public let showDivider: Bool public let useOverlay: Bool public let action: () -> Void public init( - title: LocalizableString.Key, + title: LocalizableStringKey, showDivider: Bool, useOverlay: Bool = true, action: @escaping () -> Void diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/SearchableList/SearchableListView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/SearchableList/SearchableListView.swift index a91a057e..beb9094c 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/SearchableList/SearchableListView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/SearchableList/SearchableListView.swift @@ -18,7 +18,7 @@ import logic_resources struct SearchableModifier: ViewModifier { @Binding var searchText: String - let placeholder: String + let placeholder: LocalizableStringKey let backgroundColor: Color? let onSearchTextChange: (String) -> Void @@ -43,7 +43,7 @@ struct SearchableModifier: ViewModifier { public extension View { func searchable( searchText: Binding, - placeholder: String = LocalizableString.shared.get(with: .searchDocuments), + placeholder: LocalizableStringKey = .searchDocuments, backgroundColor: Color? = nil, onSearchTextChange: @escaping (String) -> Void ) -> some View { @@ -60,7 +60,7 @@ public extension View { struct CustomSearchBar: UIViewRepresentable { @Binding var text: String - let placeholder: String + let placeholder: LocalizableStringKey class Coordinator: NSObject, UISearchBarDelegate { @Binding var text: String @@ -93,7 +93,7 @@ struct CustomSearchBar: UIViewRepresentable { func makeUIView(context: Context) -> UISearchBar { let searchBar = UISearchBar() - searchBar.placeholder = placeholder + searchBar.placeholder = placeholder.toString searchBar.delegate = context.coordinator searchBar.autocapitalizationType = .none @@ -101,7 +101,7 @@ struct CustomSearchBar: UIViewRepresentable { toolbar.sizeToFit() let doneButton = UIBarButtonItem( - title: LocalizableString.shared.get(with: .doneButton), + title: LocalizableStringKey.doneButton.toString, style: .done, target: context.coordinator, action: #selector(context.coordinator.dismissKeyboard) @@ -164,7 +164,7 @@ struct CustomSearchBar: UIViewRepresentable { ) .searchable( searchText: .constant(""), - placeholder: "Search" + placeholder: .search ) { _ in } } } diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Text/ExpandableTextView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Text/ExpandableTextView.swift index 15aa0411..5728d0a3 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Text/ExpandableTextView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Text/ExpandableTextView.swift @@ -20,14 +20,14 @@ import logic_resources public struct ExpandableTextView: View { @State private var isExpanded = false - var title: LocalizableString.Key - var content: LocalizableString.Key + var title: LocalizableStringKey + var content: LocalizableStringKey let isloading: Bool public init( isExpanded: Bool = false, - title: LocalizableString.Key, - content: LocalizableString.Key, + title: LocalizableStringKey, + content: LocalizableStringKey, isloading: Bool ) { self.isExpanded = isExpanded @@ -85,14 +85,14 @@ public struct ExpandableTextView: View { #Preview { VStack { ExpandableTextView( - title: LocalizableString.Key.addDocumentTitle, - content: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDocumentTitle, + content: LocalizableStringKey.addDoc, isloading: false ) ExpandableTextView( - title: LocalizableString.Key.addDocumentTitle, - content: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDocumentTitle, + content: LocalizableStringKey.addDoc, isloading: true ) } diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Text/KeyValueView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Text/KeyValueView.swift index beba10bd..0cf7a1d4 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Text/KeyValueView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Text/KeyValueView.swift @@ -19,18 +19,18 @@ import logic_resources public struct KeyValueView: View { enum Value { - case string(LocalizableString.Key) + case string(LocalizableStringKey) case image(Image) } - let title: LocalizableString.Key + let title: LocalizableStringKey let value: Value let alignment: KeyValueView.Alignment let isLoading: Bool public init( - title: LocalizableString.Key, - subTitle: LocalizableString.Key, + title: LocalizableStringKey, + subTitle: LocalizableStringKey, alignment: KeyValueView.Alignment = .start, isLoading: Bool = false ) { @@ -41,7 +41,7 @@ public struct KeyValueView: View { } public init( - title: LocalizableString.Key, + title: LocalizableStringKey, image: Image, alignment: KeyValueView.Alignment = .start, isLoading: Bool = false diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapButtonView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapButtonView.swift index b32a7d51..62115a88 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapButtonView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapButtonView.swift @@ -18,7 +18,7 @@ import logic_resources public struct WrapButtonView: View { - private let title: LocalizableString.Key + private let title: LocalizableStringKey private let onAction: () -> Void private let textColor: Color private let backgroundColor: Color @@ -32,7 +32,7 @@ public struct WrapButtonView: View { private let isLoading: Bool public init( - title: LocalizableString.Key, + title: LocalizableStringKey, textColor: Color = Theme.shared.color.onSurface, backgroundColor: Color = Theme.shared.color.primary, iconColor: Color = Theme.shared.color.primary, @@ -61,7 +61,7 @@ public struct WrapButtonView: View { public init( style: ButtonViewStyle, - title: LocalizableString.Key, + title: LocalizableStringKey, iconColor: Color = Theme.shared.color.primary, icon: Image? = nil, gravity: Gravity = .center, @@ -142,7 +142,7 @@ public extension WrapButtonView { VStack { WrapButtonView( style: .primary, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, icon: Image(systemName: "calendar"), gravity: .center, cornerRadius: 10, @@ -150,7 +150,7 @@ public extension WrapButtonView { ) WrapButtonView( style: .primary, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, icon: Image(systemName: "calendar"), gravity: .start, cornerRadius: 10, @@ -158,7 +158,7 @@ public extension WrapButtonView { ) WrapButtonView( style: .secondary, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, icon: Image(systemName: "calendar"), gravity: .end, cornerRadius: 10, @@ -166,7 +166,7 @@ public extension WrapButtonView { ) WrapButtonView( style: .primary, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, icon: Image(systemName: "calendar"), gravity: .center, isLoading: true, @@ -175,7 +175,7 @@ public extension WrapButtonView { ) WrapButtonView( style: .primary, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, icon: Image(systemName: "calendar"), gravity: .center, isEnabled: false, @@ -184,14 +184,14 @@ public extension WrapButtonView { ) WrapButtonView( style: .error, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, gravity: .center, onAction: {}() ) WrapButtonView( style: .success, - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, icon: Image(systemName: "checkmark"), gravity: .center, onAction: {}() diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapIconView.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapIconView.swift index bb9afb42..9c9983a2 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapIconView.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapIconView.swift @@ -19,7 +19,7 @@ import logic_resources public struct WrapIconView: View { - private let title: LocalizableString.Key? + private let title: LocalizableStringKey? private let textColor: Color private let backgroundColor: Color private let systemIcon: String @@ -28,7 +28,7 @@ public struct WrapIconView: View { private let isEnabled: Bool public init( - title: LocalizableString.Key? = nil, + title: LocalizableStringKey? = nil, textColor: Color = .white, backgroundColor: Color = Theme.shared.color.background, systemIcon: String, @@ -83,14 +83,14 @@ public extension WrapIconView { #Preview { Group { WrapIconView( - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, textColor: Theme.shared.color.onSurface, systemIcon: "calendar" ) .lightModePreview() WrapIconView( - title: LocalizableString.Key.addDoc, + title: LocalizableStringKey.addDoc, textColor: Theme.shared.color.onSurface, systemIcon: "calendar" ) diff --git a/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapText.swift b/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapText.swift index 94e1eeef..6614a275 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapText.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Component/Wrap/WrapText.swift @@ -17,10 +17,10 @@ import SwiftUI import logic_resources public struct WrapText: View { - private let text: LocalizableString.Key + private let text: LocalizableStringKey private let textConfig: TextConfig - public init(text: LocalizableString.Key, textConfig: TextConfig) { + public init(text: LocalizableStringKey, textConfig: TextConfig) { self.text = text self.textConfig = textConfig } diff --git a/Modules/logic-ui/Sources/DesignSystem/Toolbar/ToolBarContent.swift b/Modules/logic-ui/Sources/DesignSystem/Toolbar/ToolBarContent.swift index 86ac1dda..a7dbf5ac 100644 --- a/Modules/logic-ui/Sources/DesignSystem/Toolbar/ToolBarContent.swift +++ b/Modules/logic-ui/Sources/DesignSystem/Toolbar/ToolBarContent.swift @@ -18,14 +18,14 @@ import logic_resources public struct Action: Identifiable { public let id = UUID() - public let title: LocalizableString.Key? + public let title: LocalizableStringKey? public let image: Image? public let hasIndicator: Bool? public let disabled: Bool public let callback: (() -> Void)? public init( - title: LocalizableString.Key? = nil, + title: LocalizableStringKey? = nil, image: Image? = nil, hasIndicator: Bool? = nil, disabled: Bool = false,