Skip to content
Snippets Groups Projects

Account recovery/backup feature

5 files
+ 102
0
Compare changes
  • Side-by-side
  • Inline

Files

@@ -2,6 +2,7 @@ import HUD
import UIKit
import Models
import Shared
import Popup
import Combine
import DependencyInjection
@@ -13,6 +14,7 @@ public final class RestoreController: UIViewController {
private let viewModel: RestoreViewModel
private var cancellables = Set<AnyCancellable>()
private var popupCancellables = Set<AnyCancellable>()
public init(_ ndf: String, _ settings: RestoreSettings) {
viewModel = .init(ndf: ndf, settings: settings)
@@ -23,6 +25,7 @@ public final class RestoreController: UIViewController {
public override func loadView() {
view = screenView
presentWarning()
}
public override func viewDidLoad() {
@@ -91,3 +94,40 @@ public final class RestoreController: UIViewController {
navigationController?.popViewController(animated: true)
}
}
extension RestoreController {
private func presentWarning() {
let actionButton = CapsuleButton()
actionButton.set(
style: .brandColored,
title: Localized.Restore.Warning.action
)
let popup = BottomPopup(with: [
PopupLabel(
font: Fonts.Mulish.bold.font(size: 26.0),
text: Localized.Restore.Warning.title,
color: Asset.neutralActive.color,
alignment: .left,
spacingAfter: 19
),
PopupLinkText(
text: Localized.Restore.Warning.subtitle,
urlString: "",
spacingAfter: 37
),
PopupStackView(views: [actionButton])
])
actionButton.publisher(for: .touchUpInside)
.receive(on: DispatchQueue.main)
.sink {
popup.dismiss(animated: true) { [weak self] in
guard let self = self else { return }
self.popupCancellables.removeAll()
}
}.store(in: &popupCancellables)
coordinator.toPopup(popup, from: self)
}
}
Loading