Blame view

HDFwear/Mine/MineViewController.swift 25.8 KB
f2cf74c7   yangbin   1.0.20(4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  //
  //  MineViewController.swift
  //  Twear
  //
  //  Created by yangbin on 2021/12/18.
  //
  
  import UIKit
  import MBProgressHUD
  import Alamofire
  import HandyJSON
  
  class MineViewController: UIViewController {
  
      @IBOutlet weak var tableView: UITableView!
      @IBOutlet weak var avatarImageView: UIImageView!
      @IBOutlet weak var idLabel: UILabel!
      @IBOutlet weak var nameLabel: UILabel!
      
875b68b4   daifengyi   feat:mine page UI
20
21
22
23
24
25
26
27
28
  //    @IBOutlet weak var medalNumLabel: UILabel!
  //    @IBOutlet weak var medalImageView1: UIImageView!
  //    @IBOutlet weak var medalImageView2: UIImageView!
  //    @IBOutlet weak var medalImageView3: UIImageView!
  //    @IBOutlet weak var medalImageView4: UIImageView!
  //    @IBOutlet weak var medalImageView5: UIImageView!
  //    @IBOutlet weak var locLabel1: UILabel!
      private let mineArray = ["健康报告", "我的数据", "个人资料", "隐私政策", "APP升级", "关于"]
      private let mineDic = ["健康报告": "health_report", "我的数据": "mine_data", "个人资料": "personal_info", "设置": "mine_setting", "APP升级": "app_update", "关于": "mine_about", "隐私政策": "privacy_policy"]
f2cf74c7   yangbin   1.0.20(4)
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
      
      private let user = UserInfo
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
          self.navigationController?.setNavigationBarHidden(false, animated: true)
      }
      
      override func viewDidLoad() {
          super.viewDidLoad()
          setupUI()
  
  
      }
      
      private func setupUI() {
          let leftButton = UIButton(frame: CGRect(x: 0, y: 0, width: 40, height: 28))
          leftButton.setTitle(LocString("我的"), for: .normal)
          leftButton.titleLabel?.font = BoldFont(18)
          leftButton.setTitleColor(.black, for: .normal)
          navigationItem.leftBarButtonItem = UIBarButtonItem(customView: leftButton)
          
          tableView.bounces = false
          
          if let image = UIImage.getImageFromPath("avatar") {
              avatarImageView.image = image
          } else {
              avatarImageView.image = UIImage(named: user.gender == 1 ? "avatar_male" : "avatar_female")
          }
          
          if user.name == "" {
f2624318   daifengyi   feat:rename throu...
60
              nameLabel.text = "YTWatch"//"\(LocString("用户"))\(user.userId)"
f2cf74c7   yangbin   1.0.20(4)
61
62
63
64
          } else {
              nameLabel.text = user.name
          }
          
875b68b4   daifengyi   feat:mine page UI
65
          idLabel.text = "\(user.gender == 1 ? "男" : "女") \(user.height)cm"
f2cf74c7   yangbin   1.0.20(4)
66
          
875b68b4   daifengyi   feat:mine page UI
67
  //        locLabel1.text = LocString("我的勋章")
f2cf74c7   yangbin   1.0.20(4)
68
          
875b68b4   daifengyi   feat:mine page UI
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  //        var medalArray = ["单日10000步灰", "单日10000步灰", "单日10000步灰", "累计5万步灰", "累计10万步灰"]
  //        var medalNum: Int = 0
  //        if let array = RealmTools.objectsWithPredicateAndSorted(object: MedalModel.self, predicate: NSPredicate(format: "date != nil"), sortedKey: "date") as? Array<MedalModel>, array.count > 0 {
  //            medalNum = array.count
  //            for medal in array {
  //                medalArray.insert(medal.title, at: 0)
  //            }
  //        }
  //        medalNumLabel.text = LocString("共1") + "\(medalNum)" + LocString("枚1")
  //        medalImageView1.image = UIImage(named: medalArray[0])
  //        medalImageView2.image = UIImage(named: medalArray[1])
  //        medalImageView3.image = UIImage(named: medalArray[2])
  //        medalImageView4.image = UIImage(named: medalArray[3])
  //        medalImageView5.image = UIImage(named: medalArray[4])
f2cf74c7   yangbin   1.0.20(4)
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
        
      }
      
      @IBAction func setUserInfo(_ sender: Any) {
          let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "UserInfoSettingVC") as! UserInfoSettingVC
          vc.modifyClosure = {[weak self] name, image in
              if image != nil {
                  self?.avatarImageView.image = image
              }
              if name != "" {
                  self?.nameLabel.text = name
              }
              
          }
          navigationController?.pushViewController(vc, animated: true)
      }
      
      @IBAction func gotoMedalVC(_ sender: Any) {
          let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "MedalViewController") as! MedalViewController
          navigationController?.pushViewController(vc, animated: true)
      }
      
      func checkAppVersion() {
          MBProgressHUD.showLoading(LocString("正在拼命加载..."), icon: "loading_icon")
          let infoDictionary : Dictionary = Bundle.main.infoDictionary!
          let curVersion = infoDictionary["CFBundleShortVersionString"] as? String
          let path = "https://itunes.apple.com/cn/lookup?id=1601611643"//
          var version: String = ""
          Alamofire.request(path, method: .post).response { (responseObj) in
              if responseObj.error == nil {
                  let dic:Dictionary = try! JSONSerialization.jsonObject(with: responseObj.data!, options: JSONSerialization.ReadingOptions.mutableContainers) as! Dictionary<String,Any>
                  if  dic["resultCount"] as! Int > 0{
                      let results:Array = dic["results"] as! Array<Any>
                      if results.count > 0 {
                          let resultsDic: Dictionary = results.first as! Dictionary<String,Any>
                          version = resultsDic["version"] as! String
  //                        let size = resultsDic["fileSizeBytes"] as! Int
                          let releaseNotes = resultsDic["releaseNotes"] as? String ?? "   "
                          let trackViewUrl = resultsDic["trackViewUrl"] as! String
                          if curVersion!.checkVersion(version) { //发现新版本
                              MBProgressHUD.hide()
                              let updateView = AppVersionView(version: version, detail: releaseNotes)
                              updateView.clickClosure = { [weak self] in
                                  self?.gotoAppStore(trackViewUrl)
                              }
                              
                              updateView.show()
                          } else {
                              MBProgressHUD.hide()
                              MBProgressHUD.showh(LocString("当前已是最新版本"))
                          }
                      }
                  }
              }
          }
      }
      
  
      
      
      func gotoAppStore(_ urlString: String) {
          let updateUrl: URL = URL(string: urlString)!
          if #available(iOS 10.0, *) {
              UIApplication.shared.open(updateUrl, options: [:], completionHandler: nil)
          } else {
              UIApplication.shared.openURL(updateUrl)
          }
      }
      
      deinit {
          print("deinit\(NSStringFromClass(type(of: self)))!!!!!!!")
      }
  
  }
  
  
  extension MineViewController: UITableViewDataSource, UITableViewDelegate {
      func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
875b68b4   daifengyi   feat:mine page UI
161
          return 62
f2cf74c7   yangbin   1.0.20(4)
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
      }
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
          return mineArray.count
      }
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "MineCell", for: indexPath) as! MineCell
          cell.label.text = LocString(mineArray[indexPath.row])
          cell.setImageView.image = UIImage(named: mineDic[mineArray[indexPath.row]]!)
          if indexPath.row == mineArray.count-1 {
              cell.lineView.isHidden = true
          }
          return cell
      }
      
      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          switch mineArray[indexPath.row] {
875b68b4   daifengyi   feat:mine page UI
178
          case "APP升级":
f2cf74c7   yangbin   1.0.20(4)
179
180
181
182
183
184
185
186
187
              checkAppVersion()
          case "个人资料":
              let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "UserInfoSettingVC") as! UserInfoSettingVC
              vc.modifyClosure = {[weak self] name, image in
                  self?.avatarImageView.image = image
                  self?.nameLabel.text = name
              }
              navigationController?.pushViewController(vc, animated: true)
          case "关于":
