KMCloseAccountWC.swift 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // KMCloseAccountWC.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/11/5.
  6. //
  7. import Cocoa
  8. class KMCloseAccountWC: NSWindowController {
  9. @IBOutlet weak var titleLabel: NSTextField!
  10. @IBOutlet weak var subTitleLabel: NSTextField!
  11. @IBOutlet weak var productBox: NSBox!
  12. @IBOutlet weak var productView: NSView!
  13. @IBOutlet weak var productLabel: NSTextField!
  14. @IBOutlet weak var proView: NSView!
  15. @IBOutlet weak var proLabel: NSTextField!
  16. @IBOutlet weak var aiView: NSView!
  17. @IBOutlet weak var aiLabel: NSTextField!
  18. @IBOutlet weak var yesButton: NSButton!
  19. @IBOutlet weak var cancelButton: NSButton!
  20. private var viewModel = KMUserInfoVCModel()
  21. static let shared: KMCloseAccountWC = {
  22. let windowC = KMCloseAccountWC(windowNibName: "KMCloseAccountWC")
  23. return windowC
  24. }()
  25. override func windowDidLoad() {
  26. super.windowDidLoad()
  27. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  28. // self.window?.backgroundColor = NSColor.gray
  29. languageLocalized()
  30. initializeUI()
  31. }
  32. // MARK: Private Method
  33. private func languageLocalized() -> Void {
  34. titleLabel.stringValue = NSLocalizedString("删除您的账号和相关授权", tableName: "MemberCenterLocalizable", comment: "")
  35. subTitleLabel.stringValue = NSLocalizedString("注销账号会永久删除一切账号数据,包括您在此账号下购买的其他端的PDF Reader Pro的权益。您确定要继续吗?", tableName: "MemberCenterLocalizable", comment: "")
  36. productLabel.stringValue = NSLocalizedString("您的产品与服务:", tableName: "MemberCenterLocalizable", comment: "")
  37. proLabel.stringValue = KMMemberInfo.shared.vip_productName
  38. aiLabel.stringValue = KMMemberInfo.shared.ai_productName
  39. cancelButton.title = NSLocalizedString("取消", tableName: "MemberCenterLocalizable", comment: "")
  40. yesButton.title = NSLocalizedString("删除我的账户", tableName: "MemberCenterLocalizable", comment: "")
  41. }
  42. private func initializeUI() -> Void {
  43. titleLabel.textColor = NSColor(named: "000000_0.85")
  44. titleLabel.font = NSFont.SFProTextSemiboldFont(13)
  45. subTitleLabel.textColor = NSColor(named: "000000_0.85")
  46. subTitleLabel.font = NSFont.SFProTextRegularFont(12)
  47. productBox.borderColor = NSColor(named: "DADBDE") ?? .gray
  48. productBox.fillColor = .gray
  49. productLabel.textColor = NSColor(named: "42464D")
  50. productLabel.font = NSFont.SFProTextRegularFont(13)
  51. if KMMemberInfo.shared.ai_productName == "" {
  52. aiView.isHidden = true
  53. }
  54. aiLabel.textColor = NSColor(named: "42464D")
  55. aiLabel.font = NSFont.SFProTextRegularFont(13)
  56. yesButton.setTitleColor(color: NSColor(named: "000000") ?? NSColor.white, font: NSFont.SFProTextRegularFont(13))
  57. cancelButton.setTitleColor(color: NSColor(named: "FFFFFF") ?? NSColor.white, font: NSFont.SFProTextRegularFont(13))
  58. }
  59. // MARK: Button Action
  60. @IBAction func cancelButtonAction(_ sender: NSButton) {
  61. self.window?.close()
  62. }
  63. @IBAction func yesButtonAction(_ sender: NSButton) {
  64. self.window?.close()
  65. viewModel.deleteAccountWC()
  66. }
  67. }