[TF-1576] fix

This commit is contained in:
gmc 2024-07-21 20:03:49 +02:00
parent 9e5cab719f
commit f1cfdf63ad
2 changed files with 4 additions and 3 deletions

View File

@ -26,7 +26,7 @@ enum MainContainerBottomNavigationGenerator {
case normal
case template(color: UIColor)
}
case filledButton(text: String, callback: Callback, created: ((LoadingContentButton) -> Void)? = nil)
case filledButton(text: String, isEnabled: Bool = true, callback: Callback, created: ((LoadingContentButton) -> Void)? = nil)
case textButton(text: String, callback: Callback, created: ((LoadingContentButton) -> Void)? = nil)
case text(text: String, style: MainContainerTextStyling, created: ((UILabel) -> Void)? = nil)
case pagination(currentPage: Int, totalPages: Int)
@ -52,10 +52,11 @@ enum MainContainerBottomNavigationGenerator {
private static func elementToView(_ element: Element) -> UIView {
switch element {
case .filledButton(let text, let callback, let created):
case .filledButton(let text, let isEnabled, let callback, let created):
let button = LoadingContentButton()
button.configure(style: .background, title: text)
button.action = callback
button.setState(isEnabled ? .active : .inactive)
created?(button)
return button

View File

@ -74,7 +74,7 @@ final class ImporterPreimportSummaryViewController: UIViewController {
])
let contentBottom = MainContainerBottomContentGenerator(elements: [
.filledButton(text: T.Backup.importFile, callback: { [weak self] in self?.presenter.handleImport() }),
.filledButton(text: T.Backup.importFile, isEnabled: presenter.countNew > 0, callback: { [weak self] in self?.presenter.handleImport() }),
.textButton(
text: T.Commons.cancel,
callback: { [weak self] in self?.presenter.handleCancel() },