156c1ec4   daifengyi   feat:debug alert
188
189
190
191
              //jtd!
  //            let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "AboutAppVC")
  //            navigationController?.pushViewController(vc, animated: true)
              let alert = UIAlertController(title: "plz select", message: nil, preferredStyle: .actionSheet)
66e40f13   jason   feat: blood oxyge...
192
193
194
195
196
              
              let archiveAction0 = UIAlertAction(title: "Fetch Date", style: .default) { action in
                  self.fetchDataAlert()
              }
              
156c1ec4   daifengyi   feat:debug alert
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
              let archiveAction1 = UIAlertAction(title: "newSetTouchSense", style: .default) { action in
                  BluetoothManager.shared.newSetTouchSense(bool: true) { error in
                      if error != nil {
                          print("newSetTouchSense" + (error?.description ?? "") )
                      }else {
                          print("newSetTouchSense success")
                      }
                  }
              }
              let archiveAction2 = UIAlertAction(title: "newSetLowPowerRemind", style: .default) { action in
                  BluetoothManager.shared.newSetLowPowerRemind(bool: true) { error in
                      if error != nil {
                          print("newSetLowPowerRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetLowPowerRemind success")
                      }
                  }
              }
              let archiveAction3 = UIAlertAction(title: "newSetRestore", style: .default) { action in
                  BluetoothManager.shared.newSetRestore() { error in
                      if error != nil {
                          print("newSetRestore" + (error?.description ?? ""))
                      }else {
                          print("newSetRestore success")
                      }
                  }
              }
              let archiveAction4 = UIAlertAction(title: "newSetHeartRateHighRemind", style: .default) { action in
                  BluetoothManager.shared.newSetHeartRateHighRemind(maxHr: 120) { error in
                      if error != nil {
                          print("newSetHeartRateHighRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetHeartRateHighRemind success")
                      }
                  }
              }
              let archiveAction5 = UIAlertAction(title: "newSetHeartRateLowRemind", style: .default) { action in
                  BluetoothManager.shared.newSetHeartRateLowRemind(minHr: 120) { error in
                      if error != nil {
                          print("newSetHeartRateLowRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetHeartRateLowRemind success")
                      }
                  }
              }
              let archiveAction6 = UIAlertAction(title: "newSetPressureAutoDetect", style: .default) { action in
                  BluetoothManager.shared.newSetPressureAutoDetect(bool: true) { error in
                      if error != nil {
                          print("newSetPressureAutoDetect" + (error?.description ?? ""))
                      }else {
                          print("newSetPressureAutoDetect success")
                      }
                  }
              }
              let archiveAction7 = UIAlertAction(title: "newSetBloodOxygenAutoDetect", style: .default) { action in
                  BluetoothManager.shared.newSetBloodOxygenAutoDetect(bool: true) { error in
                      if error != nil {
                          print("newSetBloodOxygenAutoDetect" + (error?.description ?? ""))
                      }else {
                          print("newSetBloodOxygenAutoDetect success")
                      }
                  }
              }
              let archiveAction8 = UIAlertAction(title: "newSetUserInfo", style: .default) { action in
                  BluetoothManager.shared.newSetUserInfo(AdminHelper.shared.loadLocalAdminData().userInfo) { error in
                      if error != nil {
                          print("newSetUserInfo" + (error?.description ?? ""))
                      }else {
                          print("newSetUserInfo success")
                      }
                  }
              }
