chore: update password hint, handle error when use PhotosUI
This commit is contained in:
parent
eb2057d14e
commit
f16b4ed1cb
|
@ -108,8 +108,7 @@
|
|||
},
|
||||
"password": {
|
||||
"placeholder": "password",
|
||||
"prompt": "Your password needs at least:",
|
||||
"prompt_eight_characters": "Eight characters"
|
||||
"hint": "Your password needs at least Eight characters"
|
||||
},
|
||||
"invite": {
|
||||
"registration_user_invite_request": "Why do you want to join?"
|
||||
|
|
|
@ -192,12 +192,10 @@ internal enum L10n {
|
|||
internal static let registrationUserInviteRequest = L10n.tr("Localizable", "Scene.Register.Input.Invite.RegistrationUserInviteRequest")
|
||||
}
|
||||
internal enum Password {
|
||||
/// Your password needs at least Eight characters
|
||||
internal static let hint = L10n.tr("Localizable", "Scene.Register.Input.Password.Hint")
|
||||
/// password
|
||||
internal static let placeholder = L10n.tr("Localizable", "Scene.Register.Input.Password.Placeholder")
|
||||
/// Your password needs at least:
|
||||
internal static let prompt = L10n.tr("Localizable", "Scene.Register.Input.Password.Prompt")
|
||||
/// Eight characters
|
||||
internal static let promptEightCharacters = L10n.tr("Localizable", "Scene.Register.Input.Password.PromptEightCharacters")
|
||||
}
|
||||
internal enum Username {
|
||||
/// This username is taken.
|
||||
|
|
|
@ -61,9 +61,8 @@ tap the link to confirm your account.";
|
|||
"Scene.Register.Input.DisplayName.Placeholder" = "display name";
|
||||
"Scene.Register.Input.Email.Placeholder" = "email";
|
||||
"Scene.Register.Input.Invite.RegistrationUserInviteRequest" = "Why do you want to join?";
|
||||
"Scene.Register.Input.Password.Hint" = "Your password needs at least Eight characters";
|
||||
"Scene.Register.Input.Password.Placeholder" = "password";
|
||||
"Scene.Register.Input.Password.Prompt" = "Your password needs at least:";
|
||||
"Scene.Register.Input.Password.PromptEightCharacters" = "Eight characters";
|
||||
"Scene.Register.Input.Username.DuplicatePrompt" = "This username is taken.";
|
||||
"Scene.Register.Input.Username.Placeholder" = "username";
|
||||
"Scene.Register.Success" = "Success";
|
||||
|
|
|
@ -16,12 +16,27 @@ extension MastodonRegisterViewController: CropViewControllerDelegate, PHPickerVi
|
|||
picker.dismiss(animated: true, completion: {})
|
||||
return
|
||||
}
|
||||
itemProvider.loadObject(ofClass: UIImage.self) { [weak self] image, _ in
|
||||
guard let self = self, let image = image as? UIImage else { return }
|
||||
itemProvider.loadObject(ofClass: UIImage.self) { [weak self] image, error in
|
||||
guard let self = self else { return }
|
||||
guard let image = image as? UIImage else {
|
||||
guard let error = error else { return }
|
||||
let alertController = UIAlertController(for: error, title: "", preferredStyle: .alert)
|
||||
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil)
|
||||
alertController.addAction(okAction)
|
||||
DispatchQueue.main.async {
|
||||
self.coordinator.present(
|
||||
scene: .alertController(alertController: alertController),
|
||||
from: nil,
|
||||
transition: .alertController(animated: true, completion: nil)
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
let cropController = CropViewController(croppingStyle: .default, image: image)
|
||||
cropController.delegate = self
|
||||
cropController.setAspectRatioPreset(.presetSquare, animated: true)
|
||||
cropController.aspectRatioPickerButtonHidden = true
|
||||
cropController.aspectRatioLockEnabled = true
|
||||
picker.dismiss(animated: true, completion: {
|
||||
self.present(cropController, animated: true, completion: nil)
|
||||
|
@ -37,11 +52,6 @@ extension MastodonRegisterViewController: CropViewControllerDelegate, PHPickerVi
|
|||
}
|
||||
|
||||
@objc func avatarButtonPressed(_ sender: UIButton) {
|
||||
var configuration = PHPickerConfiguration()
|
||||
configuration.filter = .images
|
||||
|
||||
let imagePicker = PHPickerViewController(configuration: configuration)
|
||||
imagePicker.delegate = self
|
||||
self.present(imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import MastodonSDK
|
|||
import os.log
|
||||
import UIKit
|
||||
import UITextField_Shake
|
||||
import PhotosUI
|
||||
|
||||
final class MastodonRegisterViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
@ -19,6 +20,15 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
|||
|
||||
var viewModel: MastodonRegisterViewModel!
|
||||
|
||||
lazy var imagePicker: PHPickerViewController = {
|
||||
var configuration = PHPickerConfiguration()
|
||||
configuration.filter = .images
|
||||
|
||||
let imagePicker = PHPickerViewController(configuration: configuration)
|
||||
imagePicker.delegate = self
|
||||
return imagePicker
|
||||
}()
|
||||
|
||||
let tapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
|
||||
|
||||
let scrollView: UIScrollView = {
|
||||
|
|
|
@ -161,11 +161,8 @@ extension MastodonRegisterViewModel {
|
|||
let falseColor = UIColor.clear
|
||||
let attributeString = NSMutableAttributedString()
|
||||
|
||||
let start = NSAttributedString(string: "Your password needs at least:", attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color])
|
||||
attributeString.append(start)
|
||||
|
||||
attributeString.append(checkmarkImage(color: eightCharacters ? color : falseColor))
|
||||
let eightCharactersDescription = NSAttributedString(string: " Eight characters\n", attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color])
|
||||
let eightCharactersDescription = NSAttributedString(string: L10n.Scene.Register.Input.Password.hint, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color])
|
||||
attributeString.append(eightCharactersDescription)
|
||||
|
||||
return attributeString
|
||||
|
|
Loading…
Reference in New Issue