diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index c8b2674b5..f622c97da 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -632,7 +632,6 @@ DB0618022785A7100030EE79 /* RegisterSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterSection.swift; sourceTree = ""; }; DB0618042785A73D0030EE79 /* RegisterItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterItem.swift; sourceTree = ""; }; DB0618062785A8880030EE79 /* MastodonRegisterViewModel+Diffable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MastodonRegisterViewModel+Diffable.swift"; sourceTree = ""; }; - DB0618092785B2AB0030EE79 /* MastodonRegisterAvatarTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonRegisterAvatarTableViewCell.swift; sourceTree = ""; }; DB0A322D280EE9FD001729D2 /* DiscoveryIntroBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoveryIntroBannerView.swift; sourceTree = ""; }; DB0C947626A7FE840088FB11 /* NotificationAvatarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationAvatarButton.swift; sourceTree = ""; }; DB0EF72A26FDB1D200347686 /* SidebarListCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarListCollectionViewCell.swift; sourceTree = ""; }; @@ -855,8 +854,6 @@ DB7A9F922818F33C0016AF98 /* MastodonServerRulesViewController+Debug.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MastodonServerRulesViewController+Debug.swift"; sourceTree = ""; }; DB7F48442620241000796008 /* ProfileHeaderViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileHeaderViewModel.swift; sourceTree = ""; }; DB8190C52601FF0400020C08 /* AttachmentContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentContainerView.swift; sourceTree = ""; }; - DB8481142788121200BBEABA /* MastodonRegisterTextFieldTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonRegisterTextFieldTableViewCell.swift; sourceTree = ""; }; - DB84811627883C2600BBEABA /* MastodonRegisterPasswordHintTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonRegisterPasswordHintTableViewCell.swift; sourceTree = ""; }; DB848E32282B62A800A302CC /* ReportResultView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportResultView.swift; sourceTree = ""; }; DB852D1826FAEB6B00FC9D81 /* SidebarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarViewController.swift; sourceTree = ""; }; DB852D1B26FB021500FC9D81 /* RootSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootSplitViewController.swift; sourceTree = ""; }; @@ -1564,16 +1561,6 @@ path = Cell; sourceTree = ""; }; - DB06180B2785B2AF0030EE79 /* Cell */ = { - isa = PBXGroup; - children = ( - DB0618092785B2AB0030EE79 /* MastodonRegisterAvatarTableViewCell.swift */, - DB8481142788121200BBEABA /* MastodonRegisterTextFieldTableViewCell.swift */, - DB84811627883C2600BBEABA /* MastodonRegisterPasswordHintTableViewCell.swift */, - ); - path = Cell; - sourceTree = ""; - }; DB0A322F280EEA00001729D2 /* View */ = { isa = PBXGroup; children = ( @@ -2540,7 +2527,6 @@ DBE0821A25CD382900FD6BBD /* Register */ = { isa = PBXGroup; children = ( - DB06180B2785B2AF0030EE79 /* Cell */, DBE0821425CD382600FD6BBD /* MastodonRegisterViewController.swift */, 2D939AE725EE1CF80076FA61 /* MastodonRegisterViewController+Avatar.swift */, DBE0822325CD3F1E00FD6BBD /* MastodonRegisterViewModel.swift */, diff --git a/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterAvatarTableViewCell.swift b/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterAvatarTableViewCell.swift deleted file mode 100644 index c4754bb35..000000000 --- a/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterAvatarTableViewCell.swift +++ /dev/null @@ -1,117 +0,0 @@ -// -// MastodonRegisterAvatarTableViewCell.swift -// Mastodon -// -// Created by MainasuK on 2022-1-5. -// - -import UIKit -import Combine -import MastodonAsset -import MastodonLocalization - -//TODO: @zeitschlag Remove -final class MastodonRegisterAvatarTableViewCell: UITableViewCell { - - static let containerSize = CGSize(width: 88, height: 88) - - var disposeBag = Set() - - let containerView: UIView = { - let view = UIView() - view.backgroundColor = .clear - view.layer.masksToBounds = true - view.layer.cornerCurve = .continuous - view.layer.cornerRadius = 22 - return view - }() - - let avatarButton: HighlightDimmableButton = { - let button = HighlightDimmableButton() - button.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color - button.setImage(Asset.Scene.Onboarding.avatarPlaceholder.image, for: .normal) - return button - }() - - let editBannerView: UIView = { - let bannerView = UIView() - bannerView.backgroundColor = UIColor.black.withAlphaComponent(0.5) - bannerView.isUserInteractionEnabled = false - - let label: UILabel = { - let label = UILabel() - label.textColor = .white - label.text = L10n.Common.Controls.Actions.edit - label.font = .systemFont(ofSize: 13, weight: .semibold) - label.textAlignment = .center - label.minimumScaleFactor = 0.5 - label.adjustsFontSizeToFitWidth = true - return label - }() - - label.translatesAutoresizingMaskIntoConstraints = false - bannerView.addSubview(label) - NSLayoutConstraint.activate([ - label.topAnchor.constraint(equalTo: bannerView.topAnchor), - label.leadingAnchor.constraint(equalTo: bannerView.leadingAnchor), - label.trailingAnchor.constraint(equalTo: bannerView.trailingAnchor), - label.bottomAnchor.constraint(equalTo: bannerView.bottomAnchor), - ]) - - return bannerView - }() - - override func prepareForReuse() { - super.prepareForReuse() - - disposeBag.removeAll() - } - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - _init() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - _init() - } - -} - -extension MastodonRegisterAvatarTableViewCell { - - private func _init() { - selectionStyle = .none - backgroundColor = .clear - - containerView.translatesAutoresizingMaskIntoConstraints = false - contentView.addSubview(containerView) - NSLayoutConstraint.activate([ - containerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 22), - containerView.centerXAnchor.constraint(equalTo: contentView.centerXAnchor), - contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: 8), - containerView.widthAnchor.constraint(equalToConstant: MastodonRegisterAvatarTableViewCell.containerSize.width).priority(.required - 1), - containerView.heightAnchor.constraint(equalToConstant: MastodonRegisterAvatarTableViewCell.containerSize.height).priority(.required - 1), - ]) - - avatarButton.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(avatarButton) - NSLayoutConstraint.activate([ - avatarButton.topAnchor.constraint(equalTo: containerView.topAnchor), - avatarButton.leadingAnchor.constraint(equalTo: containerView.leadingAnchor), - avatarButton.trailingAnchor.constraint(equalTo: containerView.trailingAnchor), - avatarButton.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), - ]) - - editBannerView.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(editBannerView) - NSLayoutConstraint.activate([ - editBannerView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor), - editBannerView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor), - editBannerView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), - editBannerView.heightAnchor.constraint(equalToConstant: 22), - ]) - } - -} diff --git a/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterPasswordHintTableViewCell.swift b/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterPasswordHintTableViewCell.swift deleted file mode 100644 index ba088f061..000000000 --- a/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterPasswordHintTableViewCell.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// MastodonRegisterPasswordHintTableViewCell.swift -// Mastodon -// -// Created by MainasuK on 2022-1-7. -// - -import UIKit -import MastodonAsset -import MastodonLocalization - -//TODO: @zeitschlag Remove -final class MastodonRegisterPasswordHintTableViewCell: UITableViewCell { - - let passwordRuleLabel: UILabel = { - let label = UILabel() - label.font = .preferredFont(forTextStyle: .footnote) - label.textColor = Asset.Colors.Label.secondary.color - label.text = L10n.Scene.Register.Input.Password.hint - return label - }() - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - _init() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - _init() - } - -} - -extension MastodonRegisterPasswordHintTableViewCell { - - private func _init() { - selectionStyle = .none - backgroundColor = .clear - - passwordRuleLabel.translatesAutoresizingMaskIntoConstraints = false - contentView.addSubview(passwordRuleLabel) - NSLayoutConstraint.activate([ - passwordRuleLabel.topAnchor.constraint(equalTo: contentView.topAnchor), - passwordRuleLabel.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor), - passwordRuleLabel.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor), - passwordRuleLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), - ]) - } - -} diff --git a/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterTextFieldTableViewCell.swift b/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterTextFieldTableViewCell.swift deleted file mode 100644 index 9bbdd8044..000000000 --- a/Mastodon/Scene/Onboarding/Register/Cell/MastodonRegisterTextFieldTableViewCell.swift +++ /dev/null @@ -1,142 +0,0 @@ -// -// MastodonRegisterTextFieldTableViewCell.swift -// Mastodon -// -// Created by MainasuK on 2022-1-7. -// - -import UIKit -import Combine -import MastodonUI -import MastodonAsset -import MastodonLocalization - -//TODO: @zeitschlag Removefinal class MastodonRegisterTextFieldTableViewCell: UITableViewCell { - - static let textFieldHeight: CGFloat = 50 - static let textFieldLabelFont = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold), maximumPointSize: 22) - - var disposeBag = Set() - - let textFieldShadowContainer = ShadowBackgroundContainer() - let textField: UITextField = { - let textField = UITextField() - textField.font = MastodonRegisterTextFieldTableViewCell.textFieldLabelFont - textField.backgroundColor = Asset.Scene.Onboarding.textFieldBackground.color - textField.layer.masksToBounds = true - textField.layer.cornerRadius = 10 - textField.layer.cornerCurve = .continuous - return textField - }() - - override func prepareForReuse() { - super.prepareForReuse() - - disposeBag.removeAll() - textFieldShadowContainer.shadowColor = .black - textFieldShadowContainer.shadowAlpha = 0.25 - resetTextField() - } - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - _init() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - _init() - } - -} - -extension MastodonRegisterTextFieldTableViewCell { - - private func _init() { - selectionStyle = .none - backgroundColor = .clear - - textFieldShadowContainer.translatesAutoresizingMaskIntoConstraints = false - contentView.addSubview(textFieldShadowContainer) - NSLayoutConstraint.activate([ - textFieldShadowContainer.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 6), - textFieldShadowContainer.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor), - textFieldShadowContainer.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor), - contentView.bottomAnchor.constraint(equalTo: textFieldShadowContainer.bottomAnchor, constant: 6), - ]) - - textField.translatesAutoresizingMaskIntoConstraints = false - textFieldShadowContainer.addSubview(textField) - NSLayoutConstraint.activate([ - textField.topAnchor.constraint(equalTo: textFieldShadowContainer.topAnchor), - textField.leadingAnchor.constraint(equalTo: textFieldShadowContainer.leadingAnchor), - textField.trailingAnchor.constraint(equalTo: textFieldShadowContainer.trailingAnchor), - textField.bottomAnchor.constraint(equalTo: textFieldShadowContainer.bottomAnchor), - textField.heightAnchor.constraint(equalToConstant: MastodonRegisterTextFieldTableViewCell.textFieldHeight).priority(.required - 1), - ]) - - resetTextField() - } - -} - -extension MastodonRegisterTextFieldTableViewCell { - func resetTextField() { - textField.keyboardType = .default - textField.autocorrectionType = .default - textField.autocapitalizationType = .none - textField.attributedPlaceholder = nil - textField.isSecureTextEntry = false - textField.textAlignment = .natural - textField.semanticContentAttribute = .unspecified - - let paddingRect = CGRect(x: 0, y: 0, width: 16, height: 10) - textField.leftView = UIView(frame: paddingRect) - textField.leftViewMode = .always - textField.rightView = UIView(frame: paddingRect) - textField.rightViewMode = .always - } - - func setupTextViewRightView(text: String) { - textField.rightView = { - let containerView = UIView() - - let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 8, height: MastodonRegisterTextFieldTableViewCell.textFieldHeight)) - paddingView.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(paddingView) - NSLayoutConstraint.activate([ - paddingView.topAnchor.constraint(equalTo: containerView.topAnchor), - paddingView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor), - paddingView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), - paddingView.widthAnchor.constraint(equalToConstant: 8).priority(.defaultHigh), - ]) - - let label = UILabel() - label.font = MastodonRegisterTextFieldTableViewCell.textFieldLabelFont - label.textColor = Asset.Colors.Label.primary.color - label.text = text - label.lineBreakMode = .byTruncatingMiddle - - label.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(label) - NSLayoutConstraint.activate([ - label.topAnchor.constraint(equalTo: containerView.topAnchor), - label.leadingAnchor.constraint(equalTo: paddingView.trailingAnchor), - containerView.trailingAnchor.constraint(equalTo: label.trailingAnchor, constant: 16), - label.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), - label.widthAnchor.constraint(lessThanOrEqualToConstant: 180).priority(.required - 1), - ]) - return containerView - }() - } - - func setupTextViewPlaceholder(text: String) { - textField.attributedPlaceholder = NSAttributedString( - string: text, - attributes: [ - .foregroundColor: Asset.Colors.Label.secondary.color, - .font: MastodonRegisterTextFieldTableViewCell.textFieldLabelFont - ] - ) - } -} diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift index f1e0d8903..b3e2a2cdb 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift @@ -10,146 +10,6 @@ import Combine import MastodonAsset import MastodonLocalization -extension MastodonRegisterViewModel { - //TODO: @zeitschlag Remove, as the screen is based on SwiftUI now - func setupDiffableDataSource( - tableView: UITableView - ) { - tableView.register(OnboardingHeadlineTableViewCell.self, forCellReuseIdentifier: String(describing: OnboardingHeadlineTableViewCell.self)) - tableView.register(MastodonRegisterAvatarTableViewCell.self, forCellReuseIdentifier: String(describing: MastodonRegisterAvatarTableViewCell.self)) - tableView.register(MastodonRegisterTextFieldTableViewCell.self, forCellReuseIdentifier: String(describing: MastodonRegisterTextFieldTableViewCell.self)) - tableView.register(MastodonRegisterPasswordHintTableViewCell.self, forCellReuseIdentifier: String(describing: MastodonRegisterPasswordHintTableViewCell.self)) - - diffableDataSource = UITableViewDiffableDataSource(tableView: tableView) { tableView, indexPath, item in - switch item { - case .header(let domain): - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: OnboardingHeadlineTableViewCell.self), for: indexPath) as! OnboardingHeadlineTableViewCell - cell.titleLabel.text = L10n.Scene.Register.letsGetYouSetUpOnDomain(domain) - cell.subTitleLabel.isHidden = true - return cell - case .avatar: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterAvatarTableViewCell.self), for: indexPath) as! MastodonRegisterAvatarTableViewCell - self.configureAvatar(cell: cell) - return cell - case .name: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterTextFieldTableViewCell.self), for: indexPath) as! MastodonRegisterTextFieldTableViewCell - cell.setupTextViewPlaceholder(text: L10n.Scene.Register.Input.DisplayName.placeholder) - cell.textField.keyboardType = .default - cell.textField.autocapitalizationType = .words - cell.textField.text = self.name - NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: cell.textField) - .receive(on: DispatchQueue.main) - .compactMap { notification in - guard let textField = notification.object as? UITextField else { - assertionFailure() - return nil - } - return textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - } - .assign(to: \.name, on: self) - .store(in: &cell.disposeBag) - return cell - case .username: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterTextFieldTableViewCell.self), for: indexPath) as! MastodonRegisterTextFieldTableViewCell - cell.setupTextViewRightView(text: "@" + self.domain) - cell.setupTextViewPlaceholder(text: L10n.Scene.Register.Input.Username.placeholder) - cell.textField.keyboardType = .alphabet - cell.textField.autocorrectionType = .no - cell.textField.text = self.username - cell.textField.textAlignment = .left - cell.textField.semanticContentAttribute = .forceLeftToRight - NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: cell.textField) - .receive(on: DispatchQueue.main) - .compactMap { notification in - guard let textField = notification.object as? UITextField else { - assertionFailure() - return nil - } - return textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - } - .assign(to: \.username, on: self) - .store(in: &cell.disposeBag) - self.configureTextFieldCell(cell: cell, validateState: self.$usernameValidateState) - return cell - case .email: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterTextFieldTableViewCell.self), for: indexPath) as! MastodonRegisterTextFieldTableViewCell - cell.setupTextViewPlaceholder(text: L10n.Scene.Register.Input.Email.placeholder) - cell.textField.keyboardType = .emailAddress - cell.textField.autocorrectionType = .no - cell.textField.text = self.email - NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: cell.textField) - .receive(on: DispatchQueue.main) - .compactMap { notification in - guard let textField = notification.object as? UITextField else { - assertionFailure() - return nil - } - return textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - } - .assign(to: \.email, on: self) - .store(in: &cell.disposeBag) - self.configureTextFieldCell(cell: cell, validateState: self.$emailValidateState) - return cell - case .password: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterTextFieldTableViewCell.self), for: indexPath) as! MastodonRegisterTextFieldTableViewCell - cell.setupTextViewPlaceholder(text: L10n.Scene.Register.Input.Password.placeholder) - cell.textField.keyboardType = .alphabet - cell.textField.autocorrectionType = .no - cell.textField.isSecureTextEntry = true - cell.textField.text = self.password - cell.textField.textAlignment = .left - cell.textField.semanticContentAttribute = .forceLeftToRight - NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: cell.textField) - .receive(on: DispatchQueue.main) - .compactMap { notification in - guard let textField = notification.object as? UITextField else { - assertionFailure() - return nil - } - return textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - } - .assign(to: \.password, on: self) - .store(in: &cell.disposeBag) - self.configureTextFieldCell(cell: cell, validateState: self.$passwordValidateState) - return cell - case .hint: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterPasswordHintTableViewCell.self), for: indexPath) as! MastodonRegisterPasswordHintTableViewCell - return cell - case .reason: - let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: MastodonRegisterTextFieldTableViewCell.self), for: indexPath) as! MastodonRegisterTextFieldTableViewCell - cell.setupTextViewPlaceholder(text: L10n.Scene.Register.Input.Invite.registrationUserInviteRequest) - cell.textField.keyboardType = .default - cell.textField.text = self.reason - NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: cell.textField) - .receive(on: DispatchQueue.main) - .compactMap { notification in - guard let textField = notification.object as? UITextField else { - assertionFailure() - return nil - } - return textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - } - .assign(to: \.reason, on: self) - .store(in: &cell.disposeBag) - self.configureTextFieldCell(cell: cell, validateState: self.$reasonValidateState) - return cell - default: - assertionFailure() - return UITableViewCell() - } - } - - var snapshot = NSDiffableDataSourceSnapshot() - snapshot.appendSections([.main]) - snapshot.appendItems([.header(domain: domain)], toSection: .main) - snapshot.appendItems([.avatar, .name, .username, .email, .password, .hint], toSection: .main) - if approvalRequired { - snapshot.appendItems([.reason], toSection: .main) - } - diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil) - } -} - extension MastodonRegisterViewModel { private func configureAvatar(cell: MastodonRegisterAvatarTableViewCell) { self.$avatarImage