123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- //
- // HomeLynxGuideItem.swift
- // PDF Reader Pro
- //
- // Created by Niehaoyu on 2024/7/22.
- //
- import Cocoa
- class HomeLynxGuideItem: NSCollectionViewItem {
-
- @IBOutlet var contendBox: NSBox!
-
- @IBOutlet var contendView: NSView!
- @IBOutlet var iconImageview: NSImageView!
- @IBOutlet var titleLabel: NSTextField!
- @IBOutlet var subTitleLabel: NSTextField!
-
- @IBOutlet var clickBox: NSBox!
- @IBOutlet var clickBtn: KMButton!
-
- var model: HomeLynxGuideModel? {
- didSet {
- self.reloadData()
- }
- }
-
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do view setup here.
-
- self.contendView.wantsLayer = true
- self.titleLabel.font = NSFont.SFProTextSemiboldFont(14)
- self.subTitleLabel.font = NSFont.SFProTextRegularFont(12)
-
- self.contendBox.borderWidth = 1.0;
- self.contendBox.borderColor = KMAppearance.Interactive.s0Color()
-
- self.clickBox.borderWidth = 0
- self.clickBox.cornerRadius = 4
-
- // self.clickBtn.mouseMoveCallback = {[weak self] mouseEntered in
- // if mouseEntered {
- // self?.clickBox.fillColor = NSColor(red: 255/255, green: 122/255, blue: 40/255, alpha: 1)
- // } else {
- // self?.clickBox.fillColor = KMAppearance.Interactive.a0Color()
- // }
- //
- // }
- }
-
- func reloadData() {
- guard let model = model else { return }
-
- self.titleLabel.stringValue = model.titleString()
- self.subTitleLabel.stringValue = model.subTitleString()
- self.iconImageview.image = model.iconImage()
- self.clickBtn.title = model.btnTitleString()
- if model.type == .AdminConsole {
- if (IAPProductsManager.default().isAvailableAllFunction()) {
- self.clickBtn.title = NSLocalizedString("Log in", comment: "")
- }
- }
-
- self.updateViewColor()
- }
-
- func updateViewColor() {
-
- if KMAppearance.isDarkMode() {
- self.titleLabel.textColor = NSColor.white
- self.subTitleLabel.textColor = NSColor(red: 200/255, green: 201/255, blue: 204/255, alpha: 1)
- } else {
- self.titleLabel.textColor = NSColor(red: 14/255, green: 17/255, blue: 20/255, alpha: 1)
- self.subTitleLabel.textColor = NSColor(red: 66/255, green: 70/255, blue: 77/255, alpha: 1)
- }
-
- self.clickBtn.setTitleColor(NSColor.white)
-
- guard let model = model else { return }
- if model.type == .AdminConsole {
- self.clickBox.fillColor = NSColor(red: 255/255, green: 122/255, blue: 40/255, alpha: 1)
- } else {
- self.clickBox.fillColor = KMAppearance.Interactive.a0Color()
- }
-
- }
-
- //IBAction
- @IBAction func btnClicked(_ sender: Any) {
- guard let model = model else { return }
- if model.type == .AdminConsole {
- FMTrackEventManager.defaultManager.lynxTrackEvent(event: "Home", withProperties: ["Home_Operations" : "admin_console_1"])
- if (IAPProductsManager.default().isAvailableAllFunction()) {
- let url = URL(string:"https://adminconsole.pdfreaderpro.com/login")!
- NSWorkspace.shared.open(url)
- } else {
- let url = URL(string:"https://www.pdfreaderpro.com/admin-console")!
- NSWorkspace.shared.open(url)
- }
- } else if model.type == .Onpremise {
- FMTrackEventManager.defaultManager.lynxTrackEvent(event: "Home", withProperties: ["Home_Operations" : "Serve_1"])
- let url = URL(string:"https://www.pdfreaderpro.com/lynxpdfeditor#premise")!
- NSWorkspace.shared.open(url)
- } else if model.type == .SSO {
- FMTrackEventManager.defaultManager.lynxTrackEvent(event: "Home", withProperties: ["Home_Operations" : "Serve_2"])
- let url = URL(string:"https://www.pdfreaderpro.com/lynxpdfeditor#sso")!
- NSWorkspace.shared.open(url)
- } else if model.type == .MultipleInstall {
- FMTrackEventManager.defaultManager.lynxTrackEvent(event: "Home", withProperties: ["Home_Operations" : "Serve_3"])
- let url = URL(string:"https://www.pdfreaderpro.com/lynxpdfeditor#various")!
- NSWorkspace.shared.open(url)
- } else if model.type == .CustomSolutions {
- FMTrackEventManager.defaultManager.lynxTrackEvent(event: "Home", withProperties: ["Home_Operations" : "Serve_4"])
- let (major, minor, bugFix) = KMTools.getSystemVersion()
- let versionInfoString = "\(KMTools.getRawSystemInfo()) - \(major).\(minor).\(bugFix)"
-
- let appVersion = KMTools.getAppVersion()
- let appName = KMTools.getAppNameForSupportEmail()
- let subjects = "\(appName) - \(appVersion);\(NSLocalizedString("Feedback", comment: ""));\(versionInfoString)"
- let email = "support@pdfreaderpro.com"
-
- KMMailHelper.newEmail(withContacts: email, andSubjects: subjects)
-
- } else if model.type == .BusinessFeature {
- FMTrackEventManager.defaultManager.lynxTrackEvent(event: "Home", withProperties: ["Home_Operations" : "Serve_5"])
- let url = URL(string:"https://www.pdfreaderpro.com/lynxpdfeditor#customized")!
- NSWorkspace.shared.open(url)
- }
-
-
- }
-
- }
|