12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- //
- // KMUnbindAlertViewController.swift
- // PDF Reader Pro
- //
- // Created by Niehaoyu on 2024/8/7.
- //
- import Cocoa
- @objc class KMUnbindAlertViewController: NSViewController {
- @IBOutlet var contendView: NSView!
-
- @IBOutlet var titleLabel: NSTextField!
- @IBOutlet var contactButton: KMCustomButton!
-
- @objc var unbundHandle: ((_ controller: KMUnbindAlertViewController)->Void)?
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do view setup here.
-
- self.contendView.wantsLayer = true
-
- self.titleLabel.font = NSFont.SFProTextRegularFont(16)
- self.titleLabel.stringValue = NSLocalizedString("You have reached the maximum number of unbindings, please contact us.", comment: "")
-
- self.contactButton.font = NSFont.SFProTextRegularFont(13)
- self.contactButton.wantsLayer = true
- self.contactButton.layer?.masksToBounds = true
- self.contactButton.layer?.cornerRadius = 1
- self.contactButton.title = NSLocalizedString("Contact Support", comment: "")
- self.contactButton.setTitleColor(NSColor.white)
-
- self.updateViewColor()
- }
-
- @objc func updateViewColor() {
- if KMAppearance.isDarkMode() {
- self.contendView.layer?.backgroundColor = NSColor(red: 33/255, green: 33/255, blue: 33/255, alpha: 1).cgColor
- self.titleLabel.textColor = NSColor.white
- self.contactButton.layer?.backgroundColor = NSColor(red: 78/255, green: 127/255, blue: 219/255, alpha: 1).cgColor
- } else {
- self.contendView.layer?.backgroundColor = NSColor.white.cgColor
- self.titleLabel.textColor = NSColor.black
- self.contactButton.layer?.backgroundColor = NSColor(red: 39/255, green: 60/255, blue: 98/255, alpha: 1).cgColor
- }
- }
-
- //MARK: - IBAction
- @IBAction func contactAction(_ sender: KMCustomButton) {
- guard let callBack = self.unbundHandle else {
- return
- }
- callBack(self)
- }
-
- }
|