|
@@ -8,15 +8,19 @@
|
|
|
import Cocoa
|
|
|
|
|
|
typealias KMRegisterSuccessViewDoneAction = (_ view: KMRegisterSuccessView) -> Void
|
|
|
+typealias KMRegisterSuccessViewSubscribeAction = (_ view: KMRegisterSuccessView) -> Void
|
|
|
class KMRegisterSuccessView: KMBaseXibView {
|
|
|
|
|
|
@IBOutlet weak var titleLabel: NSTextField!
|
|
|
@IBOutlet weak var imageView: NSView!
|
|
|
@IBOutlet weak var doneButton: NSButton!
|
|
|
+ @IBOutlet var textView: NSTextView!
|
|
|
|
|
|
var doneButtonVC: KMDesignButton!
|
|
|
|
|
|
var doneAction: KMRegisterSuccessViewDoneAction?
|
|
|
+ var subscribeAction: KMRegisterSuccessViewSubscribeAction?
|
|
|
+
|
|
|
override func draw(_ dirtyRect: NSRect) {
|
|
|
super.draw(dirtyRect)
|
|
|
|
|
@@ -40,6 +44,11 @@ class KMRegisterSuccessView: KMBaseXibView {
|
|
|
self.doneButtonVC.button.keyEquivalent = KMKeyEquivalent.enter
|
|
|
self.doneButtonVC.stringValue = NSLocalizedString("Getting Started", comment: "")
|
|
|
self.doneButtonVC.updateUI()
|
|
|
+
|
|
|
+ self.textView.delegate = self
|
|
|
+ self.textView.isEditable = false
|
|
|
+ self.textView.frame = (self.textView.enclosingScrollView?.contentView.bounds)!
|
|
|
+ self.textView.autoresizingMask = [.width, .height]
|
|
|
}
|
|
|
|
|
|
override func reloadData() {
|
|
@@ -51,6 +60,24 @@ class KMRegisterSuccessView: KMBaseXibView {
|
|
|
super.updateLanguage()
|
|
|
self.titleLabel.stringValue = NSLocalizedString("Register Successfully", comment: "")
|
|
|
self.doneButtonVC.stringValue = NSLocalizedString("Getting Started", comment: "")
|
|
|
+
|
|
|
+ let string = NSLocalizedString("Want to save documents with unlimited conversion and no watermark?", comment: "") + " " + NSLocalizedString("Subscription", comment: "")
|
|
|
+ let attributedString = NSMutableAttributedString.init(string: string)
|
|
|
+ let paragraphStyle = NSMutableParagraphStyle()
|
|
|
+ paragraphStyle.alignment = .center;
|
|
|
+ attributedString.addAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0),
|
|
|
+ NSAttributedString.Key.foregroundColor : NSColor(hex: "#252629"),
|
|
|
+ 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)
|
|
|
}
|
|
|
|
|
|
@IBAction func doneButtonAction(_ sender: Any) {
|
|
@@ -59,3 +86,15 @@ class KMRegisterSuccessView: KMBaseXibView {
|
|
|
callBack(self)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+extension KMRegisterSuccessView: NSTextViewDelegate {
|
|
|
+ func textView(_ textView: NSTextView, clickedOnLink link: Any, at charIndex: Int) -> Bool {
|
|
|
+ if link as! String == "register://" {
|
|
|
+ guard let callBack = self.subscribeAction else { return true }
|
|
|
+
|
|
|
+ print("链接点击")
|
|
|
+ callBack(self)
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+}
|