Blame view

HDFwear/Setting/UnbindViewController.swift 2.94 KB
f2cf74c7   yangbin   1.0.20(4)
1
2
3
4
5
6
7
8
9
10
11
  //
  //  UnbindViewController.swift
  //  Twear
  //
  //  Created by yangbin on 2022/1/4.
  //
  
  import UIKit
  
  class UnbindViewController: UIViewController {
  
b92bf3ed   daifengyi   feat:language pag...
12
13
14
  //    @IBOutlet weak var nameLabel: UILabel!
  //    @IBOutlet weak var macLabel: UILabel!
  //    @IBOutlet weak var batteryLabel: UILabel!
f2cf74c7   yangbin   1.0.20(4)
15
16
17
18
19
20
21
22
23
24
25
26
27
28
      
      @IBOutlet weak var watchImageView: UIImageView!
      var unbindClosure: (() -> ())?
      
      let device = CurDevice
      
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
          self.navigationController?.setNavigationBarHidden(false, animated: true)
      }
      
      override func viewDidLoad() {
          super.viewDidLoad()
          title = LocString("解绑设备")
b92bf3ed   daifengyi   feat:language pag...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  //        nameLabel.text = device.name
  //        macLabel.text = "mac:\(device.mac)"
  //        if DeviceIsCharging {
  //            batteryLabel.text = "\(LocString("充电中")):\(Battery)%"
  //        } else {
  //            batteryLabel.text = "\(LocString("电量")):\(Battery)%"
  //        }
  //       
  //        
  //        if device.name.contains("P8GT") {
  //            watchImageView.image = UIImage(named: "P8GT_icon")
  //        } else if device.name.contains("Watch 8") {
  //            watchImageView.image = UIImage(named: "Watch7_icon")
  //        } else if device.name.contains("S7 NO.1") {
  //            watchImageView.image = UIImage(named: "S7_NO.1_icon")
  //        } else if device.name.contains("hq7") {
  //            watchImageView.image = UIImage(named: "hq7_icon")
  //        } else {
  //            watchImageView.image = UIImage(named: "bracelet_icon")
  //        }
f2cf74c7   yangbin   1.0.20(4)
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
          // 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.
      }
      */
  
  }