156c1ec4   daifengyi   feat:debug alert
269
              
69e5b680   daifengyi   feat:query device...
270
271
272
273
274
275
276
277
278
279
              let archiveAction11 = UIAlertAction(title: "queryDeviceInfo", style: .default) { action in
                  BluetoothManager.shared.queryDeviceInfo(queryItems: [0x02,0x03]) { error in
                      if error != nil {
                          print("queryDeviceInfo" + (error?.description ?? ""))
                      }else {
                          print("queryDeviceInfo success")
                      }
                  }
              }
              
949f38df   daifengyi   feat:not disturb
280
              let archiveAction12 = UIAlertAction(title: "newSetNotDisturb", style: .default) { action in
c500670f   jason   feat:setNotDistur...
281
                  BluetoothManager.shared.newSetNotDisturb(remind: CurDevice.disturb) { error in
949f38df   daifengyi   feat:not disturb
282
283
284
285
286
287
288
289
                      if error != nil {
                          print("newSetNotDisturb" + (error?.description ?? ""))
                      }else {
                          print("newSetNotDisturb success")
                      }
                  }
              }
              
f13858d1   daifengyi   feat:read me
290
291
292
293
294
295
296
297
298
299
              let archiveAction13 = UIAlertAction(title: "newSetFindWatch", style: .default) { action in
                  BluetoothManager.shared.newSetFindWatch(bool: true) { error in
                      if error != nil {
                          print("newSetFindWatch" + (error?.description ?? ""))
                      }else {
                          print("newSetFindWatch success")
                      }
                  }
              }
              
9b19e727   jason   feat:new set time...
300
301
302
303
304
305
306
307
308
              let archiveAction18 = UIAlertAction(title: "newSetTime", style: .default) { action in
                  BluetoothManager.shared.newSetTime { error in
                      if error != nil {
                          print("newSetTime" + (error?.description ?? ""))
                      }else {
                          print("newSetTime success")
                      }
                  }
              }
