Skip to content

Commit

Permalink
feat(GiniBankSDK): Skonto: Add a separate localizable string key for …
Browse files Browse the repository at this point in the history
…try again button title

PP-936
  • Loading branch information
mrkulik committed Dec 10, 2024
1 parent ae24d11 commit dc4df2a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ final class DocumentPagesViewController: UIViewController {
private var viewModel: DocumentPagesViewModelProtocol?
private let configuration = GiniBankConfiguration.shared
private let screenTitle: String?
private let errorButtonTitle: String
private var errorView: DocumentPagesErrorView?

// Constraints
private var contentStackViewTopConstraint: NSLayoutConstraint?

// MARK: - Init
init(screenTitle: String? = nil) {
init(screenTitle: String? = nil, errorButtonTitle: String) {
self.screenTitle = screenTitle
self.errorButtonTitle = errorButtonTitle
super.init(nibName: nil, bundle: nil)
}

Expand Down Expand Up @@ -107,9 +109,7 @@ final class DocumentPagesViewController: UIViewController {
func setError(errorType: ErrorType, tryAgainAction: @escaping () -> Void) {
let errorView = DocumentPagesErrorView(
errorType: errorType,
buttonTitle: NSLocalizedStringPreferredGiniBankFormat(
"ginibank.transactionDocs.preview.error.tryAgain.buttonTitle",
comment: "Try again"),
buttonTitle: errorButtonTitle,
buttonAction: {
tryAgainAction()
self.removeErrorView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,10 @@ extension GiniBankNetworkingScreenApiCoordinator: SkontoCoordinatorDelegate {
}

func didTapDocumentPreview(_ coordinator: Coordinator, _ skontoViewModel: SkontoViewModel) {
let viewController = DocumentPagesViewController(screenTitle: SkontoDocumentPagesViewModel.screenTitle)
let errorButtonTitle = SkontoDocumentPagesViewModel.errorButtonTitle
let screenTitle = SkontoDocumentPagesViewModel.screenTitle
let viewController = DocumentPagesViewController(screenTitle: screenTitle,
errorButtonTitle: errorButtonTitle)
viewController.modalPresentationStyle = .overCurrentContext
screenAPINavigationController.present(viewController, animated: true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ final class SkontoDocumentPagesViewModel: DocumentPagesViewModelProtocol {
private var expiryDate: Date

// Information to be displayed in the screen after highlighting Skonto details
private (set) var processedImages = [UIImage]()
private(set) var processedImages = [UIImage]()
static var screenTitle = NSLocalizedStringPreferredGiniBankFormat("ginibank.skonto.document.pages.screen.title",
comment: "Skonto discount details")
static var errorButtonTitle = NSLocalizedStringPreferredGiniBankFormat("ginibank.skonto.document.pages.error.buttonTitle",
comment: "Try again")
var bottomInfoItems: [String] {
return [expiryDateString, withDiscountPriceString, withoutDiscountPriceString]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public class TransactionDocsViewModel {
func handlePreviewDocument(for documentId: String) {
let transactionDoc = transactionDocs.first(where: { $0.documentId == documentId })
let screenTitle = transactionDoc?.fileName ?? ""
let viewController = DocumentPagesViewController(screenTitle: screenTitle)
let errorButtonTitle = NSLocalizedStringPreferredGiniBankFormat(
"ginibank.transactionDocs.preview.error.tryAgain.buttonTitle",
comment: "Try again")
let viewController = DocumentPagesViewController(screenTitle: screenTitle, errorButtonTitle: errorButtonTitle)
viewController.modalPresentationStyle = .overCurrentContext
documentPagesViewController = viewController
presentingViewController?.present(viewController, animated: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"ginibank.skonto.help.back" = "Skonto";

"ginibank.skonto.document.pages.screen.title" = "Skonto-Details";
"ginibank.skonto.document.pages.error.buttonTitle" = "Versuch's nochmal";

// MARK: - Transaction Docs feature
"ginibank.transactionDocs.alert.title" = "Fügen Sie der Transaktion einen Anhang hinzu?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"ginibank.skonto.help.back" = "Skonto discount";

"ginibank.skonto.document.pages.screen.title" = "Skonto discount details";
"ginibank.skonto.document.pages.error.buttonTitle" = "Try again";

// MARK: - Transaction Docs feature
"ginibank.transactionDocs.alert.title" = "Add an attachment to this transaction?";
Expand Down

0 comments on commit dc4df2a

Please sign in to comment.