O2WebConfig.swift 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // O2WebConfig.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2022/1/30.
  6. // Copyright © 2022 zoneland. All rights reserved.
  7. //
  8. import HandyJSON
  9. open class O2WebConfig: NSObject, HandyJSON , NSCoding {
  10. // im聊天配置
  11. open var imConfig: IMConfig?
  12. // token名称
  13. @objc open var tokenName: String?
  14. // 语言 如:zh-CN
  15. @objc open var language: String?
  16. public func encode(with aCoder: NSCoder) {
  17. if tokenName != nil {
  18. aCoder.encode(tokenName, forKey: "tokenName")
  19. }
  20. if language != nil {
  21. aCoder.encode(language, forKey: "language")
  22. }
  23. if imConfig != nil {
  24. aCoder.encode(imConfig, forKey: "imConfig")
  25. }
  26. }
  27. public required init?(coder aDecoder: NSCoder) {
  28. imConfig = aDecoder.decodeObject(forKey: "imConfig") as? IMConfig
  29. language = aDecoder.decodeObject(forKey: "language") as? String
  30. tokenName = aDecoder.decodeObject(forKey: "tokenName") as? String
  31. }
  32. required public override init() {}
  33. open override var description: String {
  34. return toJSONString(prettyPrint: true) ?? ""
  35. }
  36. }