f13858d1   daifengyi   feat:read me
309
              
b05829d0   jason   feat:set weather
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
              let archiveAction19 = UIAlertAction(title: "newSetWeather", style: .default) { action in
                  let next5day = [NewNextWeatherModel(highestTemperature: 21, lowestTemperature: 11, type: .sunny),
                                  NewNextWeatherModel(highestTemperature: 22, lowestTemperature: 12, type: .sunny),
                                  NewNextWeatherModel(highestTemperature: 23, lowestTemperature: 13, type: .sunny),
                                  NewNextWeatherModel(highestTemperature: 24, lowestTemperature: 14, type: .sunny),
                                  NewNextWeatherModel(highestTemperature: 25, lowestTemperature: 15, type: .sunny)
                  ]
                  let weather = NewWeatherModel(currentTemperature: 18, highestTemperature: 20, lowestTemperature: 10, type: .cloudy, airQuality: .moderate, humidity: 3, wind: .northeast, windForce: 4, next5Days: next5day, position: "长沙")
                  BluetoothManager.shared.newSetWeather(weather: weather) { error in
                      if error != nil {
                          print("newSetWeather" + (error?.description ?? ""))
                      }else {
                          print("newSetWeather success")
                      }
                  }
              }
              
9b1c370b   jason   feat:beidou
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
              let archiveAction20 = UIAlertAction(title: "newSetBeiDouContact", style: .default) { action in
                  let contacts = [NewBeiDouContactModel(name: "周杰伦", phone: "18974960001", type: .emergency),
                                  NewBeiDouContactModel(name: "梁朝伟", phone: "18974960002", type: .general),
                                  NewBeiDouContactModel(name: "吴彦祖", phone: "18974960003", type: .emergency),
                                  NewBeiDouContactModel(name: "成龙", phone: "18974960004", type: .general)]
                  BluetoothManager.shared.newSetBeiDouContact(contacts: contacts) { error in
                      if error != nil {
                          print("newSetBeiDouContact" + (error?.description ?? ""))
                      }else {
                          print("newSetBeiDouContact success")
                      }
                  }
              }
              
              let archiveAction21 = UIAlertAction(title: "newSetBeiDouQuickAnswer", style: .default) { action in
                  BluetoothManager.shared.newSetBeiDouQuickAnswer(answers: ["北斗"]) { error in
                      if error != nil {
                          print("newSetBeiDouQuickAnswer" + (error?.description ?? ""))
                      }else {
                          print("newSetBeiDouQuickAnswer success")
                      }
                  }
              }
              
c7f49054   jason   feat: rest & exer...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
              let archiveAction23 = UIAlertAction(title: "newSetRestHeartRateRemind", style: .default) { action in
                  BluetoothManager.shared.newSetRestHeartRateRemind(bool: true, minHr: 60, maxHr: 90) { error in
                      if error != nil {
                          print("newSetRestHeartRateRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetRestHeartRateRemind success")
                      }
                  }
              }
              
              let archiveAction24 = UIAlertAction(title: "newSetExerciseHeartRateRemind", style: .default) { action in
                  BluetoothManager.shared.newSetExerciseHeartRateRemind(bool: true, minHr: 110, maxHr: 150) { error in
                      if error != nil {
                          print("newSetExerciseHeartRateRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetExerciseHeartRateRemind success")
                      }
                  }
              }
              
03cac185   jason   feat:heart rate d...
371
372
373
374
375
376
377
378
379
380
              let archiveAction25 = UIAlertAction(title: "newSetHeartRateDetectInterval", style: .default) { action in
                  BluetoothManager.shared.newSetHeartRateDetectInterval(bool: true, interval: 18) { error in
                      if error != nil {
                          print("newSetHeartRateDetectInterval" + (error?.description ?? ""))
                      }else {
                          print("newSetHeartRateDetectInterval success")
                      }
                  }
              }
              
a9f41925   jason   feat:blood oxygen...
381
382
383
384
385
386
387
388
389
390
              let archiveAction26 = UIAlertAction(title: "newSetBloodOxygenLowRemind", style: .default) { action in
                  BluetoothManager.shared.newSetBloodOxygenLowRemind(minBo: 80) { error in
                      if error != nil {
                          print("newSetBloodOxygenLowRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetBloodOxygenLowRemind success")
                      }
                  }
              }
              
