chore: update function signature

This commit is contained in:
CMK 2021-03-05 19:30:52 +08:00
parent 7ad09468e2
commit 087413009d
2 changed files with 4 additions and 4 deletions

View File

@ -228,7 +228,7 @@ extension MastodonRegisterViewController {
domainLabel.text = "@" + viewModel.domain + " "
domainLabel.sizeToFit()
passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(isValid: false)
passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(validateState: .empty)
usernameTextField.rightView = domainLabel
usernameTextField.rightViewMode = .always
usernameTextField.delegate = self
@ -441,7 +441,7 @@ extension MastodonRegisterViewController {
.sink { [weak self] validateState in
guard let self = self else { return }
self.setTextFieldValidAppearance(self.passwordTextField, validateState: validateState)
self.passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(isValid: validateState == .valid)
self.passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(validateState: validateState)
}
.store(in: &disposeBag)
viewModel.passwordErrorPrompt

View File

@ -180,12 +180,12 @@ extension MastodonRegisterViewModel {
return NSAttributedString(attachment: attachment)
}
static func attributeStringForPassword(isValid: Bool) -> NSAttributedString {
static func attributeStringForPassword(validateState: ValidateState) -> NSAttributedString {
let font = UIFont.preferredFont(forTextStyle: .caption1)
let attributeString = NSMutableAttributedString()
let image = MastodonRegisterViewModel.checkmarkImage(font: font)
attributeString.append(attributedStringImage(with: image, tintColor: isValid ? .black : .clear))
attributeString.append(attributedStringImage(with: image, tintColor: validateState == .valid ? .black : .clear))
attributeString.append(NSAttributedString(string: " "))
let eightCharactersDescription = NSAttributedString(string: L10n.Scene.Register.Input.Password.hint, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: UIColor.black])
attributeString.append(eightCharactersDescription)