|
@@ -29,6 +29,7 @@ class KMSubscribeWaterMarkView: KMBaseXibView {
|
|
|
@IBOutlet weak var subscribeLabel: NSTextField!
|
|
|
@IBOutlet weak var subscribeBox: KMBox!
|
|
|
@IBOutlet weak var lineView: NSView!
|
|
|
+ @IBOutlet weak var cancelBox: KMBox!
|
|
|
|
|
|
var closeAction: KMSubscribeWaterMarkViewCancelAction?
|
|
|
var subscribeAction: KMSubscribeWaterMarkViewSubscribeAction?
|
|
@@ -44,37 +45,53 @@ class KMSubscribeWaterMarkView: KMBaseXibView {
|
|
|
}
|
|
|
|
|
|
var afterLoginDataArray = [
|
|
|
- ["title": "Save without watermark",
|
|
|
- "subtitle": "When you save a document with PDF Master after editing, no watermark will be attached",
|
|
|
+ ["title": "Save without Watermark",
|
|
|
+ "subtitle": "Free trial version will add a PDF Master official watermark to the document when saving.",
|
|
|
"image": "remove watermark"],
|
|
|
// ["title": "AI assitant",
|
|
|
// "subtitle": "Support AI translation, AI rewriting, AI correction",
|
|
|
// "image": "ai"],
|
|
|
- ["title": "Convert PDF without limitation",
|
|
|
- "subtitle": "Convert PDF to Office and image without any limitations, get converted files in high quality",
|
|
|
+ ["title": "Convert without Page Limit",
|
|
|
+ "subtitle": "Free trial users can only convert the first 10 pages of a document.",
|
|
|
"image": "convert"],
|
|
|
- ["title": "Batch Processing",
|
|
|
- "subtitle": "The trial version can merge only 2 files at a time in batch processing",
|
|
|
+ ["title": "Merge PDFs without Limitation",
|
|
|
+ "subtitle": "Free trial users can only combine 2 files at once.",
|
|
|
"image": "merging"]
|
|
|
]
|
|
|
|
|
|
var beforeLoginDataArray = [
|
|
|
- ["title": "AI Document Processing",
|
|
|
- "subtitle": "AI Translate; Al Rewrite, AI Correction, Completely free to use 5 times/month.",
|
|
|
+ ["title": "AI Assistant",
|
|
|
+ "subtitle": "AI translation, AI rewriting, AI correction.",
|
|
|
"image": "ai"],
|
|
|
- ["title": "Unlimited times to conversion first 10 pages",
|
|
|
- "subtitle": "Trial Version users can only convert the first 10 pages of a document 2 times.",
|
|
|
+ ["title": "Unlimited Conversion Times",
|
|
|
+ "subtitle": "Free trial users can only convert the first ten pages of a PDF, up to 2 times.",
|
|
|
"image": "convert"],
|
|
|
- ["title": "Unlimited times to batch merge 2 documents",
|
|
|
- "subtitle": "Trial Version users can only merge 2 files at a time in batch processing, and only merge 2 times.",
|
|
|
+ ["title": "Unlimited Merge Times",
|
|
|
+ "subtitle": "Free trial users can merge two files at once, up to 2 times.",
|
|
|
"image": "merging"],
|
|
|
- ["title": "Full function trial",
|
|
|
- "subtitle": "Login will unlock trial of all features.",
|
|
|
+ ["title": "Unlock All Functions",
|
|
|
+ "subtitle": "Log in to free trial all features.",
|
|
|
"image": "full function trial"]
|
|
|
]
|
|
|
|
|
|
let popover = NSPopover()
|
|
|
var isSubscription: Bool = false
|
|
|
+ var isSecondEnable: Bool = true {
|
|
|
+ didSet {
|
|
|
+ if isSecondEnable {
|
|
|
+ self.cancelBox.isHidden = !isSecondEnable
|
|
|
+ self.waterExportButton.isEnabled = isSecondEnable
|
|
|
+ } else {
|
|
|
+ self.cancelBox.isHidden = !isSecondEnable
|
|
|
+// self.waterExportButton.isEnabled = isSecondEnable
|
|
|
+ self.waterExportButton.contentTintColor = NSColor(hex: "#F3465B")
|
|
|
+ self.waterExportButton.backgroundColor(NSColor.clear)
|
|
|
+ self.waterExportButton.border(NSColor(hex: "#DFE1E5"), 0, 20)
|
|
|
+// self.waterExportButton.contentTintColor = NSColor(hex: "#252629")
|
|
|
+ self.waterExportButton.font = NSFont.SFProTextRegular(12)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
override func setup() {
|
|
|
self.closeBox.moveCallback = { [weak self] (mouseEntered, mouseBox) in
|
|
@@ -125,6 +142,14 @@ class KMSubscribeWaterMarkView: KMBaseXibView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ self.cancelBox.moveCallback = { [weak self] (mouseEntered, mouseBox) in
|
|
|
+ if mouseEntered {
|
|
|
+ self?.waterExportButton?.backgroundColor(NSColor(hex: "#DFE1E5"))
|
|
|
+ } else {
|
|
|
+ self?.waterExportButton?.backgroundColor(NSColor(hex: "#EDEEF0"))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
self.lineView.backgroundColor(NSColor(hex: "#000000").withAlphaComponent(0.1))
|
|
|
|
|
|
// 获取包含 NSCollectionView 的 NSScrollView
|
|
@@ -138,31 +163,26 @@ class KMSubscribeWaterMarkView: KMBaseXibView {
|
|
|
}
|
|
|
|
|
|
override func updateLanguage() {
|
|
|
- if KMLightMemberManager.manager.isLogin() || type == .save {
|
|
|
+ if KMSubscribeWaterMarkWindowController.canShowLoginBenefits() {
|
|
|
self.subTitleContentView.isHidden = true
|
|
|
self.subtitleContentHeightConstraint.constant = 0
|
|
|
self.collectionContentViewHeightConstraint.constant = 368
|
|
|
self.collectionViewContentTopConstraint.constant = 28
|
|
|
self.titleLabel.stringValue = NSLocalizedString("Subscription Benefits", comment: "")
|
|
|
- self.waterExportButton.title = NSLocalizedString("Save with Watermark", comment: "")
|
|
|
+// self.waterExportButton.title = NSLocalizedString("Save with Watermark", comment: "")
|
|
|
self.subscribeLabel.stringValue = NSLocalizedString("Upgrade Now", comment: "")
|
|
|
} else {
|
|
|
self.subTitleContentView.isHidden = false
|
|
|
- self.subtitleContentHeightConstraint.constant = 60
|
|
|
+ self.subtitleContentHeightConstraint.constant = 40
|
|
|
self.collectionContentViewHeightConstraint.constant = 330
|
|
|
- self.collectionViewContentTopConstraint.constant = 96
|
|
|
+ self.collectionViewContentTopConstraint.constant = 76
|
|
|
self.titleLabel.stringValue = NSLocalizedString("Login Benefits", comment: "")
|
|
|
- self.waterExportButton.title = NSLocalizedString("Later", comment: "")
|
|
|
+// self.waterExportButton.title = NSLocalizedString("Later", comment: "")
|
|
|
self.subscribeLabel.stringValue = NSLocalizedString("Login or Sign up", comment: "")
|
|
|
}
|
|
|
// + " " + NSLocalizedString("Subscription", comment: ""
|
|
|
|
|
|
- var subtitleString = ""
|
|
|
- if type == .merge {
|
|
|
- subtitleString = NSLocalizedString("The trial version can merge only 2 files at a time in batch processing. Login or sign up PDF Master to speed your workflow!", comment: "")
|
|
|
- } else {
|
|
|
- subtitleString = NSLocalizedString("Login or sign up PDF Master lets you enjoy all features including annotating, text editing and page organization for FREE!", comment: "")
|
|
|
- }
|
|
|
+ var subtitleString = NSLocalizedString("Register as a PDF Master member to enjoy premium features", comment: "")
|
|
|
let paragraphStyle = NSMutableParagraphStyle()
|
|
|
paragraphStyle.lineHeightMultiple = 1.32
|
|
|
paragraphStyle.alignment = .left
|
|
@@ -171,7 +191,7 @@ class KMSubscribeWaterMarkView: KMBaseXibView {
|
|
|
}
|
|
|
|
|
|
override func reloadData() {
|
|
|
- if KMLightMemberManager.manager.isLogin() || type == .save {
|
|
|
+ if KMSubscribeWaterMarkWindowController.canShowLoginBenefits() {
|
|
|
self.dataArray = afterLoginDataArray
|
|
|
} else {
|
|
|
self.dataArray = beforeLoginDataArray
|
|
@@ -188,6 +208,9 @@ extension KMSubscribeWaterMarkView {
|
|
|
}
|
|
|
|
|
|
@IBAction func waterMarkExportButtonAction(_ sender: Any) {
|
|
|
+ if !isSecondEnable {
|
|
|
+ return
|
|
|
+ }
|
|
|
guard let callBack = waterMarkExportAction else { return }
|
|
|
|
|
|
callBack(self)
|
|
@@ -241,7 +264,7 @@ extension KMSubscribeWaterMarkView: NSCollectionViewDelegateFlowLayout {
|
|
|
paragraphStyle.alignment = .left
|
|
|
let size: NSSize = string.boundingRect(with: NSSize(width: 350, height: 100), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : NSFont.SFProTextSemibold(14), NSAttributedString.Key.paragraphStyle : paragraphStyle]).size
|
|
|
let subtitleSize: NSSize = subtitleString.boundingRect(with: NSSize(width: 350, height: 100), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : NSFont.SFProTextRegular(12), NSAttributedString.Key.paragraphStyle : paragraphStyle]).size
|
|
|
- return NSSize(width: 394, height: max(66, size.height + subtitleSize.height + 4))
|
|
|
+ return NSSize(width: 394, height: max(44, size.height + subtitleSize.height + 4))
|
|
|
}
|
|
|
|
|
|
public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, insetForSectionAt section: Int) -> NSEdgeInsets {
|