2021-06-13 04:41:04 +03:00
|
|
|
// Copyright © 2021 Encrypted Ink. All rights reserved.
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
|
|
|
class ApproveViewController: NSViewController {
|
|
|
|
|
2021-06-13 07:01:01 +03:00
|
|
|
@IBOutlet weak var titleLabel: NSTextField!
|
2021-06-13 10:01:19 +03:00
|
|
|
@IBOutlet var metaTextView: NSTextView!
|
2021-06-19 12:06:13 +03:00
|
|
|
@IBOutlet weak var okButton: NSButton!
|
2021-06-13 07:01:01 +03:00
|
|
|
|
2021-06-13 09:32:07 +03:00
|
|
|
var approveTitle: String!
|
|
|
|
var meta: String!
|
2021-06-13 08:59:24 +03:00
|
|
|
var completion: ((Bool) -> Void)!
|
|
|
|
|
2021-06-13 09:32:07 +03:00
|
|
|
static func with(title: String, meta: String, completion: @escaping (Bool) -> Void) -> ApproveViewController {
|
|
|
|
let new = instantiate(ApproveViewController.self)
|
|
|
|
new.completion = completion
|
|
|
|
new.meta = meta
|
|
|
|
new.approveTitle = title
|
|
|
|
return new
|
|
|
|
}
|
|
|
|
|
2021-06-13 07:01:01 +03:00
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
2021-06-13 09:32:07 +03:00
|
|
|
titleLabel.stringValue = approveTitle
|
2021-06-13 10:01:19 +03:00
|
|
|
metaTextView.string = meta
|
2021-06-13 07:01:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func actionButtonTapped(_ sender: Any) {
|
2021-06-13 08:59:24 +03:00
|
|
|
completion(true)
|
2021-06-13 07:01:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func cancelButtonTapped(_ sender: NSButton) {
|
2021-06-13 08:59:24 +03:00
|
|
|
completion(false)
|
2021-06-13 07:01:01 +03:00
|
|
|
}
|
|
|
|
|
2021-06-13 04:41:04 +03:00
|
|
|
}
|