|
@@ -18,10 +18,14 @@ class KMComparativeView: KMBaseXibView {
|
|
|
@IBOutlet weak var collectionView: NSCollectionView!
|
|
|
@IBOutlet weak var closeButton: NSButton!
|
|
|
@IBOutlet weak var closeBox: KMBox!
|
|
|
- @IBOutlet var textView: NSTextView!
|
|
|
+// @IBOutlet var textView: NSTextView!
|
|
|
@IBOutlet weak var imageView: NSImageView!
|
|
|
@IBOutlet weak var restoreButton: NSButton!
|
|
|
@IBOutlet weak var titleLabel: NSTextField!
|
|
|
+ @IBOutlet weak var infoButton: NSButton!
|
|
|
+ @IBOutlet weak var privacyPolicyButton: NSButton!
|
|
|
+ @IBOutlet weak var termsServiceButton: NSButton!
|
|
|
+ @IBOutlet weak var lineView: NSView!
|
|
|
|
|
|
|
|
|
var closeAction: KMComparativeViewCloseAction?
|
|
@@ -66,6 +70,8 @@ class KMComparativeView: KMBaseXibView {
|
|
|
]
|
|
|
]
|
|
|
|
|
|
+ let popover = NSPopover()
|
|
|
+
|
|
|
override func setup() {
|
|
|
super.setup()
|
|
|
|
|
@@ -90,10 +96,10 @@ class KMComparativeView: KMBaseXibView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- self.textView.delegate = self
|
|
|
- self.textView.isEditable = false
|
|
|
- self.textView.frame = (self.textView.enclosingScrollView?.contentView.bounds)!
|
|
|
- self.textView.autoresizingMask = [.width, .height]
|
|
|
+// self.textView.delegate = self
|
|
|
+// self.textView.isEditable = false
|
|
|
+// self.textView.frame = (self.textView.enclosingScrollView?.contentView.bounds)!
|
|
|
+// self.textView.autoresizingMask = [.width, .height]
|
|
|
|
|
|
self.imageView.backgroundColor(NSColor(hex: "#FFFFFF"))
|
|
|
|
|
@@ -103,6 +109,14 @@ class KMComparativeView: KMBaseXibView {
|
|
|
self.restoreButton.contentTintColor = NSColor(hex: "#1770F4")
|
|
|
self.restoreButton.font = NSFont.SFProTextRegular(16)
|
|
|
|
|
|
+ self.privacyPolicyButton.contentTintColor = NSColor(hex: "#1770F4")
|
|
|
+ self.privacyPolicyButton.font = NSFont.SFProTextRegular(12)
|
|
|
+
|
|
|
+ self.lineView.backgroundColor(NSColor(hex: "#000000").withAlphaComponent(0.1))
|
|
|
+
|
|
|
+ self.termsServiceButton.contentTintColor = NSColor(hex: "#1770F4")
|
|
|
+ self.termsServiceButton.font = NSFont.SFProTextRegular(12)
|
|
|
+
|
|
|
self.titleLabel.textColor = NSColor(hex: "#252629")
|
|
|
self.titleLabel.font = NSFont.SFProTextSemibold(24)
|
|
|
}
|
|
@@ -112,30 +126,30 @@ class KMComparativeView: KMBaseXibView {
|
|
|
self.restoreButton.title = NSLocalizedString("Restore", comment: "")
|
|
|
self.titleLabel.stringValue = NSLocalizedString("Upgrade to Use All Features", comment: "")
|
|
|
|
|
|
- let string = NSLocalizedString("""
|
|
|
-Payment will be charged to your Apple ID account at the confirmation of purchase.
|
|
|
-Subscription automatically renews unless it is canceled at least 24 hours before
|
|
|
-the end of the current period. Your account will be charged for renewal within 24
|
|
|
-hours prior to the end of the current period. You can manage and cancel your
|
|
|
-subscriptions by going to your account settings on the App Store after purchase.
|
|
|
-""", comment: "")
|
|
|
- let attributedString = NSMutableAttributedString.init(string: string)
|
|
|
- let paragraphStyle = NSMutableParagraphStyle()
|
|
|
- paragraphStyle.alignment = .left;
|
|
|
- paragraphStyle.lineHeightMultiple = 1.37
|
|
|
- attributedString.addAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(11.0),
|
|
|
- NSAttributedString.Key.foregroundColor : NSColor(hex: "#94989C"),
|
|
|
- NSAttributedString.Key.paragraphStyle : paragraphStyle],
|
|
|
- range: NSRange(location: 0, length: string.count))
|
|
|
-
|
|
|
-// let range = string.range(of: NSLocalizedString("Subscription", comment: ""))
|
|
|
-// attributedString.setAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0),
|
|
|
-// NSAttributedString.Key.foregroundColor : NSColor(hex: "#1770F4"),
|
|
|
-// NSAttributedString.Key.underlineColor : NSColor.clear,
|
|
|
-// NSAttributedString.Key.link : "register://"],
|
|
|
-// range: string.nsRange(from: range!)!)
|
|
|
-
|
|
|
- self.textView.textStorage?.setAttributedString(attributedString)
|
|
|
+// let string = NSLocalizedString("""
|
|
|
+//Payment will be charged to your Apple ID account at the confirmation of purchase.
|
|
|
+//Subscription automatically renews unless it is canceled at least 24 hours before
|
|
|
+//the end of the current period. Your account will be charged for renewal within 24
|
|
|
+//hours prior to the end of the current period. You can manage and cancel your
|
|
|
+//subscriptions by going to your account settings on the App Store after purchase.
|
|
|
+//""", comment: "")
|
|
|
+// let attributedString = NSMutableAttributedString.init(string: string)
|
|
|
+// let paragraphStyle = NSMutableParagraphStyle()
|
|
|
+// paragraphStyle.alignment = .left;
|
|
|
+// paragraphStyle.lineHeightMultiple = 1.37
|
|
|
+// attributedString.addAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(11.0),
|
|
|
+// NSAttributedString.Key.foregroundColor : NSColor(hex: "#94989C"),
|
|
|
+// NSAttributedString.Key.paragraphStyle : paragraphStyle],
|
|
|
+// range: NSRange(location: 0, length: string.count))
|
|
|
+//
|
|
|
+//// let range = string.range(of: NSLocalizedString("Subscription", comment: ""))
|
|
|
+//// attributedString.setAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0),
|
|
|
+//// NSAttributedString.Key.foregroundColor : NSColor(hex: "#1770F4"),
|
|
|
+//// NSAttributedString.Key.underlineColor : NSColor.clear,
|
|
|
+//// NSAttributedString.Key.link : "register://"],
|
|
|
+//// range: string.nsRange(from: range!)!)
|
|
|
+//
|
|
|
+// self.textView.textStorage?.setAttributedString(attributedString)
|
|
|
}
|
|
|
|
|
|
override func reloadData() {
|
|
@@ -145,6 +159,71 @@ subscriptions by going to your account settings on the App Store after purchase.
|
|
|
self?.collectionView.reloadData()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @IBAction func infoButtonAction(_ sender: Any) {
|
|
|
+// let contentViewController = NSViewController()
|
|
|
+// contentViewController.view = NSView(frame: NSRect(x: 0, y: 0, width: 200, height: 100))
|
|
|
+// contentViewController.view.wantsLayer = true
|
|
|
+// contentViewController.view.layer?.backgroundColor = NSColor(hex:"#36383B").cgColor
|
|
|
+// contentViewController.title =
|
|
|
+//
|
|
|
+// let popover = NSPopover()
|
|
|
+// popover.contentViewController = contentViewController
|
|
|
+// popover.behavior = .transient
|
|
|
+// popover.setValue(true, forKey: "shouldHideAnchor")
|
|
|
+// popover.show(relativeTo: infoButton.bounds, of: infoButton, preferredEdge: .maxX)
|
|
|
+ self.showPopover(sender)
|
|
|
+ }
|
|
|
+
|
|
|
+ @IBAction func privacyPolicyButtonAction(_ sender: Any) {
|
|
|
+ NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/privacy-policy")!)
|
|
|
+ }
|
|
|
+
|
|
|
+ @IBAction func termsServiceButtonAction(_ sender: Any) {
|
|
|
+ NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/terms_of_service")!)
|
|
|
+ }
|
|
|
+
|
|
|
+ func setupPopover() {
|
|
|
+ let string: NSString = NSLocalizedString("""
|
|
|
+ Payment will be charged to your Apple ID account at the confirmation of purchase.
|
|
|
+ Subscription automatically renews unless it is canceled at least 24 hours before
|
|
|
+ the end of the current period. Your account will be charged for renewal within 24
|
|
|
+ hours prior to the end of the current period. You can manage and cancel your
|
|
|
+ subscriptions by going to your account settings on the App Store after purchase.
|
|
|
+ """, comment: "") as NSString
|
|
|
+
|
|
|
+ let paragraphStyle = NSMutableParagraphStyle()
|
|
|
+ paragraphStyle.lineHeightMultiple = 1.4
|
|
|
+ paragraphStyle.alignment = .left
|
|
|
+ let attributes = [NSAttributedString.Key.font : NSFont.SFProTextRegular(12), NSAttributedString.Key.paragraphStyle : paragraphStyle]
|
|
|
+ let size: NSSize = string.boundingRect(with: NSSize(width: 420, height: 400), options: NSString.DrawingOptions(rawValue: 3), attributes: attributes).size
|
|
|
+
|
|
|
+
|
|
|
+ popover.behavior = .transient
|
|
|
+ popover.setValue(true, forKey: "shouldHideAnchor")
|
|
|
+ popover.contentViewController = NSViewController()
|
|
|
+ popover.contentViewController?.view = NSView(frame: NSRect(x: 0, y: 0, width: size.width, height: size.height))
|
|
|
+ popover.contentViewController?.view.wantsLayer = true
|
|
|
+ popover.contentViewController?.view.layer?.backgroundColor = NSColor(hex:"#36383B").cgColor
|
|
|
+
|
|
|
+ let textField = NSTextField(frame: NSRect(x: 16, y: 8, width: size.width - 32, height: size.height - 16))
|
|
|
+ textField.attributedStringValue = NSMutableAttributedString(string: NSLocalizedString(string as String, comment: ""), attributes: attributes)
|
|
|
+ textField.isEditable = false
|
|
|
+ textField.isSelectable = true
|
|
|
+ textField.textColor = NSColor(hex: "#FFFFFF")
|
|
|
+
|
|
|
+ popover.contentViewController?.view.addSubview(textField)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func showPopover(_ sender: Any?) {
|
|
|
+ if popover.isShown {
|
|
|
+ popover.performClose(sender)
|
|
|
+ } else {
|
|
|
+ self.setupPopover()
|
|
|
+ let button = sender as? NSButton
|
|
|
+ popover.show(relativeTo: button?.bounds ?? NSZeroRect, of: button ?? NSView(), preferredEdge: NSRectEdge.maxX)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
extension KMComparativeView: NSCollectionViewDataSource {
|