5caab734   jason   feat:message remind
391
392
393
394
395
396
397
398
399
              let archiveAction27 = UIAlertAction(title: "newSetMessageRemind", style: .default) { action in
                  BluetoothManager.shared.newSetMessageRemind(enable: true, system: true, wechat: false, qq: false) { error in
                      if error != nil {
                          print("newSetMessageRemind" + (error?.description ?? ""))
                      }else {
                          print("newSetMessageRemind success")
                      }
                  }
              }
a9f41925   jason   feat:blood oxygen...
400
              
66e40f13   jason   feat: blood oxyge...
401
              alert.addAction(archiveAction0)
156c1ec4   daifengyi   feat:debug alert
402
403
404
405
406
407
408
409
              alert.addAction(archiveAction1)
              alert.addAction(archiveAction2)
              alert.addAction(archiveAction3)
              alert.addAction(archiveAction4)
              alert.addAction(archiveAction5)
              alert.addAction(archiveAction6)
              alert.addAction(archiveAction7)
              alert.addAction(archiveAction8)
66e40f13   jason   feat: blood oxyge...
410
              
69e5b680   daifengyi   feat:query device...
411
              alert.addAction(archiveAction11)
949f38df   daifengyi   feat:not disturb
412
              alert.addAction(archiveAction12)
f13858d1   daifengyi   feat:read me
413
              alert.addAction(archiveAction13)
66e40f13   jason   feat: blood oxyge...
414
  
9b19e727   jason   feat:new set time...
415
              alert.addAction(archiveAction18)
b05829d0   jason   feat:set weather
416
              alert.addAction(archiveAction19)
9b1c370b   jason   feat:beidou
417
418
              alert.addAction(archiveAction20)
              alert.addAction(archiveAction21)
66e40f13   jason   feat: blood oxyge...
419
              
c7f49054   jason   feat: rest & exer...
420
421
              alert.addAction(archiveAction23)
              alert.addAction(archiveAction24)
03cac185   jason   feat:heart rate d...
422
              alert.addAction(archiveAction25)
a9f41925   jason   feat:blood oxygen...
423
              alert.addAction(archiveAction26)
5caab734   jason   feat:message remind
424
              alert.addAction(archiveAction27)
9b1c370b   jason   feat:beidou
425
              
c7f49054   jason   feat: rest & exer...
426
              alert.addAction(UIAlertAction(title: "取消", style: .destructive, handler: nil))
156c1ec4   daifengyi   feat:debug alert
427
              present(alert, animated: true, completion: nil)
f2cf74c7   yangbin   1.0.20(4)
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
          case "我的数据":
              let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "HealthDataVC")
              navigationController?.pushViewController(vc, animated: true)
          case "健康报告":
              let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "HealthReportVC")
              navigationController?.pushViewController(vc, animated: true)
          case "隐私政策":
              let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Mine", identifier: "PrivacyViewController")
              navigationController?.pushViewController(vc, animated: true)
              
          default:
              break
          }
      }
      
