mirror of
https://github.com/lil-org/wallet.git
synced 2025-01-07 13:46:25 +03:00
Enable waiting state when sending NEAR transactions on iOS
This commit is contained in:
parent
0bd85b47b0
commit
fb994896cd
@ -303,6 +303,7 @@ Label</string>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="cancelButton" destination="v8H-iO-Xlx" id="esx-8p-B1z"/>
|
||||
<outlet property="okButton" destination="I4B-ul-Hdj" id="5d0-w3-VFH"/>
|
||||
<outlet property="tableView" destination="fJC-Mc-BzB" id="Zf6-wd-F2t"/>
|
||||
</connections>
|
||||
|
@ -23,16 +23,19 @@ class ApproveViewController: UIViewController {
|
||||
private var cellModels = [CellModel]()
|
||||
|
||||
private var approveTitle: String!
|
||||
private var subject: ApprovalSubject!
|
||||
private var account: Account!
|
||||
private var meta: String!
|
||||
private var completion: ((Bool) -> Void)!
|
||||
private var peerMeta: PeerMeta?
|
||||
|
||||
@IBOutlet weak var okButton: UIButton!
|
||||
@IBOutlet weak var cancelButton: UIButton!
|
||||
|
||||
static func with(subject: ApprovalSubject, account: Account, meta: String, peerMeta: PeerMeta?, completion: @escaping (Bool) -> Void) -> ApproveViewController {
|
||||
let new = instantiate(ApproveViewController.self, from: .main)
|
||||
new.completion = completion
|
||||
new.subject = subject
|
||||
new.account = account
|
||||
new.meta = meta
|
||||
new.approveTitle = subject.title
|
||||
@ -61,6 +64,7 @@ class ApproveViewController: UIViewController {
|
||||
@IBAction func okButtonTapped(_ sender: Any) {
|
||||
LocalAuthentication.attempt(reason: approveTitle, presentPasswordAlertFrom: self, passwordReason: approveTitle) { [weak self] success in
|
||||
if success {
|
||||
self?.enableWaitingIfNeeded()
|
||||
self?.completion(true)
|
||||
}
|
||||
}
|
||||
@ -70,6 +74,14 @@ class ApproveViewController: UIViewController {
|
||||
completion(false)
|
||||
}
|
||||
|
||||
private func enableWaitingIfNeeded() {
|
||||
guard subject == .approveTransaction else { return }
|
||||
okButton.configuration?.showsActivityIndicator = true
|
||||
okButton.configuration?.title = ""
|
||||
okButton.isEnabled = false
|
||||
cancelButton.isEnabled = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ApproveViewController: UITableViewDelegate {
|
||||
|
Loading…
Reference in New Issue
Block a user