SInfoAndSecurityViewController.swift 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // SInfoAndSecurityViewController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2016/10/17.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import Eureka
  10. import O2OA_Auth_SDK
  11. class SInfoAndSecurityViewController: FormViewController {
  12. var bioType = O2BiometryType.None
  13. var typeTitle = "生物识别登录"
  14. var typeValue = "功能不可用"
  15. override func viewDidLoad() {
  16. super.viewDidLoad()
  17. let account = O2AuthSDK.shared.myInfo()
  18. LabelRow.defaultCellUpdate = {
  19. cell,row in
  20. cell.textLabel?.font = setting_content_textFont
  21. cell.textLabel?.textColor = setting_content_textColor
  22. cell.detailTextLabel?.font = setting_value_textFont
  23. cell.detailTextLabel?.textColor = setting_value_textColor
  24. cell.accessoryType = .disclosureIndicator
  25. }
  26. form +++ Section()
  27. <<< LabelRow(){
  28. $0.title = "登录帐号"
  29. $0.value = account?.name
  30. }
  31. <<< LabelRow(){
  32. $0.title = "登录密码"
  33. $0.value = "修改密码"
  34. }.onCellSelection({ (cell,row) in
  35. self.performSegue(withIdentifier: "showPassworChangeSegue", sender: nil)
  36. })
  37. form +++ Section()
  38. <<< LabelRow("bioAuthRow"){
  39. $0.title = typeTitle
  40. $0.value = typeValue
  41. }.onCellSelection({ (cell, row) in
  42. if self.bioType != O2BiometryType.None {
  43. self.performSegue(withIdentifier: "showAccountSecSegue", sender: nil)
  44. }else {
  45. self.showError(title: "手机系统未开启或不支持识别功能")
  46. }
  47. })
  48. if O2IsConnect2Collect {
  49. let mobile = O2AuthSDK.shared.bindDevice()?.mobile
  50. form +++ Section()
  51. <<< LabelRow() {
  52. $0.title = "变更手机号码"
  53. $0.value = mobile
  54. }.onCellSelection({ (cell,row) in
  55. self.performSegue(withIdentifier: "showMobileChangeSegue", sender: nil)
  56. })
  57. }
  58. }
  59. override func viewWillAppear(_ animated: Bool) {
  60. super.viewWillAppear(animated)
  61. // 显示的时候刷新数据
  62. self.checkBioType()
  63. let authRow = self.form.rowBy(tag: "bioAuthRow") as? LabelRow
  64. authRow?.title = typeTitle
  65. authRow?.value = typeValue
  66. authRow?.updateCell()
  67. }
  68. private func checkBioType() {
  69. let bioAuthUser = AppConfigSettings.shared.bioAuthUser
  70. bioType = O2BioLocalAuth.shared.checkBiometryType()
  71. switch bioType {
  72. case O2BiometryType.FaceID:
  73. typeTitle = "人脸识别登录"
  74. typeValue = (bioAuthUser.isEmpty == true ? "未开启":"已开启")
  75. break
  76. case O2BiometryType.TouchID:
  77. typeTitle = "指纹识别登录"
  78. typeValue = (bioAuthUser.isEmpty == true ? "未开启":"已开启")
  79. break
  80. case O2BiometryType.None:
  81. typeTitle = "生物识别登录"
  82. typeValue = "功能不可用"
  83. break
  84. }
  85. }
  86. override func didReceiveMemoryWarning() {
  87. super.didReceiveMemoryWarning()
  88. // Dispose of any resources that can be recreated.
  89. }
  90. }