Blame view

Twear/Setting/UnbindViewController.swift 1.97 KB
75d24c15   yangbin   123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  //
  //  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?()
582f536d   yangbin   common:2022.1.28
35
36
37
38
  //            self?.navigationController?.popViewController(animated: true)
              
              let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "UnbindRemindVC")
              self?.navigationController?.pushViewController(vc, animated: true)
75d24c15   yangbin   123
39
40
41
42
43
44
45
  //            self?.updateConnectView(false)
          }
          let cancel = UIAlertAction(title: LocString("取消"), style: .default, handler: nil)
          alertVC.addAction(cancel)
          alertVC.addAction(confirm)
          present(alertVC, animated: true, completion: nil)
      }
582f536d   yangbin   common:2022.1.28
46
  //
75d24c15   yangbin   123
47
48
49
50
51
52
53
54
55
56
57
      /*
      // 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.
      }
      */
  
  }