// // KMNBetaFeedbackSuccessWindowController.swift // PDF Reader Pro Beta // // Created by kdanmobile on 2025/3/1. // import Cocoa import KMComponentLibrary class KMNBetaFeedbackSuccessWindowController: KMNBaseWindowController { @IBOutlet var titleLabel: NSTextField! @IBOutlet var subTitleLabel: NSTextField! @IBOutlet var emailLabel: NSTextField! @IBOutlet var webLabel: NSTextField! @IBOutlet var sureButton: ComponentButton! 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. } override func initContentView() { titleLabel.font = NSFont.boldSystemFont(ofSize: 24) subTitleLabel.font = ComponentLibrary.shared.getFontFromKey ("mac/body-m-medium") sureButton.properties = ComponentButtonProperty(type: .primary, size: .s, state: .normal, buttonText: KMLocalizedString("I Know")) sureButton.setTarget(self, action: #selector(submitButtonClicked(_ :))) sureButton.keyEquivalent = KMKeyEquivalent.enter } override func updateUIThemeColor() { window?.contentView?.wantsLayer = true window?.contentView?.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/popup").cgColor subTitleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey ("colorText/1") sureButton.reloadData() updateLabel() } override func updateUILanguage() { titleLabel.stringValue = KMLocalizedString("Feedback Successfully!") subTitleLabel.stringValue = KMLocalizedString("Thanks for your feedback!") sureButton.properties.buttonText = KMLocalizedString("I Know") sureButton.reloadData() updateLabel() } func updateLabel() { let text = KMLocalizedString("We have distributed a gift to your Personal Account %@") let email = KMMemberInfo.shared.userEmail let fullString = String(format: text, email) let attrStr = NSMutableAttributedString(string: fullString) attrStr.addAttribute(.font, value: ComponentLibrary.shared.getFontFromKey("mac/body-xs-regular"), range: (fullString as NSString).range(of: text)) attrStr.addAttribute(.foregroundColor, value: ComponentLibrary.shared.getComponentColorFromKey("colorText/2"), range: (fullString as NSString).range(of: text)) attrStr.addAttribute(.foregroundColor, value: ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/textLight"), range: (fullString as NSString).range(of: email)) // 设置整个文本字体 attrStr.addAttribute(.font, value: ComponentLibrary.shared.getFontFromKey("mac/body-xs-regular"), range: NSRange(location: 0, length: text.count)) // 应用富文本 emailLabel.attributedStringValue = attrStr let linkText = "Please visit our Official Website to Sign in to check your reward." let linkAttrStr = NSMutableAttributedString(string: linkText) let link = KMLocalizedString("Official Website") // 设置超链接文本属性 let url = URL(string: "https://www.pdfreaderpro.com")! linkAttrStr.addAttribute(.link, value: url, range: (linkText as NSString).range(of: link)) // 设置字体和颜色 linkAttrStr.addAttribute(.font, value: ComponentLibrary.shared.getFontFromKey("mac/body-xs-regular"), range: NSRange(location: 0, length: linkText.count)) linkAttrStr.addAttribute(.foregroundColor, value: ComponentLibrary.shared.getComponentColorFromKey("colorText/2"), range: NSRange(location: 0, length: linkText.count)) linkAttrStr.addAttribute(.foregroundColor, value: ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/textLight"), range: (linkText as NSString).range(of: link)) linkAttrStr.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: (linkText as NSString).range(of: link)) // 应用富文本到 NSTextField webLabel.attributedStringValue = linkAttrStr } //MARK: - Action @objc func submitButtonClicked(_ sender: NSView) { own_closeEndSheet() } }