66e40f13   jason   feat: blood oxyge...
443
444
445
      func fetchDataAlert () {
          let alert = UIAlertController(title: "plz select fetch type", message: nil, preferredStyle: .actionSheet)
          
cdaa3f52   jason   feat:log alert
446
          let archiveAction9 = UIAlertAction(title: "getSleepHistoryData", style: .default) {[weak self] action in
10c6e004   jason   feat:sleep data
447
              BluetoothManager.shared.getSleepHistoryData(option: .now) { sleepModel, error in
66e40f13   jason   feat: blood oxyge...
448
449
450
                  if error != nil {
                      print("getSleepHistoryData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
451
                      self?.showDetailAlert(msg: sleepModel?.description)
66e40f13   jason   feat: blood oxyge...
452
                      print("getSleepHistoryData success")
66e40f13   jason   feat: blood oxyge...
453
454
455
                  }
              }
          }
cdaa3f52   jason   feat:log alert
456
          let archiveAction10 = UIAlertAction(title: "getBloodOxygenHistoryData", style: .default) {[weak self] action in
66e40f13   jason   feat: blood oxyge...
457
458
459
460
              BluetoothManager.shared.getBloodOxygenHistoryData() { boArray, error in
                  if error != nil {
                      print("getBloodOxygenHistoryData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
461
                      self?.showDetailAlert(msg: boArray.description)
66e40f13   jason   feat: blood oxyge...
462
463
464
465
466
                      print("getBloodOxygenHistoryData success")
                  }
              }
          }
          
cdaa3f52   jason   feat:log alert
467
468
          let archiveAction14 = UIAlertAction(title: "getHeartRateHistoryData", style: .default) {[weak self] action in
              BluetoothManager.shared.getHeartRateHistoryData() { hrArray, error in
66e40f13   jason   feat: blood oxyge...
469
470
471
                  if error != nil {
                      print("getHeartRateHistoryData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
472
                      self?.showDetailAlert(msg: hrArray.description)
66e40f13   jason   feat: blood oxyge...
473
474
475
476
477
                      print("getHeartRateHistoryData success")
                  }
              }
          }
          
cdaa3f52   jason   feat:log alert
478
479
          let archiveAction15 = UIAlertAction(title: "getStepHistoryData", style: .default) {[weak self] action in
              BluetoothManager.shared.getStepHistoryData() { sArray, error in
66e40f13   jason   feat: blood oxyge...
480
481
482
                  if error != nil {
                      print("getStepHistoryData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
483
                      self?.showDetailAlert(msg: sArray.description)
66e40f13   jason   feat: blood oxyge...
484
485
486
487
488
                      print("getStepHistoryData success")
                  }
              }
          }
          
cdaa3f52   jason   feat:log alert
489
490
          let archiveAction16 = UIAlertAction(title: "getTrainHistoryData", style: .default) {[weak self] action in
              BluetoothManager.shared.getTrainHistoryData() { tArray, error in
66e40f13   jason   feat: blood oxyge...
491
492
493
                  if error != nil {
                      print("getTrainHistoryData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
494
                      self?.showDetailAlert(msg: tArray?.description)
66e40f13   jason   feat: blood oxyge...
495
496
497
498
499
                      print("getTrainHistoryData success")
                  }
              }
          }
          
cdaa3f52   jason   feat:log alert
500
501
          let archiveAction17 = UIAlertAction(title: "getPressureHistoryData", style: .default) {[weak self] action in
              BluetoothManager.shared.getPressureHistoryData() { pArray, error in
66e40f13   jason   feat: blood oxyge...
502
503
504
                  if error != nil {
                      print("getPressureHistoryData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
505
                      self?.showDetailAlert(msg: pArray.description)
66e40f13   jason   feat: blood oxyge...
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
                      print("getPressureHistoryData success")
                  }
              }
          }
          
          let archiveAction22 = UIAlertAction(title: "newGetBatteryData", style: .default) { action in
              BluetoothManager.shared.newGetBatteryData { error in
                  if error != nil {
                      print("newGetBatteryData" + (error?.description ?? ""))
                  }else {
                      print("newGetBatteryData success")
                  }
              }
          }
          
cdaa3f52   jason   feat:log alert
521
          let archiveAction101 = UIAlertAction(title: "newGetGpsData", style: .default) {[weak self] action in
1e5d4268   jason   feat:gps
522
              BluetoothManager.shared.newGetGpsData() {gpsModel, error in
66e40f13   jason   feat: blood oxyge...
523
524
525
                  if error != nil {
                      print("newGetGpsData" + (error?.description ?? ""))
                  }else {
cdaa3f52   jason   feat:log alert
526
                      self?.showDetailAlert(msg: gpsModel?.description)
66e40f13   jason   feat: blood oxyge...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
                      print("newGetGpsData success")
                  }
              }
          }
          
          
          alert.addAction(archiveAction9)
          alert.addAction(archiveAction10)
          alert.addAction(archiveAction14)
          alert.addAction(archiveAction15)
          alert.addAction(archiveAction16)
          alert.addAction(archiveAction17)
          alert.addAction(archiveAction22)
          alert.addAction(archiveAction101)
          
          alert.addAction(UIAlertAction(title: "取消", style: .destructive, handler: nil))
          present(alert, animated: true, completion: nil)
      }
      
cdaa3f52   jason   feat:log alert
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
      func showDetailAlert(msg: String? = "") {
          let alert = UIAlertController(title: "info", message: msg, preferredStyle: .alert)
  //        let archiveAction = UIAlertAction(title: "newGetGpsData", style: .default) { action in
  //            BluetoothManager.shared.newGetGpsData() {gpsModel, error in
  //                if error != nil {
  //                    print("newGetGpsData" + (error?.description ?? ""))
  //                }else {
  //                    print("newGetGpsData success")
  //                }
  //            }
  //        }
  //        alert.addAction(archiveAction)
          
          alert.addAction(UIAlertAction(title: "确定", style: .destructive, handler: nil))
          present(alert, animated: true, completion: nil)
      }
f2cf74c7   yangbin   1.0.20(4)
562
  }