|
@@ -44,6 +44,62 @@ class KMSignUpView: KMBaseXibView {
|
|
|
|
|
|
private var popOver_: NSPopover?
|
|
|
|
|
|
+ private lazy var codePrivacyAttri_: NSAttributedString = {
|
|
|
+ let tipsString = NSLocalizedString("I have read and agreed to the %@ and %@. An account will be automatically created after signing in with an unregistered email address.", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ let specialOffer = NSLocalizedString("Terms of Service", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ let contactsUs = NSLocalizedString("Privacy Policy", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ let fullString = String(format: tipsString, specialOffer, contactsUs)
|
|
|
+ let attributedString = NSMutableAttributedString(string: fullString)
|
|
|
+ // 定义链接的范围
|
|
|
+ let specialOfferRange = (fullString as NSString).range(of: specialOffer)
|
|
|
+ let contactsUsRange = (fullString as NSString).range(of: contactsUs)
|
|
|
+ let linkColor = NSColor(named: "4982E6") ?? NSColor.blue
|
|
|
+ let font = NSFont.SFProTextRegularFont(11.0) // 与普通文本相同的字体
|
|
|
+ attributedString.addAttributes([
|
|
|
+ .foregroundColor: NSColor(named: "0E1114") ?? NSColor.black as Any,
|
|
|
+ .font: font
|
|
|
+ ], range: (fullString as NSString).range(of: fullString))
|
|
|
+ attributedString.addAttributes([
|
|
|
+ .foregroundColor: linkColor,
|
|
|
+ .link: NSLocalizedString("https://www.pdfreaderpro.com/terms_of_service", comment: ""),
|
|
|
+ .font: font
|
|
|
+ ], range: specialOfferRange)
|
|
|
+ attributedString.addAttributes([
|
|
|
+ .foregroundColor: linkColor,
|
|
|
+ .link: NSLocalizedString("https://www.pdfreaderpro.com/privacy-policy", comment: ""),
|
|
|
+ .font: font
|
|
|
+ ], range: contactsUsRange)
|
|
|
+ return attributedString
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var privacyAttri_: NSAttributedString = {
|
|
|
+ let tipsString = NSLocalizedString("I have read and agreed to the %@ and %@.", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ let specialOffer = NSLocalizedString("Terms of Service", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ let contactsUs = NSLocalizedString("Privacy Policy", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ let fullString = String(format: tipsString, specialOffer, contactsUs)
|
|
|
+ let attributedString = NSMutableAttributedString(string: fullString)
|
|
|
+ // 定义链接的范围
|
|
|
+ let specialOfferRange = (fullString as NSString).range(of: specialOffer)
|
|
|
+ let contactsUsRange = (fullString as NSString).range(of: contactsUs)
|
|
|
+ let linkColor = NSColor(named: "4982E6") ?? NSColor.blue
|
|
|
+ let font = NSFont.SFProTextRegularFont(11.0) // 与普通文本相同的字体
|
|
|
+ attributedString.addAttributes([
|
|
|
+ .foregroundColor: NSColor(named: "0E1114") ?? NSColor.black as Any,
|
|
|
+ .font: font
|
|
|
+ ], range: (fullString as NSString).range(of: fullString))
|
|
|
+ attributedString.addAttributes([
|
|
|
+ .foregroundColor: linkColor,
|
|
|
+ .link: NSLocalizedString("https://www.pdfreaderpro.com/terms_of_service", comment: ""),
|
|
|
+ .font: font
|
|
|
+ ], range: specialOfferRange)
|
|
|
+ attributedString.addAttributes([
|
|
|
+ .foregroundColor: linkColor,
|
|
|
+ .link: NSLocalizedString("https://www.pdfreaderpro.com/privacy-policy", comment: ""),
|
|
|
+ .font: font
|
|
|
+ ], range: contactsUsRange)
|
|
|
+ return attributedString
|
|
|
+ }()
|
|
|
+
|
|
|
convenience init(model: KMSignUpViewModel, superView: NSView) {
|
|
|
self.init(frame: superView.bounds)
|
|
|
viewModel = model
|
|
@@ -87,9 +143,11 @@ class KMSignUpView: KMBaseXibView {
|
|
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(loginSuccessNotification), name: NSNotification.Name(rawValue: "MemberCenterLoginSuccess"), object: nil)
|
|
|
|
|
|
- bindViewModel()
|
|
|
- languageLocalized()
|
|
|
- initializeUI()
|
|
|
+ DispatchQueue.main.async { [weak self] in
|
|
|
+ self?.bindViewModel()
|
|
|
+ self?.languageLocalized()
|
|
|
+ self?.initializeUI()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// MARK: Private Method
|
|
@@ -155,31 +213,8 @@ class KMSignUpView: KMBaseXibView {
|
|
|
privacyLabel.allowsEditingTextAttributes = true
|
|
|
privacyLabel.textColor = NSColor.black
|
|
|
privacyLabel.font = NSFont.SFProTextRegularFont(16.0)
|
|
|
- let tipsString = NSLocalizedString("I have read and agreed to the %@ and %@. An account will be automatically created after signing in with an unregistered email address.", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
- let specialOffer = NSLocalizedString("Terms of Service", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
- let contactsUs = NSLocalizedString("Privacy Policy", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
- let fullString = String(format: tipsString, specialOffer, contactsUs)
|
|
|
- let attributedString = NSMutableAttributedString(string: fullString)
|
|
|
- // 定义链接的范围
|
|
|
- let specialOfferRange = (fullString as NSString).range(of: specialOffer)
|
|
|
- let contactsUsRange = (fullString as NSString).range(of: contactsUs)
|
|
|
- let linkColor = NSColor(named: "4982E6") ?? NSColor.blue
|
|
|
- let font = NSFont.SFProTextRegularFont(11.0) // 与普通文本相同的字体
|
|
|
- attributedString.addAttributes([
|
|
|
- .foregroundColor: NSColor(named: "0E1114") ?? NSColor.black as Any,
|
|
|
- .font: font
|
|
|
- ], range: (fullString as NSString).range(of: fullString))
|
|
|
- attributedString.addAttributes([
|
|
|
- .foregroundColor: linkColor,
|
|
|
- .link: NSLocalizedString("https://www.pdfreaderpro.com/terms_of_service", comment: ""),
|
|
|
- .font: font
|
|
|
- ], range: specialOfferRange)
|
|
|
- attributedString.addAttributes([
|
|
|
- .foregroundColor: linkColor,
|
|
|
- .link: NSLocalizedString("https://www.pdfreaderpro.com/privacy-policy", comment: ""),
|
|
|
- .font: font
|
|
|
- ], range: contactsUsRange)
|
|
|
- privacyLabel.attributedStringValue = attributedString
|
|
|
+
|
|
|
+ privacyLabel.attributedStringValue = codePrivacyAttri_
|
|
|
|
|
|
signUpStateChange()
|
|
|
visibleStateChange()
|
|
@@ -219,6 +254,8 @@ class KMSignUpView: KMBaseXibView {
|
|
|
passwordView.isHidden = true
|
|
|
verifficationTextField.placeholderString = NSLocalizedString("Please enter code", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
forgetButton.isHidden = true
|
|
|
+
|
|
|
+ privacyLabel.attributedStringValue = codePrivacyAttri_
|
|
|
} else if viewModel.signUpState == .password {
|
|
|
selectBox1.isHidden = true
|
|
|
selectBox2.isHidden = false
|
|
@@ -229,6 +266,8 @@ class KMSignUpView: KMBaseXibView {
|
|
|
passwordTextField.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
passwordTextField1.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
forgetButton.isHidden = false
|
|
|
+
|
|
|
+ privacyLabel.attributedStringValue = privacyAttri_
|
|
|
}
|
|
|
}
|
|
|
|