// // UnbindViewController.swift // Twear // // Created by yangbin on 2022/1/4. // import UIKit class UnbindViewController: UIViewController { @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var macLabel: UILabel! @IBOutlet weak var batteryLabel: UILabel! var unbindClosure: (() -> ())? let device = CurDevice override func viewDidLoad() { super.viewDidLoad() title = LocString("解绑设备") nameLabel.text = device.name macLabel.text = "mac:\(device.mac)" batteryLabel.text = "\(LocString("电量")):\(Battery)%" // Do any additional setup after loading the view. } @IBAction func unbind(_ sender: Any) { let alertVC = UIAlertController(title: "", message: LocString("是否解除绑定?"), preferredStyle: .alert) let confirm = UIAlertAction(title: LocString("确定"), style: .destructive) { [weak self] (action) in BluetoothManager.shared.disconnect() BluetoothManager.shared.forgetPeripheral() self?.unbindClosure?() // self?.navigationController?.popViewController(animated: true) let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "UnbindRemindVC") self?.navigationController?.pushViewController(vc, animated: true) // self?.updateConnectView(false) } let cancel = UIAlertAction(title: LocString("取消"), style: .default, handler: nil) alertVC.addAction(cancel) alertVC.addAction(confirm) present(alertVC, animated: true, completion: nil) } // /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }