AccountManager.swift 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // AccountManager.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by User-Tangchao on 2024/11/1.
  6. //
  7. import Cocoa
  8. @objcMembers class AccountManager: NSObject {
  9. static let manager = AccountManager()
  10. var isLogin = false
  11. var isVip = false
  12. var hasAiPermissions = false
  13. var aiBuyUrl: String?
  14. // 是否适用中
  15. var isTrialing = false
  16. var canUseAdvanceFlag = false
  17. func saveRights(model: AccountRightModel?) {
  18. if let data = model {
  19. self.isLogin = true
  20. self.isVip = data.isVip == 1
  21. self.hasAiPermissions = data.hasAiPermissions == 1
  22. self.aiBuyUrl = data.aiBuyUrl
  23. self.isTrialing = data.trialData?.status == 1
  24. } else {
  25. self.isLogin = false
  26. self.isVip = false
  27. self.hasAiPermissions = false
  28. self.aiBuyUrl = nil
  29. self.isTrialing = false
  30. }
  31. }
  32. }