-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex Guretzki
committed
Nov 8, 2024
1 parent
36177fd
commit 53b0525
Showing
5 changed files
with
147 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
AdyenComponents/PayByBank/US/PayByBankUSComponent+ConfirmationViewController+Model.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// Copyright (c) 2024 Adyen N.V. | ||
// | ||
// This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
// | ||
|
||
import Foundation | ||
@_spi(AdyenInternal) import Adyen | ||
|
||
extension PayByBankUSComponent.ConfirmationViewController { | ||
|
||
internal class Model { | ||
|
||
internal let headerImageUrl: URL | ||
internal let supportedBankLogoURLs: [URL] | ||
internal let supportedBanksMoreText: String | ||
internal let title: String | ||
internal let subtitle: String | ||
internal let message: String | ||
internal let submitTitle: String | ||
|
||
internal let style: PayByBankUSComponent.Style | ||
internal let headerImageViewSize = CGSize(width: 80, height: 52) | ||
|
||
internal let continueHandler: () -> Void | ||
|
||
private let imageLoader: ImageLoading = ImageLoaderProvider.imageLoader() | ||
private var imageLoadingTask: AdyenCancellable? { | ||
willSet { imageLoadingTask?.cancel() } | ||
} | ||
|
||
internal init( | ||
title: String, | ||
headerImageUrl: URL, | ||
supportedBankLogoNames: [String], | ||
style: PayByBankUSComponent.Style, | ||
localizationParameters: LocalizationParameters?, | ||
logoUrlProvider: LogoURLProvider, | ||
continueHandler: @escaping () -> Void | ||
) { | ||
self.headerImageUrl = headerImageUrl | ||
self.supportedBankLogoURLs = supportedBankLogoNames.map { logoUrlProvider.logoURL(withName: $0) } | ||
self.supportedBanksMoreText = localizedString(.payByBankAISDDMore, localizationParameters) | ||
self.title = title | ||
self.subtitle = localizedString(.payByBankAISDDDisclaimerHeader, localizationParameters) | ||
self.message = localizedString(.payByBankAISDDDisclaimerBody, localizationParameters) | ||
self.submitTitle = localizedString(.payByBankAISDDSubmit, localizationParameters) | ||
self.style = style | ||
self.continueHandler = continueHandler | ||
} | ||
|
||
internal func loadHeaderImage(for imageView: UIImageView) { | ||
imageLoadingTask = imageView.load(url: headerImageUrl, using: imageLoader) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters