Declare a static let for TextFieldTableViewCell identifier.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>

[skip ci]
This commit is contained in:
Ivan Sein 2024-10-29 23:58:09 +01:00 коммит произвёл backportbot[bot]
Родитель c1d7c9ea60
Коммит 122306dce5
5 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -119,7 +119,7 @@ import UIKit
self.tableView.dataSource = self self.tableView.dataSource = self
self.tableView.delegate = self self.tableView.delegate = self
self.tableView.keyboardDismissMode = UIScrollView.KeyboardDismissMode.onDrag self.tableView.keyboardDismissMode = UIScrollView.KeyboardDismissMode.onDrag
self.tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: textFieldCellIdentifier) self.tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: TextFieldTableViewCell.identifier)
} }
// MARK: - Table view data source // MARK: - Table view data source
@ -193,7 +193,7 @@ import UIKit
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == PollCreationSection.kPollCreationSectionQuestion.rawValue { if indexPath.section == PollCreationSection.kPollCreationSectionQuestion.rawValue {
let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: textFieldCellIdentifier) let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: TextFieldTableViewCell.identifier)
textInputCell.textField.delegate = self textInputCell.textField.delegate = self
textInputCell.textField.placeholder = NSLocalizedString("Ask a question", comment: "") textInputCell.textField.placeholder = NSLocalizedString("Ask a question", comment: "")
textInputCell.textField.tag = kQuestionTextFieldTag textInputCell.textField.tag = kQuestionTextFieldTag
@ -205,7 +205,7 @@ import UIKit
actionCell.textLabel?.text = NSLocalizedString("Add answer", comment: "") actionCell.textLabel?.text = NSLocalizedString("Add answer", comment: "")
return actionCell return actionCell
} else if indexPath.row < options.count { } else if indexPath.row < options.count {
let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: textFieldCellIdentifier) let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: TextFieldTableViewCell.identifier)
textInputCell.textField.delegate = self textInputCell.textField.delegate = self
textInputCell.textField.placeholder = NSLocalizedString("Answer", comment: "") + " " + String(indexPath.row + 1) textInputCell.textField.placeholder = NSLocalizedString("Answer", comment: "") + " " + String(indexPath.row + 1)
textInputCell.textField.tag = indexPath.row textInputCell.textField.tag = indexPath.row

Просмотреть файл

@ -69,7 +69,7 @@ enum RoomAvatarInfoSection: Int {
self.navigationItem.compactAppearance = appearance self.navigationItem.compactAppearance = appearance
self.navigationItem.scrollEdgeAppearance = appearance self.navigationItem.scrollEdgeAppearance = appearance
self.tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: textFieldCellIdentifier) self.tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: TextFieldTableViewCell.identifier)
self.tableView.register(TextViewTableViewCell.self, forCellReuseIdentifier: TextViewTableViewCell.identifier) self.tableView.register(TextViewTableViewCell.self, forCellReuseIdentifier: TextViewTableViewCell.identifier)
self.tableView.tableHeaderView = self.headerView self.tableView.tableHeaderView = self.headerView
@ -127,7 +127,7 @@ enum RoomAvatarInfoSection: Int {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == RoomAvatarInfoSection.kRoomNameSection.rawValue { if indexPath.section == RoomAvatarInfoSection.kRoomNameSection.rawValue {
let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: textFieldCellIdentifier) let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: TextFieldTableViewCell.identifier)
textInputCell.textField.delegate = self textInputCell.textField.delegate = self
textInputCell.textField.text = self.room.displayName textInputCell.textField.text = self.room.displayName
return textInputCell return textInputCell

Просмотреть файл

@ -90,7 +90,7 @@ enum RoomVisibilityOption: Int {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(self.cancelButtonPressed)) self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(self.cancelButtonPressed))
self.navigationItem.leftBarButtonItem?.tintColor = NCAppBranding.themeTextColor() self.navigationItem.leftBarButtonItem?.tintColor = NCAppBranding.themeTextColor()
self.tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: textFieldCellIdentifier) self.tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: TextFieldTableViewCell.identifier)
self.tableView.register(TextViewTableViewCell.self, forCellReuseIdentifier: TextViewTableViewCell.identifier) self.tableView.register(TextViewTableViewCell.self, forCellReuseIdentifier: TextViewTableViewCell.identifier)
self.tableView.register(UINib(nibName: kContactsTableCellNibName, bundle: nil), forCellReuseIdentifier: kContactCellIdentifier) self.tableView.register(UINib(nibName: kContactsTableCellNibName, bundle: nil), forCellReuseIdentifier: kContactCellIdentifier)
self.tableView.tableHeaderView = self.headerView self.tableView.tableHeaderView = self.headerView
@ -426,7 +426,7 @@ enum RoomVisibilityOption: Int {
let roomCreationSection = sections[indexPath.section] let roomCreationSection = sections[indexPath.section]
if roomCreationSection == RoomCreationSection.kRoomNameSection.rawValue { if roomCreationSection == RoomCreationSection.kRoomNameSection.rawValue {
let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: textFieldCellIdentifier) let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: TextFieldTableViewCell.identifier)
textInputCell.textField.tag = kRoomNameTextFieldTag textInputCell.textField.tag = kRoomNameTextFieldTag
textInputCell.textField.delegate = self textInputCell.textField.delegate = self
textInputCell.textField.text = self.roomName textInputCell.textField.text = self.roomName

Просмотреть файл

@ -5,10 +5,10 @@
import UIKit import UIKit
let textFieldCellIdentifier = "textFieldCellIdentifier"
class TextFieldTableViewCell: UITableViewCell { class TextFieldTableViewCell: UITableViewCell {
static let identifier = "textFieldCellIdentifier"
let textField: UITextField = { let textField: UITextField = {
let textField = UITextField() let textField = UITextField()

Просмотреть файл

@ -76,7 +76,7 @@ class UserProfileTableViewController: UITableViewController, DetailedOptionsSele
modifyingProfileView = UIActivityIndicatorView() modifyingProfileView = UIActivityIndicatorView()
modifyingProfileView.color = NCAppBranding.themeTextColor() modifyingProfileView.color = NCAppBranding.themeTextColor()
tableView.keyboardDismissMode = UIScrollView.KeyboardDismissMode.onDrag tableView.keyboardDismissMode = UIScrollView.KeyboardDismissMode.onDrag
tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: textFieldCellIdentifier) tableView.register(TextFieldTableViewCell.self, forCellReuseIdentifier: TextFieldTableViewCell.identifier)
NotificationCenter.default.addObserver(self, selector: #selector(userProfileImageUpdated), name: NSNotification.Name.NCUserProfileImageUpdated, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userProfileImageUpdated), name: NSNotification.Name.NCUserProfileImageUpdated, object: nil)
if navigationController?.viewControllers.first == self { if navigationController?.viewControllers.first == self {
@ -277,7 +277,7 @@ extension UserProfileTableViewController {
// MARK: Setup cells // MARK: Setup cells
func textInputCellWith(text: String?, tag: Int, interactionEnabled: Bool, keyBoardType: UIKeyboardType = .default, autocapitalizationType: UITextAutocapitalizationType = .sentences, placeHolder: String = "") -> TextFieldTableViewCell { func textInputCellWith(text: String?, tag: Int, interactionEnabled: Bool, keyBoardType: UIKeyboardType = .default, autocapitalizationType: UITextAutocapitalizationType = .sentences, placeHolder: String = "") -> TextFieldTableViewCell {
let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: textFieldCellIdentifier) let textInputCell: TextFieldTableViewCell = tableView.dequeueOrCreateCell(withIdentifier: TextFieldTableViewCell.identifier)
textInputCell.textField.delegate = self textInputCell.textField.delegate = self
textInputCell.textField.text = text textInputCell.textField.text = text