|
@@ -8,6 +8,70 @@
|
|
|
import Cocoa
|
|
|
import Combine
|
|
|
|
|
|
+class KMSignUpBuyView: KMHoverView {
|
|
|
+ private lazy var contentBox_: NSBox = {
|
|
|
+ let view = NSBox()
|
|
|
+ view.boxType = .custom
|
|
|
+ view.titlePosition = .noTitle
|
|
|
+ view.contentViewMargins = .zero
|
|
|
+ view.borderWidth = 0
|
|
|
+ return view
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var titleLabel_: NSTextField = {
|
|
|
+ let view = NSTextField(labelWithString: NSLocalizedString("Buy without Logging in", comment: ""))
|
|
|
+ return view
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var subTitleLabel_: NSTextField = {
|
|
|
+ let view = NSTextField(wrappingLabelWithString: NSLocalizedString("Cross-platform not supported, 1-year free AI not available", comment: ""))
|
|
|
+ return view
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var arrowButton_: NSButton = {
|
|
|
+ let view = NSButton()
|
|
|
+ view.isBordered = false
|
|
|
+ view.imagePosition = .imageOnly
|
|
|
+ return view
|
|
|
+ }()
|
|
|
+
|
|
|
+ convenience init() {
|
|
|
+ self.init(frame: .init(x: 0, y: 0, width: 200, height: 40))
|
|
|
+
|
|
|
+ initSubViews()
|
|
|
+ }
|
|
|
+
|
|
|
+ override func awakeFromNib() {
|
|
|
+ super.awakeFromNib()
|
|
|
+
|
|
|
+ initSubViews()
|
|
|
+ }
|
|
|
+
|
|
|
+ func initSubViews() {
|
|
|
+ let contentInset = NSEdgeInsets(top: 4, left: 8, bottom: 4, right: 8)
|
|
|
+
|
|
|
+ addSubview(contentBox_)
|
|
|
+ contentBox_.km_add_inset_constraint()
|
|
|
+
|
|
|
+ let wh: CGFloat = 16
|
|
|
+ contentBox_.contentView?.addSubview(arrowButton_)
|
|
|
+ arrowButton_.km_add_size_constraint(size: .init(width: wh, height: wh))
|
|
|
+ arrowButton_.km_add_trailing_constraint(constant: -contentInset.right)
|
|
|
+ arrowButton_.km_add_centerY_constraint()
|
|
|
+
|
|
|
+ let hSpace: CGFloat = 4
|
|
|
+ contentBox_.contentView?.addSubview(titleLabel_)
|
|
|
+ titleLabel_.km_add_leading_constraint(constant: contentInset.left)
|
|
|
+ titleLabel_.km_add_top_constraint(constant: 4)
|
|
|
+ titleLabel_.km_add_trailing_constraint(equalTo: arrowButton_, attribute: .leading, constant: hSpace)
|
|
|
+
|
|
|
+ contentBox_.contentView?.addSubview(subTitleLabel_)
|
|
|
+ subTitleLabel_.km_add_leading_constraint(constant: contentInset.left)
|
|
|
+ subTitleLabel_.km_add_top_constraint(equalTo: titleLabel_, attribute: .bottom)
|
|
|
+ subTitleLabel_.km_add_trailing_constraint(equalTo: arrowButton_, attribute: .leading, constant: hSpace)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
class KMSignUpView: KMBaseXibView {
|
|
|
|
|
|
@IBOutlet weak var signUpLabel: NSTextField!
|
|
@@ -38,6 +102,15 @@ class KMSignUpView: KMBaseXibView {
|
|
|
@IBOutlet weak var signUpButton: NSButton!
|
|
|
@IBOutlet weak var privacyCheckButton: NSButton!
|
|
|
@IBOutlet weak var privacyLabel: NSTextField!
|
|
|
+
|
|
|
+ @IBOutlet weak var topConst: NSLayoutConstraint!
|
|
|
+ @IBOutlet weak var bottomConst: NSLayoutConstraint!
|
|
|
+ @IBOutlet weak var checkTopConst: NSLayoutConstraint!
|
|
|
+
|
|
|
+ private lazy var buyView_: KMSignUpBuyView = {
|
|
|
+ let view = KMSignUpBuyView()
|
|
|
+ return view
|
|
|
+ }()
|
|
|
|
|
|
private var viewModel = KMSignUpViewModel()
|
|
|
private var cancellables = Set<AnyCancellable>()
|
|
@@ -226,6 +299,23 @@ class KMSignUpView: KMBaseXibView {
|
|
|
|
|
|
privacyLabel.attributedStringValue = codePrivacyAttri_
|
|
|
|
|
|
+#if VERSION_FREE
|
|
|
+#if VERSION_DMG
|
|
|
+#else
|
|
|
+ if buyView_.superview == nil {
|
|
|
+ addSubview(buyView_)
|
|
|
+ buyView_.km_add_leading_constraint(constant: 46)
|
|
|
+ buyView_.km_add_trailing_constraint(constant: -36)
|
|
|
+ buyView_.km_add_top_constraint(equalTo: privacyLabel, attribute: .bottom, constant: 8)
|
|
|
+ buyView_.km_add_height_constraint(constant: 51)
|
|
|
+ }
|
|
|
+
|
|
|
+ self.topConst.constant = 25
|
|
|
+ self.bottomConst.constant = 68
|
|
|
+ self.checkTopConst.constant = 10
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+
|
|
|
signUpStateChange()
|
|
|
visibleStateChange()
|
|
|
textfieldInputState(isEmail: true)
|