forked from zelo72/mastodon-ios
chore: update function signature
This commit is contained in:
parent
7ad09468e2
commit
087413009d
|
@ -228,7 +228,7 @@ extension MastodonRegisterViewController {
|
||||||
|
|
||||||
domainLabel.text = "@" + viewModel.domain + " "
|
domainLabel.text = "@" + viewModel.domain + " "
|
||||||
domainLabel.sizeToFit()
|
domainLabel.sizeToFit()
|
||||||
passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(isValid: false)
|
passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(validateState: .empty)
|
||||||
usernameTextField.rightView = domainLabel
|
usernameTextField.rightView = domainLabel
|
||||||
usernameTextField.rightViewMode = .always
|
usernameTextField.rightViewMode = .always
|
||||||
usernameTextField.delegate = self
|
usernameTextField.delegate = self
|
||||||
|
@ -441,7 +441,7 @@ extension MastodonRegisterViewController {
|
||||||
.sink { [weak self] validateState in
|
.sink { [weak self] validateState in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
self.setTextFieldValidAppearance(self.passwordTextField, validateState: validateState)
|
self.setTextFieldValidAppearance(self.passwordTextField, validateState: validateState)
|
||||||
self.passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(isValid: validateState == .valid)
|
self.passwordCheckLabel.attributedText = MastodonRegisterViewModel.attributeStringForPassword(validateState: validateState)
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
viewModel.passwordErrorPrompt
|
viewModel.passwordErrorPrompt
|
||||||
|
|
|
@ -180,12 +180,12 @@ extension MastodonRegisterViewModel {
|
||||||
return NSAttributedString(attachment: attachment)
|
return NSAttributedString(attachment: attachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func attributeStringForPassword(isValid: Bool) -> NSAttributedString {
|
static func attributeStringForPassword(validateState: ValidateState) -> NSAttributedString {
|
||||||
let font = UIFont.preferredFont(forTextStyle: .caption1)
|
let font = UIFont.preferredFont(forTextStyle: .caption1)
|
||||||
let attributeString = NSMutableAttributedString()
|
let attributeString = NSMutableAttributedString()
|
||||||
|
|
||||||
let image = MastodonRegisterViewModel.checkmarkImage(font: font)
|
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: " "))
|
attributeString.append(NSAttributedString(string: " "))
|
||||||
let eightCharactersDescription = NSAttributedString(string: L10n.Scene.Register.Input.Password.hint, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: UIColor.black])
|
let eightCharactersDescription = NSAttributedString(string: L10n.Scene.Register.Input.Password.hint, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: UIColor.black])
|
||||||
attributeString.append(eightCharactersDescription)
|
attributeString.append(eightCharactersDescription)
|
||||||
|
|
Loading…
Reference in New Issue