|
@@ -8,6 +8,9 @@
|
|
|
import Cocoa
|
|
|
|
|
|
typealias KMComparativeViewCloseAction = (_ view: KMComparativeView) -> Void
|
|
|
+typealias KMComparativeViewSignUpAction = (_ view: KMComparativeView) -> Void
|
|
|
+typealias KMComparativeViewSubscriptionAction = (_ view: KMComparativeView) -> Void
|
|
|
+typealias KMComparativeViewRestoreAction = (_ view: KMComparativeView) -> Void
|
|
|
|
|
|
class KMComparativeView: KMBaseXibView {
|
|
|
@IBOutlet weak var topView: NSView!
|
|
@@ -22,6 +25,9 @@ class KMComparativeView: KMBaseXibView {
|
|
|
|
|
|
|
|
|
var closeAction: KMComparativeViewCloseAction?
|
|
|
+ var signUpAction: KMComparativeViewSignUpAction?
|
|
|
+ var subscriptionAction: KMComparativeViewSubscriptionAction?
|
|
|
+ var restoreAction: KMComparativeViewRestoreAction?
|
|
|
|
|
|
var dataArray: [NSDictionary] = [
|
|
|
[
|
|
@@ -103,7 +109,8 @@ class KMComparativeView: KMBaseXibView {
|
|
|
}
|
|
|
|
|
|
override func updateLanguage() {
|
|
|
- let string = NSLocalizedString("Subscription Plan: \nSubscription:USD $39.99/year", comment: "") + " " + NSLocalizedString("Subscription", comment: "")
|
|
|
+// + " " + NSLocalizedString("Subscription", comment: ""
|
|
|
+ let string = NSLocalizedString("Subscription Plan: \nSubscription:USD $39.99/year", comment: "")
|
|
|
let attributedString = NSMutableAttributedString.init(string: string)
|
|
|
let paragraphStyle = NSMutableParagraphStyle()
|
|
|
paragraphStyle.alignment = .left;
|
|
@@ -113,12 +120,12 @@ class KMComparativeView: KMBaseXibView {
|
|
|
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!)!)
|
|
|
+// 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)
|
|
|
}
|
|
@@ -138,6 +145,15 @@ extension KMComparativeView: NSCollectionViewDataSource {
|
|
|
// let data = self.dataArray[indexPath.item]
|
|
|
let view = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMComparativeViewCollectionItem"), for: indexPath) as! KMComparativeViewCollectionItem
|
|
|
view.data = self.dataArray[indexPath.section] as! [String : Any]
|
|
|
+ view.doneAction = { [unowned self] view, data in
|
|
|
+ if data["type"] as! Int == 0 {
|
|
|
+ guard let callBack = signUpAction else { return }
|
|
|
+ callBack(self)
|
|
|
+ } else if data ["type"] as! Int == 1 {
|
|
|
+ guard let callBack = subscriptionAction else { return }
|
|
|
+ callBack(self)
|
|
|
+ }
|
|
|
+ }
|
|
|
return view
|
|
|
}
|
|
|
}
|
|
@@ -198,7 +214,9 @@ extension KMComparativeView: NSTextViewDelegate {
|
|
|
}
|
|
|
|
|
|
@IBAction func restoreButtonAction(_ sender: Any) {
|
|
|
+ guard let callBack = restoreAction else { return }
|
|
|
|
|
|
+ callBack(self)
|
|
|
}
|
|
|
|
|
|
}
|