// // KMCloseApplyWC.swift // PDF Reader Pro // // Created by wanjun on 2024/11/5. // 手动撤销申请WindowController // import Cocoa class KMCloseApplyWC: NSWindowController { @IBOutlet weak var titleLabel: NSTextField! @IBOutlet weak var subTitleLabel: NSTextField! @IBOutlet weak var yesButton: NSButton! var currentTime: String = "7" var logOffTime: String = "7" private var viewModel = KMUserInfoVCModel() static let shared: KMCloseApplyWC = { let windowC = KMCloseApplyWC(windowNibName: "KMCloseApplyWC") return windowC }() override func windowDidLoad() { super.windowDidLoad() // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. languageLocalized() initializeUI() NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil) } @objc func changeEffectiveAppearance() { self.initializeUI() } // MARK: Private Method private func languageLocalized() -> Void { self.window?.title = NSLocalizedString("Remove Account", tableName: "MemberCenterLocalizable", comment: "") titleLabel.stringValue = NSLocalizedString("Account cancellation application has been submitted", tableName: "MemberCenterLocalizable", comment: "") subTitleLabel.stringValue = String(format: NSLocalizedString("Your account will be automatically deleted in %@ days. Welcome to use PDF Reader Pro again!\nYou can log in with this account and choose to Undo Remove Account within %ld days, and continue to use. The benefits and product services you enjoy will be retained.", tableName: "MemberCenterLocalizable", comment: ""), logOffTime, logOffTime) yesButton.title = NSLocalizedString("Got it", tableName: "MemberCenterLocalizable", comment: "") } private func initializeUI() -> Void { self.window?.contentView?.wantsLayer = true let isDarkModel = KMAdvertisementConfig.isDarkModel() if isDarkModel { self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "0E1114").cgColor; } else { self.window?.contentView?.layer?.backgroundColor = NSColor(hex: "FFFFFF").cgColor; } titleLabel.textColor = NSColor(named: "000000_0.85") titleLabel.font = NSFont.SFProTextSemiboldFont(13) subTitleLabel.textColor = NSColor(named: "000000_0.85") subTitleLabel.font = NSFont.SFProTextRegularFont(12) yesButton.setTitleColor(color: NSColor(named: "FFFFFF") ?? NSColor.white, font: NSFont.SFProTextRegularFont(13)) } // MARK: Button Action @IBAction func yesButtonAction(_ sender: NSButton) { KMUserInfoVCModel().refreshUserInfo { success, msg,dic in self.window?.close() } } }