79 lines
2.6 KiB
Swift
79 lines
2.6 KiB
Swift
//
|
|
// AccountOnboardingControllerStartWay.swift
|
|
// Wallet
|
|
//
|
|
// Created by Saveliy Stavitsky on 2/16/21.
|
|
// Copyright © 2021 AM. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import WalletKit
|
|
import WalletFoundation
|
|
|
|
final class AccountOnboardingControllerStartWay: UIViewController {
|
|
|
|
typealias Completion = () -> Void
|
|
var completion: Completion?
|
|
|
|
@IBOutlet var privateKeyView: UIView!
|
|
@IBOutlet var linkView: UIView!
|
|
|
|
@IBOutlet var buyAccountView: UIView!
|
|
@IBOutlet var buyAccountPriceLabel: UILabel!
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
self.buyAccountView.isHidden = false
|
|
self.buyAccountPriceLabel.isHidden = true
|
|
self.linkView.isHidden = true
|
|
|
|
self.navigationController >>- {
|
|
$0.navigationBar.setBackgroundImage(UIImage(), for: .default)
|
|
$0.navigationBar.shadowImage = UIImage()
|
|
$0.navigationBar.isTranslucent = true
|
|
}
|
|
|
|
[self.privateKeyView, self.linkView]
|
|
.compactMap { $0 }
|
|
.forEach {
|
|
$0.layer.borderWidth = 1.0
|
|
$0.layer.borderColor = Asset.marble.color.cgColor
|
|
}
|
|
}
|
|
|
|
@IBAction func privateKeyPressed(_ sender: Any) {
|
|
AccountViewAuthorize.showGetPassword(in: self) { _ in
|
|
let manualController = StoryboardScene.Account.manual.instantiate()
|
|
manualController.privateKeyHasBeenProcessed = { [weak self] in
|
|
guard let self else { return }
|
|
self.completion?()
|
|
self.navigationController >>- { $0.popViewController(animated: true) }
|
|
}
|
|
self.navigationController?.pushViewController(manualController, animated: true)
|
|
}
|
|
}
|
|
|
|
@IBAction func linkPressed(_ sender: Any) {
|
|
// UIApplication.shared.open(URL(string: "https://myeoswallet.net/resources")!)
|
|
}
|
|
|
|
@IBAction private func onCreateWallet() {
|
|
Task {
|
|
do {
|
|
let vc = try await AttestateWalletService.createController()
|
|
DispatchQueue.main.async {
|
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
}
|
|
} catch {
|
|
Popup.show(title: "account.create.error.title".localized,
|
|
description: "account.create.error.description".localized,
|
|
submit: "account.create.error.button.title".localized,
|
|
submitStyle: .primary) { ctrl in
|
|
ctrl.dismiss(animated: true, completion: nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|