KMUserInfoViewController.swift 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. //
  2. // KMUserInfoViewController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/10/30.
  6. //
  7. import Cocoa
  8. import Combine
  9. class KMGradationBox: NSBox {
  10. override func draw(_ dirtyRect: NSRect){
  11. super.draw(dirtyRect)
  12. guard let context = NSGraphicsContext.current?.cgContext else { return }
  13. // 定义渐变颜色
  14. let colors = [NSColor(hex: "EBDABD").cgColor, NSColor(hex: "E5CCA8").cgColor]
  15. let gradient = CGGradient(colorsSpace: nil, colors: colors as CFArray, locations: nil)
  16. // 定义渐变起始和结束点
  17. let startPoint = CGPoint(x: bounds.minX, y: bounds.minY)
  18. let endPoint = CGPoint(x: bounds.maxX, y: bounds.maxY)
  19. // 绘制圆角矩形路径
  20. let roundedPath = NSBezierPath(roundedRect: bounds, xRadius: 4, yRadius: 4) // 你的圆角半径
  21. roundedPath.addClip() // 添加路径为剪切区域
  22. context.clip() // 使路径生效
  23. // 绘制渐变
  24. context.drawLinearGradient(gradient!, start: startPoint, end: endPoint, options: [])
  25. context.restoreGState()
  26. }
  27. }
  28. @objcMembers
  29. class KMUserInfoViewController: NSViewController {
  30. @IBOutlet weak var userImageView: NSImageView!
  31. @IBOutlet weak var emailLabel: NSTextField!
  32. @IBOutlet weak var productLabel: NSTextField!
  33. @IBOutlet weak var spliLineImageView: NSImageView!
  34. @IBOutlet weak var endDateLabel: NSTextField!
  35. @IBOutlet weak var membershipLabel: NSTextField!
  36. @IBOutlet weak var lockedImageView: NSImageView!
  37. @IBOutlet weak var lockedLabel: NSTextField!
  38. @IBOutlet var lockedLabelWidthffset:NSLayoutConstraint!
  39. @IBOutlet var lockedBox:KMGradationBox!
  40. @IBOutlet weak var centerBackgroud: NSImageView!
  41. @IBOutlet weak var rightsBox: NSBox!
  42. @IBOutlet var rightsView: NSView!
  43. @IBOutlet weak var number1Label: NSTextField!
  44. @IBOutlet weak var number1ImageView: NSImageView!
  45. @IBOutlet weak var number2Label: NSTextField!
  46. @IBOutlet weak var iconBox: NSBox!
  47. @IBOutlet var iconView1: NSView!
  48. @IBOutlet weak var icon1ImageView: NSImageView!
  49. @IBOutlet weak var icon2ImageView: NSImageView!
  50. @IBOutlet weak var icon3ImageView: NSImageView!
  51. @IBOutlet weak var icon4ImageView: NSImageView!
  52. @IBOutlet var iconView2: NSView!
  53. @IBOutlet weak var icon5ImageView: NSImageView!
  54. @IBOutlet weak var icon6ImageView: NSImageView!
  55. @IBOutlet weak var icon7ImageView: NSImageView!
  56. @IBOutlet var iconView3: NSView!
  57. @IBOutlet weak var icon8ImageView: NSImageView!
  58. @IBOutlet weak var icon9ImageView: NSImageView!
  59. @IBOutlet var iconView4: NSView!
  60. @IBOutlet weak var icon10ImageView: NSImageView!
  61. @IBOutlet weak var number3Label: NSTextField!
  62. @IBOutlet weak var number4Label: NSTextField!
  63. @IBOutlet weak var number4_1Label: NSTextField!
  64. @IBOutlet weak var number5Label: NSTextField!
  65. @IBOutlet weak var buyBox: NSBox!
  66. @IBOutlet var buyView1: NSView!
  67. @IBOutlet weak var buyNow1Box: KMBox!
  68. @IBOutlet weak var buyNow1ImageView: NSImageView!
  69. @IBOutlet weak var buyNow1Label: NSTextField!
  70. @IBOutlet weak var arrow1ImageView: NSImageView!
  71. @IBOutlet weak var buyNow2Box: KMBox!
  72. @IBOutlet weak var buyNow2ImageView: NSImageView!
  73. @IBOutlet weak var buyNow2Label: NSTextField!
  74. @IBOutlet weak var arrow2ImageView: NSImageView!
  75. @IBOutlet var buyNow1BoxLeftConst: NSLayoutConstraint!
  76. @IBOutlet var buyView2: NSView!
  77. @IBOutlet weak var buyNow3Box: KMBox!
  78. @IBOutlet weak var buyNow3ImageView: NSImageView!
  79. @IBOutlet weak var buyNow3Label: NSTextField!
  80. @IBOutlet weak var arrow3ImageView: NSImageView!
  81. @IBOutlet weak var accountCenterBox: KMBox!
  82. @IBOutlet weak var accountImageView: NSImageView!
  83. @IBOutlet weak var accountLabel: NSTextField!
  84. @IBOutlet weak var signOutBox: KMBox!
  85. @IBOutlet weak var signOutImageView: NSImageView!
  86. @IBOutlet weak var signOutLabel: NSTextField!
  87. @IBOutlet weak var closeAccountBox: KMBox!
  88. @IBOutlet weak var closeAccountImageView: NSImageView!
  89. @IBOutlet weak var closeAccountLabel: NSTextField!
  90. private var viewModel = KMUserInfoVCModel()
  91. private var cancellables = Set<AnyCancellable>()
  92. deinit {
  93. KMPrint("KMUserInfoViewController deinit.")
  94. }
  95. override func viewDidLoad() {
  96. super.viewDidLoad()
  97. // Do view setup here.
  98. self.view.wantsLayer = true
  99. self.view.layer?.backgroundColor = .white
  100. bindViewModel()
  101. languageLocalized()
  102. initializeUI()
  103. NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
  104. }
  105. @objc func changeEffectiveAppearance() {
  106. let isDarkModel = KMAdvertisementConfig.isDarkModel()
  107. if isDarkModel {
  108. self.view.appearance = NSAppearance(named: .darkAqua)
  109. } else {
  110. self.view.appearance = NSAppearance(named: .aqua)
  111. }
  112. initializeUI()
  113. }
  114. // MARK: Private Method
  115. private func languageLocalized() -> Void {
  116. emailLabel.stringValue = KMMemberInfo.shared.userEmail
  117. productLabel.stringValue = NSLocalizedString("Personal Account", tableName: "MemberCenterLocalizable", comment: "")
  118. endDateLabel.stringValue = KMMemberInfo.shared.vip_endDate
  119. membershipLabel.stringValue = NSLocalizedString("Membership Benefits", tableName: "MemberCenterLocalizable", comment: "")
  120. buyNow3Label.stringValue = NSLocalizedString("Upgrade Now", tableName: "MemberCenterLocalizable", comment: "")
  121. accountLabel.stringValue = NSLocalizedString("Account Center", tableName: "MemberCenterLocalizable", comment: "")
  122. signOutLabel.stringValue = NSLocalizedString("Sign out", tableName: "MemberCenterLocalizable", comment: "")
  123. if KMMemberInfo.shared.validFlag == "5" {
  124. closeAccountLabel.stringValue = NSLocalizedString("Undo Remove Account", tableName: "MemberCenterLocalizable", comment: "")
  125. } else {
  126. closeAccountLabel.stringValue = NSLocalizedString("Remove Account", tableName: "MemberCenterLocalizable", comment: "")
  127. }
  128. if KMMemberInfo.shared.vip_maxDeviceNum == 1 {
  129. number4Label.stringValue = NSLocalizedString("device", tableName: "MemberCenterLocalizable", comment: "")
  130. } else {
  131. number4Label.stringValue = NSLocalizedString("devices", tableName: "MemberCenterLocalizable", comment: "")
  132. }
  133. number4_1Label.stringValue = String(KMMemberInfo.shared.vip_maxDeviceNum)
  134. number5Label.stringValue = NSLocalizedString("Devices Access", tableName: "MemberCenterLocalizable", comment: "")
  135. let platforms = viewModel.getPlatformsImages()
  136. if platforms.count == 4 {
  137. number3Label.stringValue = NSLocalizedString("All-platform Available", tableName: "MemberCenterLocalizable", comment: "")
  138. } else {
  139. number3Label.stringValue = NSLocalizedString("Platform", tableName: "MemberCenterLocalizable", comment: "")
  140. }
  141. if KMMemberInfo.shared.userScenarioType == .lite_type1 || KMMemberInfo.shared.userScenarioType == .lite_type9 {
  142. buyNow1Label.stringValue = NSLocalizedString("Buy Now", tableName: "MemberCenterLocalizable", comment: "")
  143. buyNow2Label.stringValue = NSLocalizedString("7-Day Free Trial", tableName: "MemberCenterLocalizable", comment: "")
  144. } else if KMMemberInfo.shared.userScenarioType == .lite_type3 {
  145. buyNow3Label.stringValue = NSLocalizedString("Buy Now", tableName: "MemberCenterLocalizable", comment: "")
  146. } else if KMMemberInfo.shared.userScenarioType == .lite_type11 {
  147. buyNow3Label.stringValue = NSLocalizedString("Upgrade Now", tableName: "MemberCenterLocalizable", comment: "")
  148. } else if KMMemberInfo.shared.userScenarioType == .lite_type5 ||
  149. KMMemberInfo.shared.userScenarioType == .pro_type1 ||
  150. KMMemberInfo.shared.userScenarioType == .pro_type3 ||
  151. KMMemberInfo.shared.userScenarioType == .pro_type4 {
  152. buyNow3Label.stringValue = NSLocalizedString("Upgrade Now", tableName: "MemberCenterLocalizable", comment: "")
  153. } else if KMMemberInfo.shared.userScenarioType == .lite_type7 ||
  154. KMMemberInfo.shared.userScenarioType == .lite_type8 ||
  155. KMMemberInfo.shared.userScenarioType == .lite_type13 {
  156. buyNow3Label.stringValue = NSLocalizedString("Renew now", tableName: "MemberCenterLocalizable", comment: "")
  157. }
  158. }
  159. private func refreshEquity() -> Void {
  160. if KMMemberInfo.shared.userScenarioType == .lite_type1 {
  161. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  162. lockedImageView.image = NSImage(named: "LockedImage")
  163. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  164. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  165. number1ImageView.isHidden = true
  166. number1Label.isHidden = false
  167. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  168. number1Label.textColor = NSColor(hex: "0E1114")
  169. number2Label.textColor = NSColor(hex:"42464D")
  170. number3Label.textColor = NSColor(hex:"42464D")
  171. number4Label.textColor = NSColor(hex: "42464D")
  172. number4_1Label.textColor = NSColor(hex: "42464D")
  173. number5Label.textColor = NSColor(hex: "42464D")
  174. } else if KMMemberInfo.shared.userScenarioType == .lite_type2 {
  175. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  176. lockedImageView.image = NSImage(named: "UpgradeImage2")
  177. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  178. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  179. number1ImageView.isHidden = false
  180. number1Label.isHidden = true
  181. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  182. number2Label.textColor = NSColor(named: "FFFFFF")
  183. number3Label.textColor = NSColor(named: "FFFFFF")
  184. number4Label.textColor = NSColor(named: "FFFFFF")
  185. number4_1Label.textColor = NSColor(named: "FFFFFF")
  186. number5Label.textColor = NSColor(named: "FFFFFF")
  187. } else if KMMemberInfo.shared.userScenarioType == .lite_type3 {
  188. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  189. lockedImageView.image = NSImage(named: "LockedImage")
  190. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  191. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  192. number1ImageView.isHidden = true
  193. number1Label.isHidden = false
  194. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  195. number1Label.textColor = NSColor(hex: "0E1114")
  196. number2Label.textColor = NSColor(hex:"42464D")
  197. number3Label.textColor = NSColor(hex:"42464D")
  198. number4Label.textColor = NSColor(hex: "42464D")
  199. number4_1Label.textColor = NSColor(hex: "42464D")
  200. number5Label.textColor = NSColor(hex: "42464D")
  201. } else if KMMemberInfo.shared.userScenarioType == .lite_type4 {
  202. if(KMMemberInfo.shared.vip_cycle == 1) {
  203. lockedLabel.stringValue = NSLocalizedString("Monthly Plan", tableName: "MemberCenterLocalizable", comment: "")
  204. } else if(KMMemberInfo.shared.vip_cycle == 2) {
  205. lockedLabel.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  206. } else if(KMMemberInfo.shared.vip_cycle == 3) {
  207. lockedLabel.stringValue = NSLocalizedString("6-Month Plan", tableName: "MemberCenterLocalizable", comment: "")
  208. } else if(KMMemberInfo.shared.vip_cycle == 4) {
  209. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  210. }
  211. lockedImageView.image = NSImage(named: "UpgradeImage2")
  212. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  213. if KMMemberInfo.shared.vip_levels == "2" {
  214. number2Label.stringValue = NSLocalizedString("Standard Version", tableName: "MemberCenterLocalizable", comment: "")
  215. } else {
  216. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  217. }
  218. number1ImageView.isHidden = false
  219. number1Label.isHidden = true
  220. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  221. number2Label.textColor = NSColor(named: "FFFFFF")
  222. number3Label.textColor = NSColor(named: "FFFFFF")
  223. number4Label.textColor = NSColor(named: "FFFFFF")
  224. number4_1Label.textColor = NSColor(named: "FFFFFF")
  225. number5Label.textColor = NSColor(named: "FFFFFF")
  226. } else if KMMemberInfo.shared.userScenarioType == .lite_type5 {
  227. lockedLabel.stringValue = NSLocalizedString("Permanent Plan", tableName: "MemberCenterLocalizable", comment: "")
  228. lockedImageView.image = NSImage(named: "UpgradeImage2")
  229. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  230. if KMMemberInfo.shared.vip_levels == "2" {
  231. number2Label.stringValue = NSLocalizedString("Standard Version", tableName: "MemberCenterLocalizable", comment: "")
  232. } else {
  233. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  234. }
  235. number1ImageView.isHidden = false
  236. number1Label.isHidden = true
  237. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage4")
  238. number2Label.textColor = NSColor(named: "FFFFFF")
  239. number3Label.textColor = NSColor(named: "FFFFFF")
  240. number4Label.textColor = NSColor(named: "FFFFFF")
  241. number4_1Label.textColor = NSColor(named: "FFFFFF")
  242. number5Label.textColor = NSColor(named: "FFFFFF")
  243. } else if KMMemberInfo.shared.userScenarioType == .lite_type6 {
  244. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  245. lockedImageView.image = NSImage(named: "UpgradeImage2")
  246. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  247. if KMMemberInfo.shared.vip_levels == "2" {
  248. number2Label.stringValue = NSLocalizedString("Standard Version", tableName: "MemberCenterLocalizable", comment: "")
  249. } else {
  250. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  251. }
  252. number1ImageView.isHidden = false
  253. number1Label.isHidden = true
  254. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  255. number2Label.textColor = NSColor(named: "FFFFFF")
  256. number3Label.textColor = NSColor(named: "FFFFFF")
  257. number4Label.textColor = NSColor(named: "FFFFFF")
  258. number4_1Label.textColor = NSColor(named: "FFFFFF")
  259. number5Label.textColor = NSColor(named: "FFFFFF")
  260. } else if KMMemberInfo.shared.userScenarioType == .lite_type7 {
  261. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  262. lockedImageView.image = NSImage(named: "LockedImage")
  263. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  264. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  265. number1ImageView.isHidden = true
  266. number1Label.isHidden = false
  267. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  268. number1Label.textColor = NSColor(hex: "0E1114")
  269. number2Label.textColor = NSColor(hex:"42464D")
  270. number3Label.textColor = NSColor(hex:"42464D")
  271. number4Label.textColor = NSColor(hex: "42464D")
  272. number4_1Label.textColor = NSColor(hex: "42464D")
  273. number5Label.textColor = NSColor(hex: "42464D")
  274. } else if KMMemberInfo.shared.userScenarioType == .lite_type8 {
  275. if(KMMemberInfo.shared.vip_cycle == 1) {
  276. lockedLabel.stringValue = NSLocalizedString("Monthly Plan", tableName: "MemberCenterLocalizable", comment: "")
  277. } else if(KMMemberInfo.shared.vip_cycle == 2) {
  278. lockedLabel.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  279. } else if(KMMemberInfo.shared.vip_cycle == 3) {
  280. lockedLabel.stringValue = NSLocalizedString("6-Month Plan", tableName: "MemberCenterLocalizable", comment: "")
  281. } else if(KMMemberInfo.shared.vip_cycle == 4) {
  282. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  283. }
  284. lockedImageView.image = NSImage(named: "UpgradeImage2")
  285. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  286. if KMMemberInfo.shared.vip_levels == "2" {
  287. number2Label.stringValue = NSLocalizedString("Standard Version", tableName: "MemberCenterLocalizable", comment: "")
  288. } else {
  289. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  290. }
  291. number1ImageView.isHidden = false
  292. number1Label.isHidden = true
  293. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  294. number2Label.textColor = NSColor(named: "FFFFFF")
  295. number3Label.textColor = NSColor(named: "FFFFFF")
  296. number4Label.textColor = NSColor(named: "FFFFFF")
  297. number4_1Label.textColor = NSColor(named: "FFFFFF")
  298. number5Label.textColor = NSColor(named: "FFFFFF")
  299. } else if KMMemberInfo.shared.userScenarioType == .lite_type9 {
  300. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  301. lockedImageView.image = NSImage(named: "LockedImage")
  302. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  303. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  304. number1ImageView.isHidden = true
  305. number1Label.isHidden = false
  306. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  307. number1Label.textColor = NSColor(hex: "0E1114")
  308. number2Label.textColor = NSColor(hex:"42464D")
  309. number3Label.textColor = NSColor(hex:"42464D")
  310. number4Label.textColor = NSColor(hex: "42464D")
  311. number4_1Label.textColor = NSColor(hex: "42464D")
  312. number5Label.textColor = NSColor(hex: "42464D")
  313. } else if KMMemberInfo.shared.userScenarioType == .lite_type10 {
  314. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  315. lockedImageView.image = NSImage(named: "UpgradeImage2")
  316. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  317. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  318. number1ImageView.isHidden = false
  319. number1Label.isHidden = true
  320. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  321. number2Label.textColor = NSColor(named: "FFFFFF")
  322. number3Label.textColor = NSColor(named: "FFFFFF")
  323. number4Label.textColor = NSColor(named: "FFFFFF")
  324. number4_1Label.textColor = NSColor(named: "FFFFFF")
  325. number5Label.textColor = NSColor(named: "FFFFFF")
  326. } else if KMMemberInfo.shared.userScenarioType == .lite_type11 {
  327. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  328. lockedImageView.image = NSImage(named: "LockedImage")
  329. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  330. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  331. number1ImageView.isHidden = true
  332. number1Label.isHidden = false
  333. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  334. number1Label.textColor = NSColor(hex: "0E1114")
  335. number2Label.textColor = NSColor(hex:"42464D")
  336. number3Label.textColor = NSColor(hex:"42464D")
  337. number4Label.textColor = NSColor(hex: "42464D")
  338. number4_1Label.textColor = NSColor(hex: "42464D")
  339. number5Label.textColor = NSColor(hex: "42464D")
  340. } else if KMMemberInfo.shared.userScenarioType == .lite_type12 {
  341. if(KMMemberInfo.shared.vip_cycle == 1) {
  342. lockedLabel.stringValue = NSLocalizedString("Monthly Plan", tableName: "MemberCenterLocalizable", comment: "")
  343. } else if(KMMemberInfo.shared.vip_cycle == 2) {
  344. lockedLabel.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  345. } else if(KMMemberInfo.shared.vip_cycle == 3) {
  346. lockedLabel.stringValue = NSLocalizedString("6-Month Plan", tableName: "MemberCenterLocalizable", comment: "")
  347. } else if(KMMemberInfo.shared.vip_cycle == 4) {
  348. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  349. }
  350. lockedImageView.image = NSImage(named: "UpgradeImage2")
  351. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  352. if(KMMemberInfo.shared.vip_levels == "2") {
  353. number2Label.stringValue = NSLocalizedString("Standard Version", tableName: "MemberCenterLocalizable", comment: "")
  354. } else if((KMMemberInfo.shared.vip_levels == "3")) {
  355. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  356. }
  357. number1ImageView.isHidden = false
  358. number1Label.isHidden = true
  359. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  360. number2Label.textColor = NSColor(named: "FFFFFF")
  361. number3Label.textColor = NSColor(named: "FFFFFF")
  362. number4Label.textColor = NSColor(named: "FFFFFF")
  363. number4_1Label.textColor = NSColor(named: "FFFFFF")
  364. number5Label.textColor = NSColor(named: "FFFFFF")
  365. } else if KMMemberInfo.shared.userScenarioType == .lite_type13 {
  366. if(KMMemberInfo.shared.vip_cycle == 1) {
  367. lockedLabel.stringValue = NSLocalizedString("Monthly Plan", tableName: "MemberCenterLocalizable", comment: "")
  368. } else if(KMMemberInfo.shared.vip_cycle == 2) {
  369. lockedLabel.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  370. } else if(KMMemberInfo.shared.vip_cycle == 3) {
  371. lockedLabel.stringValue = NSLocalizedString("6-Month Plan", tableName: "MemberCenterLocalizable", comment: "")
  372. } else if(KMMemberInfo.shared.vip_cycle == 4) {
  373. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  374. }
  375. lockedImageView.image = NSImage(named: "UpgradeImage2")
  376. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  377. if KMMemberInfo.shared.vip_levels == "2" {
  378. number2Label.stringValue = NSLocalizedString("Standard Version", tableName: "MemberCenterLocalizable", comment: "")
  379. } else {
  380. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  381. }
  382. number1ImageView.isHidden = false
  383. number1Label.isHidden = true
  384. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  385. number2Label.textColor = NSColor(named: "FFFFFF")
  386. number3Label.textColor = NSColor(named: "FFFFFF")
  387. number4Label.textColor = NSColor(named: "FFFFFF")
  388. number4_1Label.textColor = NSColor(named: "FFFFFF")
  389. number5Label.textColor = NSColor(named: "FFFFFF")
  390. } else if KMMemberInfo.shared.userScenarioType == .pro_type1 {
  391. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  392. lockedImageView.image = NSImage(named: "LockedImage")
  393. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  394. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  395. number1ImageView.isHidden = true
  396. number1Label.isHidden = false
  397. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  398. number1Label.textColor = NSColor(hex: "0E1114")
  399. number2Label.textColor = NSColor(hex:"42464D")
  400. number3Label.textColor = NSColor(hex:"42464D")
  401. number4Label.textColor = NSColor(hex: "42464D")
  402. number4_1Label.textColor = NSColor(hex: "42464D")
  403. number5Label.textColor = NSColor(hex: "42464D")
  404. } else if KMMemberInfo.shared.userScenarioType == .pro_type2 {
  405. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  406. lockedImageView.image = NSImage(named: "UpgradeImage2")
  407. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  408. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  409. number1ImageView.isHidden = false
  410. number1Label.isHidden = true
  411. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  412. number2Label.textColor = NSColor(named: "FFFFFF")
  413. number3Label.textColor = NSColor(named: "FFFFFF")
  414. number4Label.textColor = NSColor(named: "FFFFFF")
  415. number4_1Label.textColor = NSColor(named: "FFFFFF")
  416. number5Label.textColor = NSColor(named: "FFFFFF")
  417. } else if KMMemberInfo.shared.userScenarioType == .pro_type3 {
  418. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  419. lockedImageView.image = NSImage(named: "LockedImage")
  420. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  421. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  422. number1ImageView.isHidden = true
  423. number1Label.isHidden = false
  424. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  425. number1Label.textColor = NSColor(hex: "0E1114")
  426. number2Label.textColor = NSColor(hex:"42464D")
  427. number3Label.textColor = NSColor(hex:"42464D")
  428. number4Label.textColor = NSColor(hex: "42464D")
  429. number4_1Label.textColor = NSColor(hex: "42464D")
  430. number5Label.textColor = NSColor(hex: "42464D")
  431. } else if KMMemberInfo.shared.userScenarioType == .pro_type4 {
  432. lockedLabel.stringValue = NSLocalizedString("Permanent Plan", tableName: "MemberCenterLocalizable", comment: "")
  433. lockedImageView.image = NSImage(named: "UpgradeImage2")
  434. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  435. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  436. number1ImageView.isHidden = false
  437. number1Label.isHidden = true
  438. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage4")
  439. number2Label.textColor = NSColor(named: "FFFFFF")
  440. number3Label.textColor = NSColor(named: "FFFFFF")
  441. number4Label.textColor = NSColor(named: "FFFFFF")
  442. number4_1Label.textColor = NSColor(named: "FFFFFF")
  443. number5Label.textColor = NSColor(named: "FFFFFF")
  444. } else if KMMemberInfo.shared.userScenarioType == .pro_type5 {
  445. lockedLabel.stringValue = NSLocalizedString("Annual Plan", tableName: "MemberCenterLocalizable", comment: "")
  446. lockedImageView.image = NSImage(named: "UpgradeImage2")
  447. number1Label.stringValue = NSLocalizedString("", tableName: "MemberCenterLocalizable", comment: "")
  448. number2Label.stringValue = NSLocalizedString("Advanced Version", tableName: "MemberCenterLocalizable", comment: "")
  449. number1ImageView.isHidden = false
  450. number1Label.isHidden = true
  451. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage5")
  452. number2Label.textColor = NSColor(named: "FFFFFF")
  453. number3Label.textColor = NSColor(named: "FFFFFF")
  454. number4Label.textColor = NSColor(named: "FFFFFF")
  455. number4_1Label.textColor = NSColor(named: "FFFFFF")
  456. number5Label.textColor = NSColor(named: "FFFFFF")
  457. } else {
  458. lockedLabel.stringValue = NSLocalizedString("Locked", tableName: "MemberCenterLocalizable", comment: "")
  459. lockedImageView.image = NSImage(named: "LockedImage")
  460. number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
  461. number2Label.stringValue = NSLocalizedString("Benefits of Functions", tableName: "MemberCenterLocalizable", comment: "")
  462. number1ImageView.isHidden = true
  463. number1Label.isHidden = false
  464. centerBackgroud.image = NSImage(named: "ButtonBackgroundImage3")
  465. number1Label.textColor = NSColor(hex: "0E1114")
  466. number2Label.textColor = NSColor(hex:"42464D")
  467. number3Label.textColor = NSColor(hex:"42464D")
  468. number4Label.textColor = NSColor(hex: "42464D")
  469. number4_1Label.textColor = NSColor(hex: "42464D")
  470. number5Label.textColor = NSColor(hex: "42464D")
  471. }
  472. }
  473. private func initializeUI() -> Void {
  474. refreshEquity()
  475. self.view.wantsLayer = true
  476. let isDarkModel = KMAdvertisementConfig.isDarkModel()
  477. if isDarkModel {
  478. self.view.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor;
  479. } else {
  480. self.view.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor;
  481. }
  482. userImageView.image = NSImage(named: "UserProfilePicture_Size")
  483. emailLabel.textColor = NSColor(named: "0E1114")
  484. emailLabel.font = NSFont.SFMediumFontWithSize(14)
  485. productLabel.textColor = NSColor(named: "42464D_1")
  486. productLabel.font = NSFont.SFProTextRegularFont(12)
  487. endDateLabel.textColor = NSColor(named: "42464D_1")
  488. endDateLabel.font = NSFont.SFProTextRegularFont(12)
  489. spliLineImageView.isHidden = true
  490. endDateLabel.isHidden = true
  491. if KMMemberInfo.shared.userScenarioType == .lite_type4 ||
  492. KMMemberInfo.shared.userScenarioType == .lite_type6 ||
  493. KMMemberInfo.shared.userScenarioType == .lite_type7 ||
  494. KMMemberInfo.shared.userScenarioType == .lite_type8 ||
  495. KMMemberInfo.shared.userScenarioType == .lite_type12 ||
  496. KMMemberInfo.shared.userScenarioType == .lite_type13 ||
  497. KMMemberInfo.shared.userScenarioType == .pro_type3 {
  498. if KMMemberInfo.shared.vip_endDate.count > 0 {
  499. spliLineImageView.isHidden = false
  500. endDateLabel.isHidden = false
  501. }
  502. }
  503. membershipLabel.font = NSFont.SFMediumFontWithSize(16)
  504. lockedLabel.font = NSFont.SFMediumFontWithSize(12)
  505. rightsBox.contentView = rightsView
  506. number1Label.font = NSFont.SFMediumFontWithSize(24)
  507. number1ImageView.image = NSImage(named: "UpgradeImage")
  508. number2Label.font = NSFont.SFProTextRegularFont(12)
  509. number3Label.font = NSFont.SFProTextRegularFont(12)
  510. number5Label.font = NSFont.SFProTextRegularFont(12)
  511. buyNow1ImageView.image = NSImage(named: "ButtonBackgroundImage2")
  512. buyNow2ImageView.image = NSImage(named: "ButtonBackgroundImage2")
  513. buyNow3ImageView.image = NSImage(named: "ButtonBackgroundImage2")
  514. buyNow3ImageView.wantsLayer = true
  515. buyNow3ImageView.layer?.cornerRadius = 4.0
  516. buyNow1Label.textColor = NSColor(named: "FFFFFF")
  517. buyNow1Label.font = NSFont.SFProTextRegularFont(14)
  518. buyNow2Label.textColor = NSColor(named: "FFFFFF")
  519. buyNow2Label.font = NSFont.SFProTextRegularFont(14)
  520. buyNow3Label.textColor = NSColor(named: "000000")
  521. buyNow3Label.font = NSFont.SFProTextRegularFont(14)
  522. accountCenterBox.borderColor = NSColor(named: "3091FF") ?? .blue
  523. accountCenterBox.fillColor = .clear
  524. accountLabel.textColor = NSColor(named: "065CBC")
  525. accountLabel.font = NSFont.SFProTextRegularFont(14)
  526. accountImageView.image = NSImage(named: "AccountCenterImage")
  527. signOutLabel.textColor = NSColor(named: "065CBC")
  528. signOutLabel.font = NSFont.SFProTextRegularFont(14)
  529. signOutImageView.image = NSImage(named: "SignOutImage")
  530. closeAccountLabel.textColor = NSColor(named: "065CBC")
  531. closeAccountLabel.font = NSFont.SFProTextRegularFont(14)
  532. closeAccountImageView.image = NSImage(named: "CloseAccountImage")
  533. buyNow3Box.fillColor = NSColor(named: "FFFFFF") ?? .white
  534. let isNoOldSubscribed = IAPProductsManager.default().allAccessPack6months_lite.isSubscribed == false && IAPProductsManager.default().allAccessPack12months_lite.isSubscribed == false
  535. if KMMemberInfo.shared.userScenarioType == .lite_type1 ||
  536. KMMemberInfo.shared.userScenarioType == .lite_type2 ||
  537. KMMemberInfo.shared.userScenarioType == .lite_type3 ||
  538. KMMemberInfo.shared.userScenarioType == .lite_type10 {
  539. rightsBox.fillColor = NSColor(named: "7094F6_0.1") ?? .white
  540. membershipLabel.textColor = NSColor(hex: "0E1114")
  541. lockedLabel.textColor = NSColor(hex: "42464D")
  542. if KMMemberInfo.shared.userScenarioType == .lite_type1 {
  543. buyBox.contentView = buyView1
  544. buyNow1ImageView.isHidden = false
  545. buyNow2ImageView.isHidden = false
  546. arrow1ImageView.image = NSImage(named: "BuyNewArrowImage1")
  547. arrow2ImageView.image = NSImage(named: "BuyNewArrowImage1")
  548. #if !VERSION_DMG
  549. if IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.isTrialPeriod == true {
  550. buyNow2Box.isHidden = true
  551. buyNow1BoxLeftConst.constant = (CGRectGetWidth(view.bounds) - CGRectGetWidth(buyNow1Box.frame))/2
  552. }
  553. #else
  554. #endif
  555. } else if KMMemberInfo.shared.userScenarioType == .lite_type3{
  556. buyNow3Label.textColor = NSColor(named: "FFFFFF")
  557. buyBox.contentView = buyView2
  558. buyNow3ImageView.isHidden = false
  559. arrow3ImageView.image = NSImage(named: "BuyNewArrowImage1")
  560. }
  561. } else if KMMemberInfo.shared.userScenarioType == .lite_type4 ||
  562. KMMemberInfo.shared.userScenarioType == .lite_type5 ||
  563. KMMemberInfo.shared.userScenarioType == .lite_type6 ||
  564. KMMemberInfo.shared.userScenarioType == .lite_type12 ||
  565. KMMemberInfo.shared.userScenarioType == .pro_type1 ||
  566. KMMemberInfo.shared.userScenarioType == .pro_type2 ||
  567. KMMemberInfo.shared.userScenarioType == .pro_type3 ||
  568. KMMemberInfo.shared.userScenarioType == .pro_type4 ||
  569. KMMemberInfo.shared.userScenarioType == .pro_type5 {
  570. membershipLabel.textColor = NSColor(named: "FFFFFF")
  571. lockedLabel.textColor = NSColor(hex: "FCFDFF")
  572. number5Label.textColor = NSColor(named: "FFFFFF")
  573. rightsBox.fillColor = NSColor(named: "FFFFFF_0.2") ?? .white
  574. if KMMemberInfo.shared.userScenarioType == .lite_type5 ||
  575. KMMemberInfo.shared.userScenarioType == .pro_type1 ||
  576. KMMemberInfo.shared.userScenarioType == .pro_type3 ||
  577. KMMemberInfo.shared.userScenarioType == .pro_type4 {
  578. buyBox.contentView = buyView2
  579. buyNow3ImageView.isHidden = true
  580. arrow3ImageView.image = NSImage(named: "BuyNewArrowImage2")
  581. }
  582. } else if KMMemberInfo.shared.userScenarioType == .lite_type7 ||
  583. (KMMemberInfo.shared.userScenarioType == .lite_type9 && KMMemberInfo.shared.vip_paymentModel == "2" && isNoOldSubscribed) || (KMMemberInfo.shared.userScenarioType == .lite_type11 && KMMemberInfo.shared.vip_paymentModel == "2" && isNoOldSubscribed) {
  584. membershipLabel.textColor = NSColor(hex: "0E1114")
  585. lockedLabel.textColor = NSColor(hex: "42464D")
  586. rightsBox.fillColor = NSColor(named: "7094F6_0.1") ?? .white
  587. buyBox.contentView = buyView2
  588. buyNow3ImageView.isHidden = false
  589. buyNow3Label.textColor = NSColor(named: "FFFFFF")
  590. arrow3ImageView.image = NSImage(named: "BuyNewArrowImage1")
  591. } else if KMMemberInfo.shared.userScenarioType == .lite_type8 ||
  592. KMMemberInfo.shared.userScenarioType == .lite_type13 {
  593. membershipLabel.textColor = NSColor(hex: "FCFDFF")
  594. lockedLabel.textColor = NSColor(hex: "FCFDFF")
  595. rightsBox.fillColor = NSColor(named: "7094F6_0.1") ?? .white
  596. }
  597. let platforms = viewModel.getPlatformsImages()
  598. if platforms.count == 4 {
  599. iconBox.contentView = iconView1
  600. icon1ImageView.image = platforms[0]
  601. icon2ImageView.image = platforms[1]
  602. icon3ImageView.image = platforms[2]
  603. icon4ImageView.image = platforms[3]
  604. } else if platforms.count == 3 {
  605. iconBox.contentView = iconView2
  606. icon5ImageView.image = platforms[0]
  607. icon6ImageView.image = platforms[1]
  608. icon7ImageView.image = platforms[2]
  609. } else if platforms.count == 2 {
  610. iconBox.contentView = iconView3
  611. icon8ImageView.image = platforms[0]
  612. icon9ImageView.image = platforms[1]
  613. } else if platforms.count == 1 {
  614. iconBox.contentView = iconView4
  615. icon10ImageView.image = platforms[0]
  616. }
  617. buyNow1Box.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  618. guard let self = self else { return }
  619. if mouseEntered {
  620. self.buyNow1ImageView.image = NSImage(named: "ButtonBackgroundImage2_Hov")
  621. } else {
  622. self.buyNow1ImageView.image = NSImage(named: "ButtonBackgroundImage2")
  623. }
  624. }
  625. buyNow1Box.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  626. guard let self = self else { return }
  627. if KMMemberInfo.shared.userScenarioType == .lite_type1 {
  628. self.viewModel.skipCompare(.lite_Base)
  629. }
  630. }
  631. buyNow2Box.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  632. guard let self = self else { return }
  633. if mouseEntered {
  634. self.buyNow2ImageView.image = NSImage(named: "ButtonBackgroundImage2_Hov")
  635. } else {
  636. self.buyNow2ImageView.image = NSImage(named: "ButtonBackgroundImage2")
  637. }
  638. }
  639. buyNow2Box.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  640. guard let self = self else { return }
  641. if KMMemberInfo.shared.userScenarioType == .lite_type1 {
  642. self.viewModel.skipCompare(.trial)
  643. }
  644. }
  645. buyNow3Box.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  646. guard let self = self else { return }
  647. if KMMemberInfo.shared.userScenarioType == .lite_type3 ||
  648. KMMemberInfo.shared.userScenarioType == .lite_type11 {
  649. if mouseEntered {
  650. self.buyNow3ImageView.image = NSImage(named: "ButtonBackgroundImage2_Hov")
  651. } else {
  652. self.buyNow3ImageView.image = NSImage(named: "ButtonBackgroundImage2")
  653. }
  654. }
  655. }
  656. buyNow3Box.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  657. guard let self = self else { return }
  658. if KMMemberInfo.shared.userScenarioType == .lite_type3 ||
  659. KMMemberInfo.shared.userScenarioType == .lite_type7 ||
  660. KMMemberInfo.shared.userScenarioType == .lite_type8 {
  661. self.viewModel.skipCompare(.lite_Base)
  662. } else if KMMemberInfo.shared.userScenarioType == .lite_type5 ||
  663. KMMemberInfo.shared.userScenarioType == .lite_type9 ||
  664. KMMemberInfo.shared.userScenarioType == .lite_type11 ||
  665. KMMemberInfo.shared.userScenarioType == .lite_type13 {
  666. self.viewModel.skipCompare(.lite_MacWindows)
  667. } else if KMMemberInfo.shared.userScenarioType == .pro_type1 ||
  668. KMMemberInfo.shared.userScenarioType == .pro_type4 {
  669. self.viewModel.skipCompare(.pro_Advanced)
  670. } else if KMMemberInfo.shared.userScenarioType == .pro_type3 {
  671. self.viewModel.skipCompare(.pro_Base)
  672. }
  673. }
  674. accountCenterBox.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  675. guard let self = self else { return }
  676. if mouseEntered {
  677. self.accountCenterBox.fillColor = NSColor(named: "F5FAFF") ?? .white
  678. self.accountLabel.textColor = NSColor(named: "3091FF")
  679. self.accountImageView.image = NSImage(named: "AccountCenterImage_Hov")
  680. } else {
  681. self.accountCenterBox.fillColor = .clear
  682. self.accountLabel.textColor = NSColor(named: "065CBC")
  683. self.accountImageView.image = NSImage(named: "AccountCenterImage")
  684. }
  685. }
  686. accountCenterBox.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  687. guard let self = self else { return }
  688. self.viewModel.skipAccountCenter()
  689. }
  690. signOutBox.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  691. guard let self = self else { return }
  692. if mouseEntered {
  693. self.signOutLabel.textColor = NSColor(named: "3091FF")
  694. self.signOutImageView.image = NSImage(named: "SignOutImage_Hov")
  695. } else {
  696. self.signOutLabel.textColor = NSColor(named: "065CBC")
  697. self.signOutImageView.image = NSImage(named: "SignOutImage")
  698. }
  699. }
  700. signOutBox.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  701. guard let self = self else { return }
  702. self.viewModel.signOutAction()
  703. }
  704. closeAccountBox.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  705. guard let self = self else { return }
  706. if mouseEntered {
  707. self.closeAccountLabel.textColor = NSColor(named: "3091FF")
  708. self.closeAccountImageView.image = NSImage(named: "CloseAccountImage_hover")
  709. } else {
  710. self.closeAccountLabel.textColor = NSColor(named: "065CBC")
  711. self.closeAccountImageView.image = NSImage(named: "CloseAccountImage")
  712. }
  713. }
  714. closeAccountBox.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  715. guard let self = self else { return }
  716. self.viewModel.closeAccountAction()
  717. }
  718. buyNow1BoxLeftConst.constant = 0
  719. buyNow2Box.isHidden = false
  720. //远程控制
  721. if let userViewInfoContent = KMAdvertisementManager.manager.info.userViewInfoContent {
  722. if userViewInfoContent.content?.isEmpty == false {
  723. buyNow2Box.isHidden = true
  724. buyNow1BoxLeftConst.constant = (CGRectGetWidth(view.bounds) - CGRectGetWidth(buyNow1Box.frame))/2
  725. }
  726. }
  727. }
  728. // MARK: Bind Method
  729. func bindViewModel() -> Void {
  730. }
  731. // MARK: Action Method
  732. }