SMobileChangeViewController.swift 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // SMobileChangeViewController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2016/10/17.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import Alamofire
  10. import AlamofireImage
  11. import AlamofireObjectMapper
  12. import ObjectMapper
  13. import CocoaLumberjack
  14. class SMobileChangeViewController: UIViewController {
  15. @IBOutlet weak var modifyButton: UIButton!
  16. @IBOutlet weak var phoneNumberLabel: UILabel!
  17. override func awakeFromNib() {
  18. }
  19. override func viewDidLoad() {
  20. super.viewDidLoad()
  21. let mobile = O2AuthSDK.shared.bindDevice()?.mobile
  22. self.phoneNumberLabel.text = mobile
  23. self.modifyButton.layer.borderWidth = 1.0
  24. self.modifyButton.layer.cornerRadius = 20
  25. self.modifyButton.layer.masksToBounds = true
  26. self.modifyButton.layer.borderColor = base_color.cgColor
  27. self.modifyButton.theme_setTitleColor(ThemeColorPicker(keyPath: "Base.base_color"), forState: .normal)
  28. }
  29. override func didReceiveMemoryWarning() {
  30. super.didReceiveMemoryWarning()
  31. // Dispose of any resources that can be recreated.
  32. }
  33. @IBAction func modifyMobileAction(_ sender: UIButton) {
  34. self.showDefaultConfirm(title: "确认提示", message: "确定要解绑当前手机号码,解绑后需要重新绑定服务器后才能继续使用?") { (action) in
  35. let deviceId = O2AuthSDK.shared.bindDevice()?.name ?? ""
  36. O2AuthSDK.shared.unBindFromCollect(deviceId: deviceId, callback: { (result, error) in
  37. DDLogDebug("unbind callback result:\(result) , error:\(error ?? "")")
  38. O2AuthSDK.shared.clearAllInformationBeforeReBind(callback: { (result, msg) in
  39. DDLogInfo("清空登录和绑定信息,result:\(result), msg:\(msg ?? "")")
  40. DBManager.shared.removeAll()
  41. DispatchQueue.main.async {
  42. self.forwardDestVC("login", "bindVC")
  43. }
  44. })
  45. })
  46. }
  47. }
  48. }