123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- //
- // SInfoAndSecurityViewController.swift
- // O2Platform
- //
- // Created by 刘振兴 on 2016/10/17.
- // Copyright © 2016年 zoneland. All rights reserved.
- //
- import UIKit
- import Eureka
- class SInfoAndSecurityViewController: FormViewController {
- var bioType = O2BiometryType.None
- var typeTitle = "生物识别登录"
- var typeValue = "功能不可用"
- override func viewDidLoad() {
- super.viewDidLoad()
-
- let account = O2AuthSDK.shared.myInfo()
-
- LabelRow.defaultCellUpdate = {
- cell,row in
- cell.textLabel?.font = setting_content_textFont
- cell.textLabel?.textColor = setting_content_textColor
- cell.detailTextLabel?.font = setting_value_textFont
- cell.detailTextLabel?.textColor = setting_value_textColor
- cell.accessoryType = .disclosureIndicator
- }
-
-
- if O2IsConnect2Collect {
- let unit = O2AuthSDK.shared.bindUnit()
- form +++ Section()
- <<< LabelRow(){
- $0.title = "绑定服务器"
- $0.value = unit?.name
- }.cellUpdate({ (cell, row) in
- cell.accessoryType = .none
- })
- }
-
- form +++ Section()
- <<< LabelRow(){
- $0.title = "登录帐号"
- $0.value = account?.name
- }.cellUpdate({ (cell, row) in
- cell.accessoryType = .none
- })
- <<< LabelRow(){
- $0.title = "登录密码"
- $0.value = "修改密码"
- }.onCellSelection({ (cell,row) in
- self.performSegue(withIdentifier: "showPassworChangeSegue", sender: nil)
- })
- form +++ Section()
- <<< LabelRow("bioAuthRow"){
- $0.title = typeTitle
- $0.value = typeValue
- }.onCellSelection({ (cell, row) in
- if self.bioType != O2BiometryType.None {
- self.performSegue(withIdentifier: "showAccountSecSegue", sender: nil)
- }else {
- self.showError(title: "手机系统未开启或不支持识别功能")
- }
- })
-
-
-
- if O2IsConnect2Collect {
- let mobile = O2AuthSDK.shared.bindDevice()?.mobile
- form +++ Section()
- <<< LabelRow() {
- $0.title = "变更手机号码"
- $0.value = mobile
- }.onCellSelection({ (cell,row) in
- self.performSegue(withIdentifier: "showMobileChangeSegue", sender: nil)
- })
-
- form +++ Section()
- <<< LabelRow() {
- $0.title = "设备"
- $0.value = "常用设备管理"
-
- }.onCellSelection({ (cell, row) in
- self.performSegue(withIdentifier: "showDeviceListSegue", sender: nil)
- })
- }
- }
-
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- // 显示的时候刷新数据
- self.checkBioType()
- let authRow = self.form.rowBy(tag: "bioAuthRow") as? LabelRow
- authRow?.title = typeTitle
- authRow?.value = typeValue
- authRow?.updateCell()
- }
-
- private func checkBioType() {
- let bioAuthUser = AppConfigSettings.shared.bioAuthUser
- var isAuthed = false
- //判断是否当前绑定的服务器的
- if !bioAuthUser.isBlank {
- let array = bioAuthUser.split("^^")
- if array.count == 2 {
- if array[0] == O2AuthSDK.shared.bindUnit()?.id {
- isAuthed = true
- }
- }
- }
- bioType = O2BioLocalAuth.shared.checkBiometryType()
-
- switch bioType {
- case O2BiometryType.FaceID:
- typeTitle = "人脸识别登录"
- typeValue = (isAuthed ? "已开启":"未开启")
- break
- case O2BiometryType.TouchID:
- typeTitle = "指纹识别登录"
- typeValue = (isAuthed ? "已开启":"未开启")
- break
- case O2BiometryType.None:
- typeTitle = "生物识别登录"
- typeValue = "功能不可用"
- break
- }
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
-
- }
|