From 72dafca45083705cd4d42b1cea4f674eb0f01588 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 6 Dec 2023 16:50:13 -0600 Subject: [PATCH 1/9] Delete WKEditorInputViewController, re-implement as single WKEditorInputView - Fixes strange bug of empty keyboard input view on iPad mini --- .../Input Views/WKEditorInputView.swift | 310 ++++++++++++++++++ .../WKEditorInputViewController.swift | 118 ------- 2 files changed, 310 insertions(+), 118 deletions(-) create mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputViewController.swift diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift new file mode 100644 index 00000000000..084caf7be17 --- /dev/null +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift @@ -0,0 +1,310 @@ +import Foundation +import UIKit + +protocol WKEditorInputViewDelegate: AnyObject { + func didTapClose() + func didTapBold(isSelected: Bool) + func didTapItalics(isSelected: Bool) + func didTapTemplate(isSelected: Bool) +} + +class WKEditorInputView: WKComponentView { + + // MARK: - Nested Types + + enum HeadingButtonType { + case paragraph + case heading + case subheading1 + case subheading2 + case subheading3 + case subheading4 + + var title: String { + switch self { + case .paragraph: return WKSourceEditorLocalizedStrings.current.inputViewParagraph + case .heading: return WKSourceEditorLocalizedStrings.current.inputViewHeading + case .subheading1: return WKSourceEditorLocalizedStrings.current.inputViewSubheading1 + case .subheading2: return WKSourceEditorLocalizedStrings.current.inputViewSubheading2 + case .subheading3: return WKSourceEditorLocalizedStrings.current.inputViewSubheading3 + case .subheading4: return WKSourceEditorLocalizedStrings.current.inputViewSubheading4 + } + } + } + + // MARK: - Properties + + private lazy var navigationStackView: UIStackView = { + let stackView = UIStackView() + stackView.translatesAutoresizingMaskIntoConstraints = false + stackView.axis = .horizontal + stackView.distribution = .fill + stackView.alignment = .fill + return stackView + }() + + private lazy var titleLabel: UILabel = { + let label = UILabel() + label.translatesAutoresizingMaskIntoConstraints = false + label.adjustsFontForContentSizeCategory = true + label.font = WKFont.for(.headline, compatibleWith: appEnvironment.traitCollection) + label.text = WKSourceEditorLocalizedStrings.current.inputViewTextFormatting + label.setContentHuggingPriority(.defaultLow, for: .horizontal) + return label + }() + + private lazy var closeButton: UIButton = { + let button = UIButton() + button.translatesAutoresizingMaskIntoConstraints = false + button.setImage(WKSFSymbolIcon.for(symbol: .multiplyCircleFill), for: .normal) + button.addTarget(self, action: #selector(close(_:)), for: .touchUpInside) + button.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.closeButton + button.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonCloseMainInputView + return button + }() + + private lazy var containerScrollView: UIScrollView = { + let scrollView = UIScrollView() + scrollView.translatesAutoresizingMaskIntoConstraints = false + return scrollView + }() + + private lazy var containerStackView: UIStackView = { + let stackView = UIStackView() + stackView.translatesAutoresizingMaskIntoConstraints = false + stackView.axis = .vertical + stackView.distribution = .fill + stackView.alignment = .fill + return stackView + }() + + private lazy var headingScrollView: UIScrollView = { + let scrollView = UIScrollView() + scrollView.translatesAutoresizingMaskIntoConstraints = false + return scrollView + }() + + private lazy var headingStackView: UIStackView = { + let stackView = UIStackView() + stackView.translatesAutoresizingMaskIntoConstraints = false + stackView.axis = .horizontal + stackView.distribution = .fill + stackView.alignment = .fill + return stackView + }() + + private lazy var plainToolbarView: WKEditorToolbarPlainView = { + let view = UINib(nibName: String(describing: WKEditorToolbarPlainView.self), bundle: Bundle.module).instantiate(withOwner: nil).first as! WKEditorToolbarPlainView + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() + + private lazy var groupedToolbarView: WKEditorToolbarGroupedView = { + let view = UINib(nibName: String(describing: WKEditorToolbarGroupedView.self), bundle: Bundle.module).instantiate(withOwner: nil).first as! WKEditorToolbarGroupedView + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() + + private lazy var headerSelectViewController: WKEditorInputHeaderSelectViewController = { + let vc = WKEditorInputHeaderSelectViewController(configuration: .leftTitleNav, delegate: delegate) + return vc + }() + + private lazy var mainViewController: WKEditorInputMainViewController = { + let vc = WKEditorInputMainViewController() + vc.delegate = delegate + return vc + }() + + // Heading Buttons + private var paragraphButton: UIButton! + private var headerButton: UIButton! + private var subheader1Button: UIButton! + private var subheader2Button: UIButton! + private var subheader3Button: UIButton! + private var subheader4Button: UIButton! + + var headingButtons: [UIButton] { + return [paragraphButton, headerButton, subheader1Button, subheader2Button, subheader3Button, subheader4Button] + } + + private var divViews: [UIView] = [] + + private weak var delegate: WKEditorInputViewDelegate? + + // MARK: - Lifecycle + + init(delegate: WKEditorInputViewDelegate) { + self.delegate = delegate + super.init(frame: .zero) + setup() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setup() { + + addSubview(navigationStackView) + navigationStackView.addArrangedSubview(titleLabel) + navigationStackView.addArrangedSubview(closeButton) + + // pin navigation stack view to top + NSLayoutConstraint.activate([ + navigationStackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 12), + navigationStackView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 16), + safeAreaLayoutGuide.trailingAnchor.constraint(equalTo: navigationStackView.trailingAnchor, constant: 16) + ]) + + // ---- Headings ---- + + self.paragraphButton = headingButton(type: .paragraph) + self.paragraphButton.isSelected = true + self.headerButton = headingButton(type: .heading) + self.subheader1Button = headingButton(type: .subheading1) + self.subheader2Button = headingButton(type: .subheading2) + self.subheader3Button = headingButton(type: .subheading3) + self.subheader4Button = headingButton(type: .subheading4) + + headingStackView.addArrangedSubview(paragraphButton) + headingStackView.addArrangedSubview(headerButton) + headingStackView.addArrangedSubview(subheader1Button) + headingStackView.addArrangedSubview(subheader2Button) + headingStackView.addArrangedSubview(subheader3Button) + headingStackView.addArrangedSubview(subheader4Button) + + headingScrollView.addSubview(headingStackView) + + let headerButtonSize = headerButton.sizeThatFits(bounds.size) + + // pin heading stack to heading scroll view content guide + // ensure it only scrolls horizontally + // set heading scroll view height to largest button height + NSLayoutConstraint.activate([ + headingScrollView.contentLayoutGuide.topAnchor.constraint(equalTo: headingStackView.topAnchor), + headingStackView.leadingAnchor.constraint(equalTo: headingScrollView.contentLayoutGuide.leadingAnchor, constant: 16), + headingScrollView.contentLayoutGuide.trailingAnchor.constraint(equalTo: headingStackView.trailingAnchor, constant: 16), + headingScrollView.contentLayoutGuide.bottomAnchor.constraint(equalTo: headingStackView.bottomAnchor), + headingScrollView.contentLayoutGuide.heightAnchor.constraint(equalTo: headingScrollView.frameLayoutGuide.heightAnchor), + headingScrollView.heightAnchor.constraint(equalToConstant: headerButtonSize.height) + ]) + + // ---- Container ---- + + containerStackView.addArrangedSubview(headingScrollView) + let divView1 = divView() + containerStackView.addArrangedSubview(divView1) + containerStackView.addArrangedSubview(plainToolbarView) + let divView2 = divView() + containerStackView.addArrangedSubview(divView1) + containerStackView.addArrangedSubview(groupedToolbarView) + let divView3 = divView() + containerStackView.addArrangedSubview(divView3) + containerScrollView.addSubview(containerStackView) + + self.divViews = [divView1, divView2, divView3] + + // pin container stack view to container scroll view content guide + NSLayoutConstraint.activate([ + containerScrollView.contentLayoutGuide.topAnchor.constraint(equalTo: containerStackView.topAnchor), + containerScrollView.contentLayoutGuide.leadingAnchor.constraint(equalTo: containerStackView.leadingAnchor), + containerScrollView.contentLayoutGuide.trailingAnchor.constraint(equalTo: containerStackView.trailingAnchor), + containerScrollView.contentLayoutGuide.bottomAnchor.constraint(equalTo: containerStackView.bottomAnchor) + ]) + + addSubview(containerScrollView) + + // pin scroll view frame guide to outer views + NSLayoutConstraint.activate([ + containerScrollView.frameLayoutGuide.topAnchor.constraint(equalTo: navigationStackView.bottomAnchor, constant: 18), + containerScrollView.frameLayoutGuide.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor), + containerScrollView.frameLayoutGuide.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor), + containerScrollView.frameLayoutGuide.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor) + ]) + + // Ensure it only scrolls vertically + NSLayoutConstraint.activate([ + containerScrollView.contentLayoutGuide.widthAnchor.constraint(equalTo: containerScrollView.frameLayoutGuide.widthAnchor) + ]) + + updateColors() + } + + // MARK: - Overrides + + override func appEnvironmentDidChange() { + updateColors() + } + + // MARK: - Button Actions + + @objc private func close(_ sender: UIBarButtonItem) { + delegate?.didTapClose() + } + + // MARK: - Private Helpers + + private func updateColors() { + backgroundColor = WKAppEnvironment.current.theme.accessoryBackground + titleLabel.textColor = WKAppEnvironment.current.theme.text + closeButton.tintColor = WKAppEnvironment.current.theme.inputAccessoryButtonTint + divViews.forEach { view in + view.backgroundColor = WKAppEnvironment.current.theme.border + } + } + + private func divView() -> UIView { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + view.heightAnchor.constraint(equalToConstant: 0.5).isActive = true + return view + } + + private func headingButton(type: HeadingButtonType) -> UIButton { + + let font: UIFont + switch type { + case .paragraph: font = WKFont.for(.body, compatibleWith: traitCollection) + case .heading: font = WKFont.for(.headline, compatibleWith: traitCollection) + default: font = WKFont.for(.subheadline, compatibleWith: traitCollection) + } + + var configuration = UIButton.Configuration.plain() + configuration.titleTextAttributesTransformer = + UIConfigurationTextAttributesTransformer { incoming in + var outgoing = incoming + outgoing.font = font + outgoing.foregroundColor = WKAppEnvironment.current.theme.text + return outgoing + } + configuration.contentInsets = NSDirectionalEdgeInsets(top: 19, leading: 12, bottom: 19, trailing: 12) + let action = UIAction(title: type.title, handler: { [weak self] _ in + + guard let self else { + return + } + + self.headingButtons.forEach { button in + button.isSelected = false + } + + switch type { + case .paragraph: + paragraphButton.isSelected.toggle() + case .heading: + headerButton.isSelected.toggle() + case .subheading1: + subheader1Button.isSelected.toggle() + case .subheading2: + subheader2Button.isSelected.toggle() + case .subheading3: + subheader3Button.isSelected.toggle() + case .subheading4: + subheader4Button.isSelected.toggle() + } + }) + + return UIButton(configuration: configuration, primaryAction: action) + } +} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputViewController.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputViewController.swift deleted file mode 100644 index a2ae309b88f..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputViewController.swift +++ /dev/null @@ -1,118 +0,0 @@ -import Foundation -import UIKit - -protocol WKEditorInputViewDelegate: AnyObject { - func didTapClose() - func didTapBold(isSelected: Bool) - func didTapItalics(isSelected: Bool) - func didTapTemplate(isSelected: Bool) -} - -class WKEditorInputViewController: WKComponentViewController { - - // MARK: - Nested Types - - enum Configuration { - case rootMain - case rootHeaderSelect - } - - // MARK: - Properties - - private lazy var containerView: UIView = { - let view = UIView() - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - private lazy var embeddedNavigationController: UINavigationController = { - let viewController = rootViewController(for: configuration) - let navigationController = UINavigationController(rootViewController: viewController) - return navigationController - }() - - private lazy var headerSelectViewController: WKEditorInputHeaderSelectViewController = { - let vc = WKEditorInputHeaderSelectViewController(configuration: .leftTitleNav, delegate: delegate) - return vc - }() - - private lazy var mainViewController: WKEditorInputMainViewController = { - let vc = WKEditorInputMainViewController() - vc.delegate = delegate - return vc - }() - - private let configuration: Configuration - private weak var delegate: WKEditorInputViewDelegate? - - // MARK: - Lifecycle - - init(configuration: Configuration, delegate: WKEditorInputViewDelegate) { - self.configuration = configuration - self.delegate = delegate - super.init() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - - super.viewDidLoad() - - view.addSubview(containerView) - NSLayoutConstraint.activate([ - view.leadingAnchor.constraint(equalTo: containerView.leadingAnchor), - view.trailingAnchor.constraint(equalTo: containerView.trailingAnchor), - view.topAnchor.constraint(equalTo: containerView.topAnchor), - view.bottomAnchor.constraint(equalTo: containerView.bottomAnchor) - ]) - - embedNavigationController() - - updateColors() - } - - // MARK: - Overrides - - override func appEnvironmentDidChange() { - updateColors() - } - - // MARK: - Private Helpers - - private func embedNavigationController() { - addChild(embeddedNavigationController) - embeddedNavigationController.view.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(embeddedNavigationController.view) - - NSLayoutConstraint.activate([ - containerView.leadingAnchor.constraint(equalTo: embeddedNavigationController.view.leadingAnchor), - containerView.trailingAnchor.constraint(equalTo: embeddedNavigationController.view.trailingAnchor), - containerView.topAnchor.constraint(equalTo: embeddedNavigationController.view.topAnchor), - containerView.bottomAnchor.constraint(equalTo: embeddedNavigationController.view.bottomAnchor) - ]) - - embeddedNavigationController.didMove(toParent: self) - } - - private func rootViewController(for configuration: Configuration) -> UIViewController { - var viewController: UIViewController - - switch configuration { - case .rootMain: - viewController = mainViewController - case .rootHeaderSelect: - viewController = headerSelectViewController - } - return viewController - } - - private func updateColors() { - view.backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - embeddedNavigationController.navigationBar.isTranslucent = false - embeddedNavigationController.navigationBar.tintColor = WKAppEnvironment.current.theme.inputAccessoryButtonTint - embeddedNavigationController.navigationBar.backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - } -} From 0ce46e08cc211fa1a22f3844b95b2d3330f8ecd9 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 6 Dec 2023 17:06:55 -0600 Subject: [PATCH 2/9] Use new input view in WKSourceEditorViewController --- .../WKEditorToolbarExpandingView.swift | 2 - .../WKEditorToolbarHighlightView.swift | 2 - .../WKSourceEditorViewController.swift | 79 +++---------------- 3 files changed, 12 insertions(+), 71 deletions(-) diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift index bbf183ad600..832bcd25baa 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift @@ -3,7 +3,6 @@ import UIKit protocol WKEditorToolbarExpandingViewDelegate: AnyObject { func toolbarExpandingViewDidTapFind(toolbarView: WKEditorToolbarExpandingView) func toolbarExpandingViewDidTapFormatText(toolbarView: WKEditorToolbarExpandingView) - func toolbarExpandingViewDidTapFormatHeading(toolbarView: WKEditorToolbarExpandingView) func toolbarExpandingViewDidTapTemplate(toolbarView: WKEditorToolbarExpandingView, isSelected: Bool) } @@ -197,7 +196,6 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView { } @objc private func tappedFormatHeading() { - delegate?.toolbarExpandingViewDidTapFormatHeading(toolbarView: self) } @objc private func tappedCitation() { diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift index 7003ab32d0c..373b36213e8 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift @@ -5,7 +5,6 @@ protocol WKEditorToolbarHighlightViewDelegate: AnyObject { func toolbarHighlightViewDidTapItalics(toolbarView: WKEditorToolbarHighlightView, isSelected: Bool) func toolbarHighlightViewDidTapTemplate(toolbarView: WKEditorToolbarHighlightView, isSelected: Bool) func toolbarHighlightViewDidTapShowMore(toolbarView: WKEditorToolbarHighlightView) - func toolbarHighlightViewDidTapFormatHeading(toolbarView: WKEditorToolbarHighlightView) } class WKEditorToolbarHighlightView: WKEditorToolbarView { @@ -93,7 +92,6 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView { } @objc private func tappedFormatHeading() { - delegate?.toolbarHighlightViewDidTapFormatHeading(toolbarView: self) } @objc private func tappedCitation() { diff --git a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift index 5a5d7447287..9f601089605 100644 --- a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift +++ b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift @@ -20,12 +20,7 @@ extension Notification { public class WKSourceEditorViewController: WKComponentViewController { // MARK: Nested Types - - enum InputViewType { - case main - case headerSelect - } - + enum InputAccessoryViewType { case expanding case highlight @@ -68,64 +63,22 @@ public class WKSourceEditorViewController: WKComponentViewController { // Input Views - private var _mainInputView: UIView? - private var mainInputView: UIView? { - get { - guard _mainInputView == nil else { - return _mainInputView - } - - let inputViewController = WKEditorInputViewController(configuration: .rootMain, delegate: self) - inputViewController.loadViewIfNeeded() - - _mainInputView = inputViewController.view - - return inputViewController.view - } - set { - _mainInputView = newValue - } - } - - private var _headerSelectionInputView: UIView? - private var headerSelectionInputView: UIView? { - get { - guard _headerSelectionInputView == nil else { - return _headerSelectionInputView - } - - let inputViewController = WKEditorInputViewController(configuration: .rootHeaderSelect, delegate: self) - inputViewController.loadViewIfNeeded() - - _headerSelectionInputView = inputViewController.view - - return inputViewController.view - } - set { - _headerSelectionInputView = newValue - } - } + private lazy var editorInputView: UIView? = { + return WKEditorInputView(delegate: self) + }() - // Input Types + // Input Tracking Properties - var inputViewType: InputViewType? = nil { + var editorInputViewIsShowing: Bool? = false { didSet { - guard let inputViewType else { - mainInputView = nil - headerSelectionInputView = nil + guard editorInputViewIsShowing == true else { textView.inputView = nil textView.reloadInputViews() return } - switch inputViewType { - case .main: - textView.inputView = mainInputView - case .headerSelect: - textView.inputView = headerSelectionInputView - } - + textView.inputView = editorInputView textView.inputAccessoryView = nil textView.reloadInputViews() } @@ -278,7 +231,7 @@ private extension WKSourceEditorViewController { extension WKSourceEditorViewController: UITextViewDelegate { public func textViewDidChangeSelection(_ textView: UITextView) { - guard inputViewType == nil else { + guard editorInputViewIsShowing == false else { postUpdateButtonSelectionStatesNotification(withDelay: false) return } @@ -298,14 +251,10 @@ extension WKSourceEditorViewController: WKEditorToolbarExpandingViewDelegate { } func toolbarExpandingViewDidTapFormatText(toolbarView: WKEditorToolbarExpandingView) { - inputViewType = .main + editorInputViewIsShowing = true postUpdateButtonSelectionStatesNotification(withDelay: true) } - func toolbarExpandingViewDidTapFormatHeading(toolbarView: WKEditorToolbarExpandingView) { - inputViewType = .headerSelect - } - func toolbarExpandingViewDidTapTemplate(toolbarView: WKEditorToolbarExpandingView, isSelected: Bool) { let action: WKSourceEditorFormatterButtonAction = isSelected ? .remove : .add textFrameworkMediator.templateFormatter?.toggleTemplateFormatting(action: action, in: textView) @@ -332,13 +281,9 @@ extension WKSourceEditorViewController: WKEditorToolbarHighlightViewDelegate { } func toolbarHighlightViewDidTapShowMore(toolbarView: WKEditorToolbarHighlightView) { - inputViewType = .main + editorInputViewIsShowing = true postUpdateButtonSelectionStatesNotification(withDelay: true) } - - func toolbarHighlightViewDidTapFormatHeading(toolbarView: WKEditorToolbarHighlightView) { - inputViewType = .headerSelect - } } // MARK: - WKEditorInputViewDelegate @@ -360,7 +305,7 @@ extension WKSourceEditorViewController: WKEditorInputViewDelegate { } func didTapClose() { - inputViewType = nil + editorInputViewIsShowing = false let isRangeSelected = textView.selectedRange.length > 0 inputAccessoryViewType = isRangeSelected ? .highlight : .expanding } From c74b3539b7e54aec0bebd33c2be359d1da58329e Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 6 Dec 2023 17:13:53 -0600 Subject: [PATCH 3/9] Remove format header button from toolbars --- .../WKEditorToolbarExpandingView.swift | 6 ----- .../WKEditorToolbarExpandingView.xib | 24 +++++++---------- .../WKEditorToolbarHighlightView.swift | 6 ----- .../WKEditorToolbarHighlightView.xib | 25 +++++++----------- .../WKSourceEditorLocalizedStrings.swift | 4 +-- WMF Framework/CommonStrings.swift | 1 - Wikipedia/Code/PageEditorViewController.swift | 1 - .../en.lproj/Localizable.strings | 1 - .../qqq.lproj/Localizable.strings | 1 - .../en.lproj/Localizable.strings | Bin 445398 -> 445070 bytes .../UITestHelperViewController.swift | 1 - 11 files changed, 19 insertions(+), 51 deletions(-) diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift index 832bcd25baa..d4e615eece9 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.swift @@ -39,7 +39,6 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView { @IBOutlet weak var secondaryContainerView: UIView! @IBOutlet private weak var formatTextButton: WKEditorToolbarButton! - @IBOutlet private weak var formatHeadingButton: WKEditorToolbarButton! @IBOutlet private weak var citationButton: WKEditorToolbarButton! @IBOutlet private weak var linkButton: WKEditorToolbarButton! @IBOutlet private weak var templateButton: WKEditorToolbarButton! @@ -81,11 +80,6 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView { formatTextButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.formatTextButton formatTextButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonFormatText - formatHeadingButton.setImage(WKIcon.formatHeading, for: .normal) - formatHeadingButton.addTarget(self, action: #selector(tappedFormatHeading), for: .touchUpInside) - formatHeadingButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.formatHeadingButton - formatHeadingButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonFormatHeading - citationButton.setImage(WKSFSymbolIcon.for(symbol: .quoteOpening), for: .normal) citationButton.addTarget(self, action: #selector(tappedCitation), for: .touchUpInside) citationButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonCitation diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.xib b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.xib index a303c68443c..4cc6c4a20fd 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.xib +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Expanding/WKEditorToolbarExpandingView.xib @@ -1,9 +1,9 @@ - + - + @@ -35,31 +35,27 @@ - - - - - + - + - + - + - + - + @@ -279,13 +275,12 @@ - - + @@ -296,7 +291,6 @@ - diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift index 373b36213e8..4dad9c43795 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.swift @@ -15,7 +15,6 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView { @IBOutlet private weak var boldButton: WKEditorToolbarButton! @IBOutlet private weak var italicsButton: WKEditorToolbarButton! - @IBOutlet private weak var formatHeadingButton: WKEditorToolbarButton! @IBOutlet private weak var citationButton: WKEditorToolbarButton! @IBOutlet private weak var linkButton: WKEditorToolbarButton! @IBOutlet private weak var templateButton: WKEditorToolbarButton! @@ -40,11 +39,6 @@ class WKEditorToolbarHighlightView: WKEditorToolbarView { italicsButton.addTarget(self, action: #selector(tappedItalics), for: .touchUpInside) italicsButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonItalics - formatHeadingButton.setImage(WKIcon.formatHeading, for: .normal) - formatHeadingButton.addTarget(self, action: #selector(tappedFormatHeading), for: .touchUpInside) - formatHeadingButton.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.formatHeadingButton - formatHeadingButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonFormatHeading - citationButton.setImage(WKSFSymbolIcon.for(symbol: .quoteOpening), for: .normal) citationButton.addTarget(self, action: #selector(tappedCitation), for: .touchUpInside) citationButton.accessibilityLabel = WKSourceEditorLocalizedStrings.current?.accessibilityLabelButtonCitation diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.xib b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.xib index ece76adee38..2070c302ce9 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.xib +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Accessory Views/Highlight/WKEditorToolbarHighlightView.xib @@ -1,9 +1,9 @@ - + - + @@ -29,35 +29,31 @@ - - - - - + - + - + - + - + - + - + @@ -100,7 +96,6 @@ - @@ -110,7 +105,6 @@ - @@ -121,7 +115,6 @@ - diff --git a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift index 074d2eb8c74..eb7ffadb5a7 100644 --- a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift +++ b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift @@ -17,7 +17,6 @@ public struct WKSourceEditorLocalizedStrings { let findReplaceWith: String let accessibilityLabelButtonFormatText: String - let accessibilityLabelButtonFormatHeading: String let accessibilityLabelButtonCitation: String let accessibilityLabelButtonCitationSelected: String let accessibilityLabelButtonLink: String @@ -70,7 +69,7 @@ public struct WKSourceEditorLocalizedStrings { let accessibilityLabelReplaceTypeSingle: String let accessibilityLabelReplaceTypeAll: String - public init(inputViewTextFormatting: String, inputViewStyle: String, inputViewClearFormatting: String, inputViewParagraph: String, inputViewHeading: String, inputViewSubheading1: String, inputViewSubheading2: String, inputViewSubheading3: String, inputViewSubheading4: String, findReplaceTypeSingle: String, findReplaceTypeAll: String, findReplaceWith: String, accessibilityLabelButtonFormatText: String, accessibilityLabelButtonFormatHeading: String, accessibilityLabelButtonCitation: String, accessibilityLabelButtonCitationSelected: String, accessibilityLabelButtonLink: String, accessibilityLabelButtonLinkSelected: String, accessibilityLabelButtonTemplate: String, accessibilityLabelButtonTemplateSelected: String, accessibilityLabelButtonMedia: String, accessibilityLabelButtonFind: String, accessibilityLabelButtonListUnordered: String, accessibilityLabelButtonListUnorderedSelected: String, accessibilityLabelButtonListOrdered: String, accessibilityLabelButtonListOrderedSelected: String, accessibilityLabelButtonInceaseIndent: String, accessibilityLabelButtonDecreaseIndent: String, accessibilityLabelButtonCursorUp: String, accessibilityLabelButtonCursorDown: String, accessibilityLabelButtonCursorLeft: String, accessibilityLabelButtonCursorRight: String, accessibilityLabelButtonBold: String, accessibilityLabelButtonBoldSelected: String, accessibilityLabelButtonItalics: String, accessibilityLabelButtonItalicsSelected: String, accessibilityLabelButtonClearFormatting: String, accessibilityLabelButtonShowMore: String, accessibilityLabelButtonComment: String, accessibilityLabelButtonCommentSelected: String, accessibilityLabelButtonSuperscript: String, accessibilityLabelButtonSuperscriptSelected: String, accessibilityLabelButtonSubscript: String, accessibilityLabelButtonSubscriptSelected: String, accessibilityLabelButtonUnderline: String, accessibilityLabelButtonUnderlineSelected: String, accessibilityLabelButtonStrikethrough: String, accessibilityLabelButtonStrikethroughSelected: String, accessibilityLabelButtonCloseMainInputView: String, accessibilityLabelButtonCloseHeaderSelectInputView: String, accessibilityLabelFindTextField: String, accessibilityLabelFindButtonClear: String, accessibilityLabelFindButtonClose: String, accessibilityLabelFindButtonNext: String, accessibilityLabelFindButtonPrevious: String, accessibilityLabelReplaceTextField: String, accessibilityLabelReplaceButtonClear: String, accessibilityLabelReplaceButtonPerformFormat: String, accessibilityLabelReplaceButtonSwitchFormat: String, accessibilityLabelReplaceTypeSingle: String, accessibilityLabelReplaceTypeAll: String) { + public init(inputViewTextFormatting: String, inputViewStyle: String, inputViewClearFormatting: String, inputViewParagraph: String, inputViewHeading: String, inputViewSubheading1: String, inputViewSubheading2: String, inputViewSubheading3: String, inputViewSubheading4: String, findReplaceTypeSingle: String, findReplaceTypeAll: String, findReplaceWith: String, accessibilityLabelButtonFormatText: String, accessibilityLabelButtonCitation: String, accessibilityLabelButtonCitationSelected: String, accessibilityLabelButtonLink: String, accessibilityLabelButtonLinkSelected: String, accessibilityLabelButtonTemplate: String, accessibilityLabelButtonTemplateSelected: String, accessibilityLabelButtonMedia: String, accessibilityLabelButtonFind: String, accessibilityLabelButtonListUnordered: String, accessibilityLabelButtonListUnorderedSelected: String, accessibilityLabelButtonListOrdered: String, accessibilityLabelButtonListOrderedSelected: String, accessibilityLabelButtonInceaseIndent: String, accessibilityLabelButtonDecreaseIndent: String, accessibilityLabelButtonCursorUp: String, accessibilityLabelButtonCursorDown: String, accessibilityLabelButtonCursorLeft: String, accessibilityLabelButtonCursorRight: String, accessibilityLabelButtonBold: String, accessibilityLabelButtonBoldSelected: String, accessibilityLabelButtonItalics: String, accessibilityLabelButtonItalicsSelected: String, accessibilityLabelButtonClearFormatting: String, accessibilityLabelButtonShowMore: String, accessibilityLabelButtonComment: String, accessibilityLabelButtonCommentSelected: String, accessibilityLabelButtonSuperscript: String, accessibilityLabelButtonSuperscriptSelected: String, accessibilityLabelButtonSubscript: String, accessibilityLabelButtonSubscriptSelected: String, accessibilityLabelButtonUnderline: String, accessibilityLabelButtonUnderlineSelected: String, accessibilityLabelButtonStrikethrough: String, accessibilityLabelButtonStrikethroughSelected: String, accessibilityLabelButtonCloseMainInputView: String, accessibilityLabelButtonCloseHeaderSelectInputView: String, accessibilityLabelFindTextField: String, accessibilityLabelFindButtonClear: String, accessibilityLabelFindButtonClose: String, accessibilityLabelFindButtonNext: String, accessibilityLabelFindButtonPrevious: String, accessibilityLabelReplaceTextField: String, accessibilityLabelReplaceButtonClear: String, accessibilityLabelReplaceButtonPerformFormat: String, accessibilityLabelReplaceButtonSwitchFormat: String, accessibilityLabelReplaceTypeSingle: String, accessibilityLabelReplaceTypeAll: String) { self.inputViewTextFormatting = inputViewTextFormatting self.inputViewStyle = inputViewStyle self.inputViewClearFormatting = inputViewClearFormatting @@ -84,7 +83,6 @@ public struct WKSourceEditorLocalizedStrings { self.findReplaceTypeAll = findReplaceTypeAll self.findReplaceWith = findReplaceWith self.accessibilityLabelButtonFormatText = accessibilityLabelButtonFormatText - self.accessibilityLabelButtonFormatHeading = accessibilityLabelButtonFormatHeading self.accessibilityLabelButtonCitation = accessibilityLabelButtonCitation self.accessibilityLabelButtonCitationSelected = accessibilityLabelButtonCitationSelected self.accessibilityLabelButtonLink = accessibilityLabelButtonLink diff --git a/WMF Framework/CommonStrings.swift b/WMF Framework/CommonStrings.swift index bf7c3cf4bfd..25da28b12a1 100644 --- a/WMF Framework/CommonStrings.swift +++ b/WMF Framework/CommonStrings.swift @@ -535,7 +535,6 @@ public class CommonStrings: NSObject { public static let findAndReplaceAll = WMFLocalizedString("source-editor-find-replace-all", value: "Replace all", comment: "Label for replace all ocurrences of a string on the page editor") public static let replaceWith = WMFLocalizedString("source-editor-find-replace-with", value: "Replace with...", comment: "Lable for replace with string button on page editor") public static let accessibilityLabelButtonFormatText = WMFLocalizedString("source-editor-accessibility-label-format-text", value: "Show text formatting menu", comment: "Accessibility label for text formatting menu button on the page editor") - public static let accessibilityLabelButtonFormatHeading = WMFLocalizedString("source-editor-accessibility-label-format-heading", value: "Show text style menu", comment: "Accessibility label for heading style formatting menu button on the page editor") public static let accessibilityLabelButtonCitation = WMFLocalizedString("source-editor-accessibility-label-citation", value: "Add reference syntax", comment: "Accessibility label for add reference syntax button on the page editor") public static let accessibilityLabelButtonCitationSelected = WMFLocalizedString("source-editor-accessibility-label-citation-selected", value: "Remove reference syntax", comment: "Accessibility label for remove reference syntax button on the page editor") public static let accessibilityLabelButtonLink = WMFLocalizedString("source-editor-accessibility-label-link", value: "Add link syntax", comment: "Accessibility label for the add link syntax button on the page editor") diff --git a/Wikipedia/Code/PageEditorViewController.swift b/Wikipedia/Code/PageEditorViewController.swift index be88b879715..145a7a3a6e4 100644 --- a/Wikipedia/Code/PageEditorViewController.swift +++ b/Wikipedia/Code/PageEditorViewController.swift @@ -116,7 +116,6 @@ final class PageEditorViewController: UIViewController { findReplaceTypeAll: CommonStrings.findAndReplaceAll, findReplaceWith: CommonStrings.replaceWith, accessibilityLabelButtonFormatText: CommonStrings.accessibilityLabelButtonFormatText, - accessibilityLabelButtonFormatHeading: CommonStrings.accessibilityLabelButtonFormatHeading, accessibilityLabelButtonCitation: CommonStrings.accessibilityLabelButtonCitation, accessibilityLabelButtonCitationSelected: CommonStrings.accessibilityLabelButtonCitationSelected, accessibilityLabelButtonLink: CommonStrings.accessibilityLabelButtonBold, diff --git a/Wikipedia/Localizations/en.lproj/Localizable.strings b/Wikipedia/Localizations/en.lproj/Localizable.strings index 55c4b77261c..6ed368c3bcc 100644 --- a/Wikipedia/Localizations/en.lproj/Localizable.strings +++ b/Wikipedia/Localizations/en.lproj/Localizable.strings @@ -1016,7 +1016,6 @@ "source-editor-accessibility-label-find-button-next" = "Next find result"; "source-editor-accessibility-label-find-button-prev" = "Previous find result"; "source-editor-accessibility-label-find-text-field" = "Find"; -"source-editor-accessibility-label-format-heading" = "Show text style menu"; "source-editor-accessibility-label-format-text" = "Show text formatting menu"; "source-editor-accessibility-label-format-text-show-more" = "Show text formatting menu"; "source-editor-accessibility-label-indent-decrease" = "Decrease indent depth"; diff --git a/Wikipedia/Localizations/qqq.lproj/Localizable.strings b/Wikipedia/Localizations/qqq.lproj/Localizable.strings index 83f677003b2..4c7b141f3a6 100644 --- a/Wikipedia/Localizations/qqq.lproj/Localizable.strings +++ b/Wikipedia/Localizations/qqq.lproj/Localizable.strings @@ -1016,7 +1016,6 @@ "source-editor-accessibility-label-find-button-next" = "Accessibility label for the find next result on the page editor"; "source-editor-accessibility-label-find-button-prev" = "Accessibility label for the find previous result button on the page editor"; "source-editor-accessibility-label-find-text-field" = "Accessibility label for the find text field on the page editor"; -"source-editor-accessibility-label-format-heading" = "Accessibility label for heading style formatting menu button on the page editor"; "source-editor-accessibility-label-format-text" = "Accessibility label for text formatting menu button on the page editor"; "source-editor-accessibility-label-format-text-show-more" = "Accessibility label for the show more button on the page editor"; "source-editor-accessibility-label-indent-decrease" = "Accessibility label for the decrease indent button on the page editor"; diff --git a/Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings index bfb5c25397968f646e69c382ad3004eb4c7dea93..345a8d92d798b77b7b156f844fdf271835da4b68 100644 GIT binary patch delta 64 zcmV-G0Kfm%mm7|i8-RoXgaU*Egaot&(oB~=hXE>=4owA)m;O%$2$y_-0ScGOhXFvB WFhB)5m$3N*2#01*1-E8T25@};DiuEB@=X^AV>FuX(9Wna{hkeLLpxC2_8MO{p;`bLpC85m diff --git a/WikipediaUITests/UITestHelperViewController.swift b/WikipediaUITests/UITestHelperViewController.swift index e37203818af..4b65eb476aa 100644 --- a/WikipediaUITests/UITestHelperViewController.swift +++ b/WikipediaUITests/UITestHelperViewController.swift @@ -53,7 +53,6 @@ public class UITestHelperViewController: WKCanvasViewController { findReplaceTypeAll: CommonStrings.findAndReplaceAll, findReplaceWith: CommonStrings.replaceWith, accessibilityLabelButtonFormatText: CommonStrings.accessibilityLabelButtonFormatText, - accessibilityLabelButtonFormatHeading: CommonStrings.accessibilityLabelButtonFormatHeading, accessibilityLabelButtonCitation: CommonStrings.accessibilityLabelButtonCitation, accessibilityLabelButtonCitationSelected: CommonStrings.accessibilityLabelButtonCitationSelected, accessibilityLabelButtonLink: CommonStrings.accessibilityLabelButtonBold, From 6f546d0fe29670c70565e8a175416d00b44f9f84 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 6 Dec 2023 17:24:46 -0600 Subject: [PATCH 4/9] Remove unused code, move around files in subdirectories --- .../WKEditorHeaderSelectCell.swift | 40 ----- .../WKEditorHeaderSelectView.swift | 85 ---------- .../WKEditorHeaderSelectViewModel.swift | 20 --- ...ditorInputHeaderSelectViewController.swift | 154 ------------------ .../WKEditorDestructiveCell.swift | 40 ----- .../WKEditorDestructiveView.swift | 60 ------- .../WKEditorDestructiveViewModel.swift | 5 - .../WKEditorSelectionDetailCell.swift | 42 ----- .../WKEditorSelectionDetailView.swift | 88 ---------- .../WKEditorSelectionDetailViewModel.swift | 6 - .../WKEditorToolbarGroupedCell.swift | 34 ---- .../WKEditorToolbarPlainCell.swift | 43 ----- .../WKEditorInputMainViewController.swift | 143 ---------------- .../Input Views/WKEditorInputView.swift | 11 -- .../WKEditorToolbarGroupedView.swift | 0 .../WKEditorToolbarGroupedView.xib | 0 .../WKEditorToolbarPlainView.swift | 0 .../WKEditorToolbarPlainView.xib | 0 18 files changed, 771 deletions(-) delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectCell.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectView.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectViewModel.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorInputHeaderSelectViewController.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveCell.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveView.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveViewModel.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailCell.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailView.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailViewModel.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedCell.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainCell.swift delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/WKEditorInputMainViewController.swift rename Components/Sources/Components/Components/Editors/Common Views/Input Views/{Main/Grouped Toolbar Table Item => }/WKEditorToolbarGroupedView.swift (100%) rename Components/Sources/Components/Components/Editors/Common Views/Input Views/{Main/Grouped Toolbar Table Item => }/WKEditorToolbarGroupedView.xib (100%) rename Components/Sources/Components/Components/Editors/Common Views/Input Views/{Main/Plain Toolbar Table Item => }/WKEditorToolbarPlainView.swift (100%) rename Components/Sources/Components/Components/Editors/Common Views/Input Views/{Main/Plain Toolbar Table Item => }/WKEditorToolbarPlainView.xib (100%) diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectCell.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectCell.swift deleted file mode 100644 index 87fef28b24a..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectCell.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation -import UIKit - -class WKEditorHeaderSelectCell: UITableViewCell { - - // MARK: Properties - - private lazy var componentView: WKEditorHeaderSelectView = { - let view = WKEditorHeaderSelectView() - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - // MARK: Lifecycle - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - contentView.addSubview(componentView) - NSLayoutConstraint.activate([ - contentView.leadingAnchor.constraint(equalTo: componentView.leadingAnchor), - contentView.trailingAnchor.constraint(equalTo: componentView.trailingAnchor), - contentView.topAnchor.constraint(equalTo: componentView.topAnchor), - contentView.bottomAnchor.constraint(equalTo: componentView.bottomAnchor) - ]) - } - - // MARK: Internal - - func configure(viewModel: WKEditorHeaderSelectViewModel) { - componentView.configure(viewModel: viewModel) - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectView.swift deleted file mode 100644 index fc3ac021d45..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectView.swift +++ /dev/null @@ -1,85 +0,0 @@ -import Foundation -import UIKit - -class WKEditorHeaderSelectView: WKComponentView { - - // MARK: Properties - - private lazy var label: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.adjustsFontForContentSizeCategory = true - label.font = WKFont.for(.body, compatibleWith: appEnvironment.traitCollection) - return label - }() - - private lazy var imageView: UIImageView = { - let image = WKIcon.checkmark - let imageView = UIImageView(image: image) - imageView.translatesAutoresizingMaskIntoConstraints = false - return imageView - }() - - // MARK: Lifecycle - - required init() { - super.init(frame: .zero) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - - directionalLayoutMargins = NSDirectionalEdgeInsets(top: 8, leading: 22, bottom: 8, trailing: 22) - - addSubview(label) - addSubview(imageView) - NSLayoutConstraint.activate([ - layoutMarginsGuide.leadingAnchor.constraint(equalTo: label.leadingAnchor), - layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageView.trailingAnchor), - layoutMarginsGuide.topAnchor.constraint(equalTo: label.topAnchor), - layoutMarginsGuide.bottomAnchor.constraint(equalTo: label.bottomAnchor), - label.trailingAnchor.constraint(equalTo: imageView.leadingAnchor), - label.centerYAnchor.constraint(equalTo: imageView.centerYAnchor) - ]) - - updateColors() - } - - // MARK: Internal - - func configure(viewModel: WKEditorHeaderSelectViewModel) { - imageView.isHidden = !viewModel.isSelected - switch viewModel.configuration { - case .paragraph: - label.text = WKSourceEditorLocalizedStrings.current.inputViewParagraph - case .heading: - label.text = WKSourceEditorLocalizedStrings.current.inputViewHeading - case .subheading1: - label.text = WKSourceEditorLocalizedStrings.current.inputViewSubheading1 - case .subheading2: - label.text = WKSourceEditorLocalizedStrings.current.inputViewSubheading2 - case .subheading3: - label.text = WKSourceEditorLocalizedStrings.current.inputViewSubheading3 - case .subheading4: - label.text = WKSourceEditorLocalizedStrings.current.inputViewSubheading4 - } - } - - // MARK: Overrides - - override func appEnvironmentDidChange() { - updateColors() - } - - // MARK: Private Helpers - - func updateColors() { - backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - label.textColor = WKAppEnvironment.current.theme.text - imageView.tintColor = WKAppEnvironment.current.theme.link - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectViewModel.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectViewModel.swift deleted file mode 100644 index 33314676d26..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorHeaderSelectViewModel.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation - -class WKEditorHeaderSelectViewModel { - enum Configuration { - case paragraph - case heading - case subheading1 - case subheading2 - case subheading3 - case subheading4 - } - - let configuration: Configuration - var isSelected: Bool - - init(configuration: Configuration, isSelected: Bool) { - self.configuration = configuration - self.isSelected = isSelected - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorInputHeaderSelectViewController.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorInputHeaderSelectViewController.swift deleted file mode 100644 index 9dc6a88819b..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Header Selection/WKEditorInputHeaderSelectViewController.swift +++ /dev/null @@ -1,154 +0,0 @@ -import Foundation -import UIKit - -class WKEditorInputHeaderSelectViewController: WKComponentViewController { - - // MARK: Nested Types - - enum Configuration { - case leftTitleNav - case standard - } - - // MARK: Properties - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.adjustsFontForContentSizeCategory = true - label.font = WKFont.for(.headline, compatibleWith: appEnvironment.traitCollection) - label.text = WKSourceEditorLocalizedStrings.current.inputViewStyle - return label - }() - - private lazy var tableView: UITableView = { - let tableView = UITableView() - tableView.translatesAutoresizingMaskIntoConstraints = false - tableView.dataSource = self - tableView.delegate = self - return tableView - }() - - private lazy var closeButton: UIBarButtonItem = { - let button = UIBarButtonItem(image: WKSFSymbolIcon.for(symbol: .multiplyCircleFill), style: .plain, target: self, action: #selector(close(_:))) - button.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.closeButton - button.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonCloseHeaderSelectInputView - return button - }() - - private weak var delegate: WKEditorInputViewDelegate? - private let configuration: Configuration - - private let reuseIdentifier = String(describing: WKEditorHeaderSelectCell.self) - private let viewModels = [WKEditorHeaderSelectViewModel(configuration: .paragraph, isSelected: false), - WKEditorHeaderSelectViewModel(configuration: .heading, isSelected: false), - WKEditorHeaderSelectViewModel(configuration: .subheading1, isSelected: false), - WKEditorHeaderSelectViewModel(configuration: .subheading2, isSelected: false), - WKEditorHeaderSelectViewModel(configuration: .subheading3, isSelected: false), - WKEditorHeaderSelectViewModel(configuration: .subheading4, isSelected: false)] - - // MARK: Lifecycle - - init(configuration: Configuration, delegate: WKEditorInputViewDelegate?) { - self.configuration = configuration - self.delegate = delegate - super.init() - setupNavigationBar() - } - - public required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - super.viewDidLoad() - - view.addSubview(tableView) - view.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.headerSelectInputView - NSLayoutConstraint.activate([ - view.leadingAnchor.constraint(equalTo: tableView.leadingAnchor), - view.trailingAnchor.constraint(equalTo: tableView.trailingAnchor), - view.topAnchor.constraint(equalTo: tableView.topAnchor), - view.bottomAnchor.constraint(equalTo: tableView.bottomAnchor) - ]) - - tableView.register(WKEditorHeaderSelectCell.self, forCellReuseIdentifier: reuseIdentifier) - } - - // MARK: Overrides - - override func appEnvironmentDidChange() { - updateColors() - } - - // MARK: Button Actions - - @objc private func close(_ sender: UIBarButtonItem) { - delegate?.didTapClose() - } - - // MARK: Private Helpers - - private func setupNavigationBar() { - switch configuration { - case .standard: - break - case .leftTitleNav: - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: titleLabel) - } - navigationItem.rightBarButtonItem = closeButton - } - - private func updateColors() { - view.backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - tableView.backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - } -} - -// MARK: UITableViewDataSource - -extension WKEditorInputHeaderSelectViewController: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 6 - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) - - if let headerCell = cell as? WKEditorHeaderSelectCell { - let viewModel = viewModels[indexPath.row] - switch indexPath.row { - case 0: - headerCell.configure(viewModel: viewModel) - case 1: - headerCell.configure( viewModel: viewModel) - case 2: - headerCell.configure(viewModel: viewModel) - case 3: - headerCell.configure(viewModel: viewModel) - case 4: - headerCell.configure(viewModel: viewModel) - case 5: - headerCell.configure(viewModel: viewModel) - default: - break - } - headerCell.accessibilityTraits = viewModel.isSelected ? [.button, .selected] : [.button] - - } - - return cell - } -} - -// MARK: UITableViewDelegate - -extension WKEditorInputHeaderSelectViewController: UITableViewDelegate { - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - for (index, viewModel) in viewModels.enumerated() { - viewModel.isSelected = index == indexPath.row - } - tableView.reloadData() - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveCell.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveCell.swift deleted file mode 100644 index 29259b4738b..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveCell.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation -import UIKit - -class WKEditorDestructiveCell: UITableViewCell { - - // MARK: - Properties - - private lazy var componentView: WKEditorDestructiveView = { - let view = WKEditorDestructiveView() - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - // MARK: - Lifecycle - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - contentView.addSubview(componentView) - NSLayoutConstraint.activate([ - contentView.leadingAnchor.constraint(equalTo: componentView.leadingAnchor), - contentView.trailingAnchor.constraint(equalTo: componentView.trailingAnchor), - contentView.topAnchor.constraint(equalTo: componentView.topAnchor), - contentView.bottomAnchor.constraint(equalTo: componentView.bottomAnchor) - ]) - } - - // MARK: - Internal - - func configure(viewModel: WKEditorDestructiveViewModel) { - componentView.configure(viewModel: viewModel) - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveView.swift deleted file mode 100644 index c08be601ab0..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveView.swift +++ /dev/null @@ -1,60 +0,0 @@ -import Foundation -import UIKit - -class WKEditorDestructiveView: WKComponentView { - - // MARK: Properties - - private lazy var label: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.adjustsFontForContentSizeCategory = true - label.font = WKFont.for(.body, compatibleWith: appEnvironment.traitCollection) - return label - }() - - // MARK: Lifecycle - - required init() { - super.init(frame: .zero) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - - directionalLayoutMargins = NSDirectionalEdgeInsets(top: 8, leading: 22, bottom: 8, trailing: 22) - - addSubview(label) - NSLayoutConstraint.activate([ - layoutMarginsGuide.leadingAnchor.constraint(equalTo: label.leadingAnchor), - layoutMarginsGuide.trailingAnchor.constraint(equalTo: label.trailingAnchor), - layoutMarginsGuide.topAnchor.constraint(equalTo: label.topAnchor), - layoutMarginsGuide.bottomAnchor.constraint(equalTo: label.bottomAnchor) - ]) - - updateColors() - } - - // MARK: Internal - - func configure(viewModel: WKEditorDestructiveViewModel) { - label.text = viewModel.text - } - - // MARK: Overrides - - override func appEnvironmentDidChange() { - updateColors() - } - - // MARK: Private Helpers - - private func updateColors() { - backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - label.textColor = WKAppEnvironment.current.theme.destructive - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveViewModel.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveViewModel.swift deleted file mode 100644 index d792839ee80..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Destructive Table Item/WKEditorDestructiveViewModel.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -struct WKEditorDestructiveViewModel { - let text: String -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailCell.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailCell.swift deleted file mode 100644 index 17cdfb5fc96..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailCell.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation -import UIKit - -class WKEditorSelectionDetailCell: UITableViewCell { - - // MARK: - Properties - - private lazy var componentView: WKEditorSelectionDetailView = { - let view = WKEditorSelectionDetailView() - view.translatesAutoresizingMaskIntoConstraints = false - return view - }() - - // MARK: - Lifecycle - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - contentView.addSubview(componentView) - NSLayoutConstraint.activate([ - contentView.leadingAnchor.constraint(equalTo: componentView.leadingAnchor), - contentView.trailingAnchor.constraint(equalTo: componentView.trailingAnchor), - contentView.topAnchor.constraint(equalTo: componentView.topAnchor), - contentView.bottomAnchor.constraint(equalTo: componentView.bottomAnchor) - ]) - - selectedBackgroundView?.backgroundColor = .clear - } - - // MARK: - Internal - - func configure(viewModel: WKEditorSelectionDetailViewModel) { - componentView.configure(viewModel: viewModel) - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailView.swift deleted file mode 100644 index 70ac124065d..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailView.swift +++ /dev/null @@ -1,88 +0,0 @@ -import Foundation -import UIKit - -class WKEditorSelectionDetailView: WKComponentView { - - // MARK: - Properties - - private lazy var typeLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.setContentHuggingPriority(.defaultLow, for: .horizontal) - label.adjustsFontForContentSizeCategory = true - label.font = WKFont.for(.body, compatibleWith: appEnvironment.traitCollection) - return label - }() - - private lazy var selectionLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.adjustsFontForContentSizeCategory = true - label.font = WKFont.for(.body, compatibleWith: appEnvironment.traitCollection) - label.textAlignment = .right - return label - }() - - private lazy var disclosureImageView: UIImageView = { - let imageView = UIImageView() - imageView.translatesAutoresizingMaskIntoConstraints = false - imageView.image = WKIcon.chevronRight - return imageView - }() - - private var viewModel: WKEditorSelectionDetailViewModel? - - // MARK: - Lifecycle - - required init() { - super.init(frame: .zero) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - - directionalLayoutMargins = NSDirectionalEdgeInsets(top: 8, leading: 22, bottom: 8, trailing: 22) - - addSubview(typeLabel) - addSubview(selectionLabel) - addSubview(disclosureImageView) - NSLayoutConstraint.activate([ - layoutMarginsGuide.leadingAnchor.constraint(equalTo: typeLabel.leadingAnchor), - layoutMarginsGuide.trailingAnchor.constraint(equalTo: disclosureImageView.trailingAnchor), - layoutMarginsGuide.topAnchor.constraint(equalTo: typeLabel.topAnchor), - layoutMarginsGuide.bottomAnchor.constraint(equalTo: typeLabel.bottomAnchor), - typeLabel.trailingAnchor.constraint(equalTo: selectionLabel.leadingAnchor), - selectionLabel.trailingAnchor.constraint(equalTo: disclosureImageView.leadingAnchor, constant: -8), - selectionLabel.centerYAnchor.constraint(equalTo: disclosureImageView.centerYAnchor), - selectionLabel.centerYAnchor.constraint(equalTo: typeLabel.centerYAnchor) - ]) - - updateColors() - } - - // MARK: - Internal - - func configure(viewModel: WKEditorSelectionDetailViewModel) { - typeLabel.text = viewModel.typeText - selectionLabel.text = viewModel.selectionText - } - - // MARK: - Overrides - - override func appEnvironmentDidChange() { - updateColors() - } - - // MARK: - Private Helpers - - private func updateColors() { - backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - disclosureImageView.tintColor = WKAppEnvironment.current.theme.inputAccessoryButtonTint - typeLabel.textColor = WKAppEnvironment.current.theme.text - selectionLabel.textColor = WKAppEnvironment.current.theme.text - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailViewModel.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailViewModel.swift deleted file mode 100644 index 6ad53cd739d..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Detail Table Item/WKEditorSelectionDetailViewModel.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation - -struct WKEditorSelectionDetailViewModel { - let typeText: String - let selectionText: String -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedCell.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedCell.swift deleted file mode 100644 index ada9819fa06..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedCell.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation -import UIKit - -class WKEditorToolbarGroupedCell: UITableViewCell { - - // MARK: - Properties - - private lazy var componentView: UIView = { - let view = UINib(nibName: String(describing: WKEditorToolbarGroupedView.self), bundle: Bundle.module).instantiate(withOwner: nil).first as! UIView - - return view - }() - - // MARK: - Lifecycle - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - contentView.addSubview(componentView) - NSLayoutConstraint.activate([ - contentView.leadingAnchor.constraint(equalTo: componentView.leadingAnchor), - contentView.trailingAnchor.constraint(equalTo: componentView.trailingAnchor), - contentView.topAnchor.constraint(equalTo: componentView.topAnchor), - contentView.bottomAnchor.constraint(equalTo: componentView.bottomAnchor) - ]) - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainCell.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainCell.swift deleted file mode 100644 index f65c37e94ef..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainCell.swift +++ /dev/null @@ -1,43 +0,0 @@ -import Foundation -import UIKit - -class WKEditorToolbarPlainCell: UITableViewCell { - - // MARK: - Properties - - private lazy var componentView: WKEditorToolbarPlainView = { - let view = UINib(nibName: String(describing: WKEditorToolbarPlainView.self), bundle: Bundle.module).instantiate(withOwner: nil).first as! WKEditorToolbarPlainView - - return view - }() - - var delegate: WKEditorInputViewDelegate? { - get { - return componentView.delegate - } - set { - componentView.delegate = newValue - } - } - - // MARK: - Lifecycle - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setup() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - private func setup() { - contentView.addSubview(componentView) - NSLayoutConstraint.activate([ - contentView.leadingAnchor.constraint(equalTo: componentView.leadingAnchor), - contentView.trailingAnchor.constraint(equalTo: componentView.trailingAnchor), - contentView.topAnchor.constraint(equalTo: componentView.topAnchor), - contentView.bottomAnchor.constraint(equalTo: componentView.bottomAnchor) - ]) - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/WKEditorInputMainViewController.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/WKEditorInputMainViewController.swift deleted file mode 100644 index bc0c898f25a..00000000000 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/WKEditorInputMainViewController.swift +++ /dev/null @@ -1,143 +0,0 @@ -import Foundation -import UIKit - -class WKEditorInputMainViewController: WKComponentViewController { - - // MARK: - Properties - - private lazy var tableView: UITableView = { - let tableView = UITableView() - tableView.translatesAutoresizingMaskIntoConstraints = false - tableView.dataSource = self - tableView.delegate = self - return tableView - }() - - private lazy var titleLabel: UILabel = { - let label = UILabel() - label.translatesAutoresizingMaskIntoConstraints = false - label.adjustsFontForContentSizeCategory = true - label.font = WKFont.for(.headline, compatibleWith: appEnvironment.traitCollection) - label.text = WKSourceEditorLocalizedStrings.current.inputViewTextFormatting - return label - }() - - private lazy var closeButton: UIBarButtonItem = { - let button = UIBarButtonItem(image: WKSFSymbolIcon.for(symbol: .multiplyCircleFill), style: .plain, target: self, action: #selector(close(_:))) - button.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.closeButton - button.accessibilityLabel = WKSourceEditorLocalizedStrings.current.accessibilityLabelButtonCloseMainInputView - return button - }() - - private let plainReuseIdentifier = String(describing: WKEditorToolbarPlainCell.self) - private let groupedReuseIdentifier = String(describing: WKEditorToolbarGroupedCell.self) - private let detailReuseIdentifier = String(describing: WKEditorSelectionDetailCell.self) - private let destructiveReuseIdentifier = String(describing: WKEditorDestructiveCell.self) - - weak var delegate: WKEditorInputViewDelegate? - - // MARK: - Lifecycle - - override func viewDidLoad() { - super.viewDidLoad() - - view.addSubview(tableView) - view.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.mainInputView - NSLayoutConstraint.activate([ - view.leadingAnchor.constraint(equalTo: tableView.leadingAnchor), - view.trailingAnchor.constraint(equalTo: tableView.trailingAnchor), - view.topAnchor.constraint(equalTo: tableView.topAnchor), - view.bottomAnchor.constraint(equalTo: tableView.bottomAnchor) - ]) - - tableView.register(WKEditorToolbarPlainCell.self, forCellReuseIdentifier: plainReuseIdentifier) - tableView.register(WKEditorToolbarGroupedCell.self, forCellReuseIdentifier: groupedReuseIdentifier) - tableView.register(WKEditorSelectionDetailCell.self, forCellReuseIdentifier: detailReuseIdentifier) - tableView.register(WKEditorDestructiveCell.self, forCellReuseIdentifier: destructiveReuseIdentifier) - - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: titleLabel) - navigationItem.rightBarButtonItem = closeButton - - updateColors() - } - - // MARK: - Overrides - - override func appEnvironmentDidChange() { - updateColors() - } - - // MARK: - Button Actions - - @objc private func close(_ sender: UIBarButtonItem) { - delegate?.didTapClose() - } - - // MARK: - Private Helpers - - private func updateColors() { - view.backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - tableView.backgroundColor = WKAppEnvironment.current.theme.accessoryBackground - titleLabel.textColor = WKAppEnvironment.current.theme.text - } -} - -// MARK: - UITableViewDataSource - -extension WKEditorInputMainViewController: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 4 - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell: UITableViewCell - switch indexPath.row { - case 0: - cell = tableView.dequeueReusableCell(withIdentifier: plainReuseIdentifier, for: indexPath) - - if let plainCell = cell as? WKEditorToolbarPlainCell { - plainCell.delegate = delegate - } - - cell.selectionStyle = .none - case 1: - cell = tableView.dequeueReusableCell(withIdentifier: groupedReuseIdentifier, for: indexPath) - cell.selectionStyle = .none - case 2: - - cell = tableView.dequeueReusableCell(withIdentifier: detailReuseIdentifier, for: indexPath) - - if let detailCell = cell as? WKEditorSelectionDetailCell { - detailCell.configure(viewModel: WKEditorSelectionDetailViewModel(typeText: WKSourceEditorLocalizedStrings.current.inputViewStyle, selectionText: WKSourceEditorLocalizedStrings.current.inputViewParagraph)) - detailCell.accessibilityTraits = [.button] - } - case 3: - cell = tableView.dequeueReusableCell(withIdentifier: destructiveReuseIdentifier, for: indexPath) - - if let destructiveCell = cell as? WKEditorDestructiveCell { - destructiveCell.configure(viewModel: WKEditorDestructiveViewModel(text: WKSourceEditorLocalizedStrings.current.inputViewClearFormatting)) - destructiveCell.accessibilityTraits = [.button] - } - default: - fatalError() - } - - return cell - } -} - -// MARK: - UITableViewDelegate - -extension WKEditorInputMainViewController: UITableViewDelegate { - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - let cell = tableView.cellForRow(at: indexPath) - cell?.isSelected = false - - if indexPath.row == 2 { - navigationItem.backButtonTitle = WKSourceEditorLocalizedStrings.current.inputViewTextFormatting - let headerVC = WKEditorInputHeaderSelectViewController(configuration: .standard, delegate: delegate) - navigationController?.pushViewController(headerVC, animated: true) - } - } -} diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift index 084caf7be17..4b22f99cb45 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift @@ -105,17 +105,6 @@ class WKEditorInputView: WKComponentView { return view }() - private lazy var headerSelectViewController: WKEditorInputHeaderSelectViewController = { - let vc = WKEditorInputHeaderSelectViewController(configuration: .leftTitleNav, delegate: delegate) - return vc - }() - - private lazy var mainViewController: WKEditorInputMainViewController = { - let vc = WKEditorInputMainViewController() - vc.delegate = delegate - return vc - }() - // Heading Buttons private var paragraphButton: UIButton! private var headerButton: UIButton! diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarGroupedView.swift similarity index 100% rename from Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedView.swift rename to Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarGroupedView.swift diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedView.xib b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarGroupedView.xib similarity index 100% rename from Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Grouped Toolbar Table Item/WKEditorToolbarGroupedView.xib rename to Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarGroupedView.xib diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarPlainView.swift similarity index 100% rename from Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainView.swift rename to Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarPlainView.swift diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainView.xib b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarPlainView.xib similarity index 100% rename from Components/Sources/Components/Components/Editors/Common Views/Input Views/Main/Plain Toolbar Table Item/WKEditorToolbarPlainView.xib rename to Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorToolbarPlainView.xib From 19e6b2321e86104b5631f94f1576625eb0ab0290 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 6 Dec 2023 17:30:22 -0600 Subject: [PATCH 5/9] Fix missing communication --- .../Editors/Common Views/Input Views/WKEditorInputView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift index 4b22f99cb45..1a3e3b87a5a 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift @@ -95,6 +95,7 @@ class WKEditorInputView: WKComponentView { private lazy var plainToolbarView: WKEditorToolbarPlainView = { let view = UINib(nibName: String(describing: WKEditorToolbarPlainView.self), bundle: Bundle.module).instantiate(withOwner: nil).first as! WKEditorToolbarPlainView + view.delegate = delegate view.translatesAutoresizingMaskIntoConstraints = false return view }() From 9732a8c0c85c7ef113a3178d6a6d15b9b70daf8a Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Thu, 7 Dec 2023 09:08:07 -0600 Subject: [PATCH 6/9] Remove clear formatting button for now --- .../editor/clear.imageset/Contents.json | 15 -------------- .../editor/clear.imageset/clear.pdf | Bin 4080 -> 0 bytes .../WKEditorToolbarHighlightView.swift | 6 ------ .../WKEditorToolbarHighlightView.xib | 19 ++++++------------ .../WKSourceEditorLocalizedStrings.swift | 4 +--- .../Sources/Components/Style/WKIcon.swift | 1 - Wikipedia/Code/PageEditorViewController.swift | 1 - .../UITestHelperViewController.swift | 1 - 8 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 Components/Sources/Components/Assets.xcassets/editor/clear.imageset/Contents.json delete mode 100644 Components/Sources/Components/Assets.xcassets/editor/clear.imageset/clear.pdf diff --git a/Components/Sources/Components/Assets.xcassets/editor/clear.imageset/Contents.json b/Components/Sources/Components/Assets.xcassets/editor/clear.imageset/Contents.json deleted file mode 100644 index 1bf1acc8577..00000000000 --- a/Components/Sources/Components/Assets.xcassets/editor/clear.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "clear.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "template-rendering-intent" : "template" - } -} diff --git a/Components/Sources/Components/Assets.xcassets/editor/clear.imageset/clear.pdf b/Components/Sources/Components/Assets.xcassets/editor/clear.imageset/clear.pdf deleted file mode 100644 index 561d583a83256e5e9b792099486a095faef4a9cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4080 zcmai%cT`hb7RD(-AQVw4Qq(JtB2rRmBE5uAq>0ioApt@QLMWm%rAQNL22el*sZtaa z1Oe$H3=!!fAYHnYM-`c1ndh4~Yt3C*xhLP*cjw%_zdwFk*ib`D5+;QJ3pY)zPR-}8 zJ$%>H0!9K*fQWShpFa;k^zd#DBu7A+Dj5S1ErJUP??Ju0U`Tikyd4pT2b7e+o+J-E z#ue;Kt8c8U!vN#>ND=ds9LU+9eJ<)gMSDn7mBD|LQG8;CjWx46zMwdDGU4RsgjAdd z`3`z{@_hO5TqN7k8E^euReymeXob{IFd?CD+MfK%LtGp+eF_m6JB>7zl*>wU3DBy# zh#}>b(ebv$3lO0j6uo#%U$E<_(=b(`fSI6M^u7gB6V%A(Pll!;SOV)Q=utHO|DE3N*wjDkurcIY>_m zda>D(Id1blIPJc9s2C-c=j+4+#t;b_XYSnYOu`R*FekrPl*Q@XAskD7HUp-|X(a*C z^Bo~6b~0|`J{zlRzUrq)^ZFIR%^a+v6(yp6ASJokq@^W@+AiLU+ZXbzpl4O?ER8Xm zeB!8KLqfqN;k5Z(zYpoNWBeZz0u;e`H{8#vQdbAfIOxE^9f5!yY#uD(zxCbNje$2po1#K>nQ3N{3kS;7l#9M_BJ{8Ctk}F{?*nf@gUYMl(wsRRy=-axL*)%C(Ts11iZtqf&o7$yvp`Fk-Xz)Zxv*!8!E23e{Xi_k?5KBgI_y^tdfNTc991Cn4E$F(Latk}~# z1FEmk0wNa@IMHE3JjOy|DdoWz(N2QaB8nn4rxV)F;ZPpO%~fm+iiI)&Tj9g;%7%$& zL^us}1T@tKFUae>RJo>dP5rSkTb^5wSwV7DnuS4)hQE$K1eJgwuaPI(iV_OroRj9s z*M$ud`^i3JTd53D+tYzM-*UcI(izpO)SConm0rr!8Y^#53`J|EK1#yg#-?H;u(!sg zn~j8D#Rtb%95u*SnJs-U{P;AVTKD5??<>po%g=qle}JAq$!70%C(JglpZZ+0&Wsnv zTTY#s5}4wfDtl{ur~!Iq3t`OrI65J^Iy!a@IsK9{K^c-MA=vD{5=+`X>vr}=l3^5j*IrfWl{2( zMa7G`l3hyK!-a}Pc6nuH4p|q^hrek)_ZgXZPZ2(XKF z>I>DB4fYMeU6EZFqhh#kcn$mJ0LlAIb%=lOk@?SKm7Ocm6O5wQMW1$~b4Sz6JH-ws(KWpb>T>)3^!7uGv?J;=%QMbsE z9;1gwrL|Wa%a*5G)LyC?jnznYTC%$|yKuQI4%?R%ISr8oZMy!%wvR`S8wh`lpC2{% zzq~!%u@SOZ^LXR&uFofLCZCVPvsG(mDOhux!FR=?RgZqzlfn>L2NnNjH^r@*VgH=Bme zMXIjNn2%#m8Y%OS=Bnx(0&N2|7PVL6D5y}>_oe%U(p{O>-oWJk^Tj7g%icQZQsO$f9^9AD@CjH|YYAP6ir@)9cbTMARX+JX zt+=#!q&=8iVzctnBY&u7_p2$n(4kn~TERcfzh*IPFQ)Hgb^1Nqg#g0r^JUkXS@*KN zdlN->Y8m`zcC2?HBO6uzQ+M{$`01k#?JP;vUf;L*s5t9Cve(6!f7nL3!%uF{anEjH z;*luW;B0z>~YYtU}qC{^; z5Boh`Z~oFAP41outrPq9Vl%0$FeAWcx5fe6*7U`>Yd%F;XC$vyey4B4bq4o&vfGES zoRb?lQdq0J5xkeVYq#DSH@jf4WssB+qwI5o`Rl5$h^zhd=w`^;?mzkYfI`1RvkVOW z3wRIs^+2OSE?Qk(4daQ&0S5qU3|RjPIe_S2O#ByPdjb%BJdS`-Bl-fCP-+NF4uHvj zhh#4*dBXsRE&=CBh35lAr)K*NkYNYmf6u6nAz@sI4nOeS^C!3eh2=2V&nM34W9$F} z6Tl3BL8V{_DH*`X3*$lZ1E_@l9qN5aV!zG}`!yV#(KrW(!sK9ZI1~;;$RObsP^c*N z^H=0==b=(R&dZKE;eG#4>cFQ?9qdR1qMOD6vVYG>74?a@-+%vgQeO|eJ(yYy1Q`0C z3y_hPMo0tpz)uY!Ek`Z!!3DVe(x6Brb@uqXhCs+rU*Yc>6bk>RhJ;hw_+N3-@c)tT zf5pjDXQ017i$FmCkq?1HQho4WaY*@pYSO>I2gw6NaKU?gAEQkOe$@I=2Owi2k?M~F z4^Rt^cy(s(!)YcGwpmyv_Z%Hw5mP^=R8|A+jr Xn - + - + - + - + - + - - - - - + @@ -95,7 +91,6 @@ - @@ -108,10 +103,8 @@ - - diff --git a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift index eb7ffadb5a7..226b2883adf 100644 --- a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift +++ b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorLocalizedStrings.swift @@ -40,7 +40,6 @@ public struct WKSourceEditorLocalizedStrings { let accessibilityLabelButtonBoldSelected: String let accessibilityLabelButtonItalics: String let accessibilityLabelButtonItalicsSelected: String - let accessibilityLabelButtonClearFormatting: String let accessibilityLabelButtonShowMore: String let accessibilityLabelButtonComment: String @@ -69,7 +68,7 @@ public struct WKSourceEditorLocalizedStrings { let accessibilityLabelReplaceTypeSingle: String let accessibilityLabelReplaceTypeAll: String - public init(inputViewTextFormatting: String, inputViewStyle: String, inputViewClearFormatting: String, inputViewParagraph: String, inputViewHeading: String, inputViewSubheading1: String, inputViewSubheading2: String, inputViewSubheading3: String, inputViewSubheading4: String, findReplaceTypeSingle: String, findReplaceTypeAll: String, findReplaceWith: String, accessibilityLabelButtonFormatText: String, accessibilityLabelButtonCitation: String, accessibilityLabelButtonCitationSelected: String, accessibilityLabelButtonLink: String, accessibilityLabelButtonLinkSelected: String, accessibilityLabelButtonTemplate: String, accessibilityLabelButtonTemplateSelected: String, accessibilityLabelButtonMedia: String, accessibilityLabelButtonFind: String, accessibilityLabelButtonListUnordered: String, accessibilityLabelButtonListUnorderedSelected: String, accessibilityLabelButtonListOrdered: String, accessibilityLabelButtonListOrderedSelected: String, accessibilityLabelButtonInceaseIndent: String, accessibilityLabelButtonDecreaseIndent: String, accessibilityLabelButtonCursorUp: String, accessibilityLabelButtonCursorDown: String, accessibilityLabelButtonCursorLeft: String, accessibilityLabelButtonCursorRight: String, accessibilityLabelButtonBold: String, accessibilityLabelButtonBoldSelected: String, accessibilityLabelButtonItalics: String, accessibilityLabelButtonItalicsSelected: String, accessibilityLabelButtonClearFormatting: String, accessibilityLabelButtonShowMore: String, accessibilityLabelButtonComment: String, accessibilityLabelButtonCommentSelected: String, accessibilityLabelButtonSuperscript: String, accessibilityLabelButtonSuperscriptSelected: String, accessibilityLabelButtonSubscript: String, accessibilityLabelButtonSubscriptSelected: String, accessibilityLabelButtonUnderline: String, accessibilityLabelButtonUnderlineSelected: String, accessibilityLabelButtonStrikethrough: String, accessibilityLabelButtonStrikethroughSelected: String, accessibilityLabelButtonCloseMainInputView: String, accessibilityLabelButtonCloseHeaderSelectInputView: String, accessibilityLabelFindTextField: String, accessibilityLabelFindButtonClear: String, accessibilityLabelFindButtonClose: String, accessibilityLabelFindButtonNext: String, accessibilityLabelFindButtonPrevious: String, accessibilityLabelReplaceTextField: String, accessibilityLabelReplaceButtonClear: String, accessibilityLabelReplaceButtonPerformFormat: String, accessibilityLabelReplaceButtonSwitchFormat: String, accessibilityLabelReplaceTypeSingle: String, accessibilityLabelReplaceTypeAll: String) { + public init(inputViewTextFormatting: String, inputViewStyle: String, inputViewClearFormatting: String, inputViewParagraph: String, inputViewHeading: String, inputViewSubheading1: String, inputViewSubheading2: String, inputViewSubheading3: String, inputViewSubheading4: String, findReplaceTypeSingle: String, findReplaceTypeAll: String, findReplaceWith: String, accessibilityLabelButtonFormatText: String, accessibilityLabelButtonCitation: String, accessibilityLabelButtonCitationSelected: String, accessibilityLabelButtonLink: String, accessibilityLabelButtonLinkSelected: String, accessibilityLabelButtonTemplate: String, accessibilityLabelButtonTemplateSelected: String, accessibilityLabelButtonMedia: String, accessibilityLabelButtonFind: String, accessibilityLabelButtonListUnordered: String, accessibilityLabelButtonListUnorderedSelected: String, accessibilityLabelButtonListOrdered: String, accessibilityLabelButtonListOrderedSelected: String, accessibilityLabelButtonInceaseIndent: String, accessibilityLabelButtonDecreaseIndent: String, accessibilityLabelButtonCursorUp: String, accessibilityLabelButtonCursorDown: String, accessibilityLabelButtonCursorLeft: String, accessibilityLabelButtonCursorRight: String, accessibilityLabelButtonBold: String, accessibilityLabelButtonBoldSelected: String, accessibilityLabelButtonItalics: String, accessibilityLabelButtonItalicsSelected: String, accessibilityLabelButtonShowMore: String, accessibilityLabelButtonComment: String, accessibilityLabelButtonCommentSelected: String, accessibilityLabelButtonSuperscript: String, accessibilityLabelButtonSuperscriptSelected: String, accessibilityLabelButtonSubscript: String, accessibilityLabelButtonSubscriptSelected: String, accessibilityLabelButtonUnderline: String, accessibilityLabelButtonUnderlineSelected: String, accessibilityLabelButtonStrikethrough: String, accessibilityLabelButtonStrikethroughSelected: String, accessibilityLabelButtonCloseMainInputView: String, accessibilityLabelButtonCloseHeaderSelectInputView: String, accessibilityLabelFindTextField: String, accessibilityLabelFindButtonClear: String, accessibilityLabelFindButtonClose: String, accessibilityLabelFindButtonNext: String, accessibilityLabelFindButtonPrevious: String, accessibilityLabelReplaceTextField: String, accessibilityLabelReplaceButtonClear: String, accessibilityLabelReplaceButtonPerformFormat: String, accessibilityLabelReplaceButtonSwitchFormat: String, accessibilityLabelReplaceTypeSingle: String, accessibilityLabelReplaceTypeAll: String) { self.inputViewTextFormatting = inputViewTextFormatting self.inputViewStyle = inputViewStyle self.inputViewClearFormatting = inputViewClearFormatting @@ -105,7 +104,6 @@ public struct WKSourceEditorLocalizedStrings { self.accessibilityLabelButtonBoldSelected = accessibilityLabelButtonBoldSelected self.accessibilityLabelButtonItalics = accessibilityLabelButtonItalics self.accessibilityLabelButtonItalicsSelected = accessibilityLabelButtonItalicsSelected - self.accessibilityLabelButtonClearFormatting = accessibilityLabelButtonClearFormatting self.accessibilityLabelButtonShowMore = accessibilityLabelButtonShowMore self.accessibilityLabelButtonComment = accessibilityLabelButtonComment self.accessibilityLabelButtonCommentSelected = accessibilityLabelButtonCommentSelected diff --git a/Components/Sources/Components/Style/WKIcon.swift b/Components/Sources/Components/Style/WKIcon.swift index 5f305d5ec66..7ce631d8501 100644 --- a/Components/Sources/Components/Style/WKIcon.swift +++ b/Components/Sources/Components/Style/WKIcon.swift @@ -25,7 +25,6 @@ public enum WKIcon { static let userContributions = UIImage(named: "user-contributions", in: .module, with: nil) // Editor-specific icons - static let clear = UIImage(named: "editor/clear", in: .module, with: nil) // static let formatText = UIImage(named: "editor/format-text", in: .module, with: nil)// static let formatHeading = UIImage(named: "editor/format-heading", in: .module, with: nil)// diff --git a/Wikipedia/Code/PageEditorViewController.swift b/Wikipedia/Code/PageEditorViewController.swift index 145a7a3a6e4..6ad69131e3c 100644 --- a/Wikipedia/Code/PageEditorViewController.swift +++ b/Wikipedia/Code/PageEditorViewController.swift @@ -138,7 +138,6 @@ final class PageEditorViewController: UIViewController { accessibilityLabelButtonBoldSelected: CommonStrings.accessibilityLabelButtonBoldSelected, accessibilityLabelButtonItalics: CommonStrings.accessibilityLabelButtonItalics, accessibilityLabelButtonItalicsSelected: CommonStrings.accessibilityLabelButtonItalicsSelected, - accessibilityLabelButtonClearFormatting: CommonStrings.accessibilityLabelButtonClearFormatting, accessibilityLabelButtonShowMore: CommonStrings.accessibilityLabelButtonShowMore, accessibilityLabelButtonComment: CommonStrings.accessibilityLabelButtonComment, accessibilityLabelButtonCommentSelected: CommonStrings.accessibilityLabelButtonCommentSelected, diff --git a/WikipediaUITests/UITestHelperViewController.swift b/WikipediaUITests/UITestHelperViewController.swift index 4b65eb476aa..ffee39c0385 100644 --- a/WikipediaUITests/UITestHelperViewController.swift +++ b/WikipediaUITests/UITestHelperViewController.swift @@ -75,7 +75,6 @@ public class UITestHelperViewController: WKCanvasViewController { accessibilityLabelButtonBoldSelected: CommonStrings.accessibilityLabelButtonBoldSelected, accessibilityLabelButtonItalics: CommonStrings.accessibilityLabelButtonItalics, accessibilityLabelButtonItalicsSelected: CommonStrings.accessibilityLabelButtonItalicsSelected, - accessibilityLabelButtonClearFormatting: CommonStrings.accessibilityLabelButtonClearFormatting, accessibilityLabelButtonShowMore: CommonStrings.accessibilityLabelButtonShowMore, accessibilityLabelButtonComment: CommonStrings.accessibilityLabelButtonComment, accessibilityLabelButtonCommentSelected: CommonStrings.accessibilityLabelButtonCommentSelected, From c13154faa511a7ad28be56608e1b6daa4fae78d2 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Thu, 7 Dec 2023 09:40:39 -0600 Subject: [PATCH 7/9] Fix tests --- ...SourceEditorAccessibilityIdentifiers.swift | 10 ++-- .../WKSourceEditorViewController.swift | 4 +- .../ComponentsTests/WKSourceEditorTests.swift | 2 - Wikipedia/Code/PageEditorViewController.swift | 4 +- .../UITestHelperViewController.swift | 4 +- WikipediaUITests/WKSourceEditorUITests.swift | 50 +++---------------- 6 files changed, 14 insertions(+), 60 deletions(-) diff --git a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorAccessibilityIdentifiers.swift b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorAccessibilityIdentifiers.swift index 4d8f3244671..5135692b8e8 100644 --- a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorAccessibilityIdentifiers.swift +++ b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorAccessibilityIdentifiers.swift @@ -4,18 +4,16 @@ public struct WKSourceEditorAccessibilityIdentifiers { static var current: WKSourceEditorAccessibilityIdentifiers? - public init(textView: String, findButton: String, showMoreButton: String, closeButton: String, formatTextButton: String, formatHeadingButton: String, expandingToolbar: String, highlightToolbar: String, findToolbar: String, mainInputView: String, headerSelectInputView: String) { + public init(textView: String, findButton: String, showMoreButton: String, closeButton: String, formatTextButton: String, expandingToolbar: String, highlightToolbar: String, findToolbar: String, inputView: String) { self.textView = textView self.findButton = findButton self.showMoreButton = showMoreButton self.closeButton = closeButton self.formatTextButton = formatTextButton - self.formatHeadingButton = formatHeadingButton self.expandingToolbar = expandingToolbar self.highlightToolbar = highlightToolbar self.findToolbar = findToolbar - self.mainInputView = mainInputView - self.headerSelectInputView = headerSelectInputView + self.inputView = inputView } let textView: String @@ -23,10 +21,8 @@ public struct WKSourceEditorAccessibilityIdentifiers { let showMoreButton: String let closeButton: String let formatTextButton: String - let formatHeadingButton: String let expandingToolbar: String let highlightToolbar: String let findToolbar: String - let mainInputView: String - let headerSelectInputView: String + let inputView: String } diff --git a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift index 9f601089605..ca74a6f14b0 100644 --- a/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift +++ b/Components/Sources/Components/Components/Editors/Source Editor/WKSourceEditorViewController.swift @@ -64,7 +64,9 @@ public class WKSourceEditorViewController: WKComponentViewController { // Input Views private lazy var editorInputView: UIView? = { - return WKEditorInputView(delegate: self) + let inputView = WKEditorInputView(delegate: self) + inputView.accessibilityIdentifier = WKSourceEditorAccessibilityIdentifiers.current?.inputView + return inputView }() // Input Tracking Properties diff --git a/Components/Tests/ComponentsTests/WKSourceEditorTests.swift b/Components/Tests/ComponentsTests/WKSourceEditorTests.swift index 3e2af01ed72..a31a3cad7dc 100644 --- a/Components/Tests/ComponentsTests/WKSourceEditorTests.swift +++ b/Components/Tests/ComponentsTests/WKSourceEditorTests.swift @@ -59,7 +59,6 @@ extension WKSourceEditorLocalizedStrings { findReplaceTypeAll: "", findReplaceWith: "", accessibilityLabelButtonFormatText: "", - accessibilityLabelButtonFormatHeading: "", accessibilityLabelButtonCitation: "", accessibilityLabelButtonCitationSelected: "", accessibilityLabelButtonLink: "", @@ -82,7 +81,6 @@ extension WKSourceEditorLocalizedStrings { accessibilityLabelButtonBoldSelected: "", accessibilityLabelButtonItalics: "", accessibilityLabelButtonItalicsSelected: "", - accessibilityLabelButtonClearFormatting: "", accessibilityLabelButtonShowMore: "", accessibilityLabelButtonComment: "", accessibilityLabelButtonCommentSelected: "", diff --git a/Wikipedia/Code/PageEditorViewController.swift b/Wikipedia/Code/PageEditorViewController.swift index 6ad69131e3c..e89fc8c9df6 100644 --- a/Wikipedia/Code/PageEditorViewController.swift +++ b/Wikipedia/Code/PageEditorViewController.swift @@ -319,10 +319,8 @@ enum SourceEditorAccessibilityIdentifiers: String { case showMoreButton = "Source Editor Show More Button" case closeButton = "Source Editor Close Button" case formatTextButton = "Source Editor Format Text Button" - case formatHeadingButton = "Source Editor Format Heading Button" case expandingToolbar = "Source Editor Expanding Toolbar" case highlightToolbar = "Source Editor Highlight Toolbar" case findToolbar = "Source Editor Find Toolbar" - case mainInputView = "Source Editor Main Input View" - case headerSelectInputView = "Source Editor Header Select Input View" + case inputView = "Source Editor Input View" } diff --git a/WikipediaUITests/UITestHelperViewController.swift b/WikipediaUITests/UITestHelperViewController.swift index ffee39c0385..7e78ec0431e 100644 --- a/WikipediaUITests/UITestHelperViewController.swift +++ b/WikipediaUITests/UITestHelperViewController.swift @@ -106,12 +106,10 @@ public class UITestHelperViewController: WKCanvasViewController { showMoreButton: SourceEditorAccessibilityIdentifiers.showMoreButton.rawValue, closeButton: SourceEditorAccessibilityIdentifiers.closeButton.rawValue, formatTextButton: SourceEditorAccessibilityIdentifiers.formatTextButton.rawValue, - formatHeadingButton: SourceEditorAccessibilityIdentifiers.formatHeadingButton.rawValue, expandingToolbar: SourceEditorAccessibilityIdentifiers.expandingToolbar.rawValue, highlightToolbar: SourceEditorAccessibilityIdentifiers.highlightToolbar.rawValue, findToolbar: SourceEditorAccessibilityIdentifiers.findButton.rawValue, - mainInputView: SourceEditorAccessibilityIdentifiers.mainInputView.rawValue, - headerSelectInputView: SourceEditorAccessibilityIdentifiers.headerSelectInputView.rawValue + inputView: SourceEditorAccessibilityIdentifiers.inputView.rawValue ) let textAlignment: NSTextAlignment = UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft ? .right : .left diff --git a/WikipediaUITests/WKSourceEditorUITests.swift b/WikipediaUITests/WKSourceEditorUITests.swift index e426c1656e0..d0665794997 100644 --- a/WikipediaUITests/WKSourceEditorUITests.swift +++ b/WikipediaUITests/WKSourceEditorUITests.swift @@ -18,8 +18,7 @@ final class WKSourceEditorUITests: XCTestCase { textView.tap() textView.typeText("Hello World!") - XCTAssertFalse(app.isDisplayingMainInputView) - XCTAssertFalse(app.isDisplayingHeaderSelectView) + XCTAssertFalse(app.isDisplayingInputView) XCTAssertTrue(app.isDisplayingExpandingToolbar) XCTAssertFalse(app.isDisplayingHighlightingToolbar) XCTAssertFalse(app.isDisplayingFindAndReplaceToolbar) @@ -30,8 +29,7 @@ final class WKSourceEditorUITests: XCTestCase { textView.doubleTap() - XCTAssertFalse(app.isDisplayingMainInputView) - XCTAssertFalse(app.isDisplayingHeaderSelectView) + XCTAssertFalse(app.isDisplayingInputView) XCTAssertFalse(app.isDisplayingExpandingToolbar) XCTAssertTrue(app.isDisplayingHighlightingToolbar) XCTAssertFalse(app.isDisplayingFindAndReplaceToolbar) @@ -42,8 +40,7 @@ final class WKSourceEditorUITests: XCTestCase { app.buttons["Source Editor Show More Button"].tap() - XCTAssertTrue(app.isDisplayingMainInputView) - XCTAssertFalse(app.isDisplayingHeaderSelectView) + XCTAssertTrue(app.isDisplayingInputView) XCTAssertFalse(app.isDisplayingExpandingToolbar) XCTAssertFalse(app.isDisplayingHighlightingToolbar) XCTAssertFalse(app.isDisplayingFindAndReplaceToolbar) @@ -54,8 +51,7 @@ final class WKSourceEditorUITests: XCTestCase { app.buttons["Source Editor Format Text Button"].tap() - XCTAssertTrue(app.isDisplayingMainInputView) - XCTAssertFalse(app.isDisplayingHeaderSelectView) + XCTAssertTrue(app.isDisplayingInputView) XCTAssertFalse(app.isDisplayingExpandingToolbar) XCTAssertFalse(app.isDisplayingHighlightingToolbar) XCTAssertFalse(app.isDisplayingFindAndReplaceToolbar) @@ -64,36 +60,6 @@ final class WKSourceEditorUITests: XCTestCase { mainInputViewAttachment.name = ScreenshotNames.main.rawValue add(mainInputViewAttachment) - app.tables.element(boundBy: 0).cells.element(boundBy: 2).tap() - - XCTAssertFalse(app.isDisplayingMainInputView) - XCTAssertTrue(app.isDisplayingHeaderSelectView) - XCTAssertFalse(app.isDisplayingExpandingToolbar) - XCTAssertFalse(app.isDisplayingHighlightingToolbar) - XCTAssertFalse(app.isDisplayingFindAndReplaceToolbar) - - app.tables.element(boundBy: 0).cells.element(boundBy: 0).tap() - - let headerSelectInputView1Attachment = XCTAttachment(screenshot: app.screenshot()) - headerSelectInputView1Attachment.name = ScreenshotNames.headerSelect1.rawValue - add(headerSelectInputView1Attachment) - - app.buttons["Source Editor Close Button"].tap() - - app.buttons["Source Editor Format Heading Button"].tap() - - XCTAssertFalse(app.isDisplayingMainInputView) - XCTAssertTrue(app.isDisplayingHeaderSelectView) - XCTAssertFalse(app.isDisplayingExpandingToolbar) - XCTAssertFalse(app.isDisplayingHighlightingToolbar) - XCTAssertFalse(app.isDisplayingFindAndReplaceToolbar) - - app.tables.element(boundBy: 0).cells.element(boundBy: 2).tap() - - let headerSelectInputView2Attachment = XCTAttachment(screenshot: app.screenshot()) - headerSelectInputView2Attachment.name = ScreenshotNames.headerSelect2.rawValue - add(headerSelectInputView2Attachment) - app.buttons["Source Editor Close Button"].tap() app.buttons["Source Editor Find Button"].tap() @@ -117,12 +83,8 @@ extension XCUIApplication { return otherElements["Source Editor Find Toolbar"].exists } - var isDisplayingMainInputView: Bool { - return otherElements[ "Source Editor Main Input View"].exists - } - - var isDisplayingHeaderSelectView: Bool { - return otherElements["Source Editor Header Select Input View"].exists + var isDisplayingInputView: Bool { + return otherElements[ "Source Editor Input View"].exists } } From b50fdc3e7b077fd5801fa274012cd53f3fe7bb2f Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Mon, 8 Jan 2024 09:48:32 -0600 Subject: [PATCH 8/9] Fix bugs from merge --- .../Editors/Common Views/Input Views/WKEditorInputView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift index 1a3e3b87a5a..9e6fead4fc2 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorInputView.swift @@ -6,6 +6,7 @@ protocol WKEditorInputViewDelegate: AnyObject { func didTapBold(isSelected: Bool) func didTapItalics(isSelected: Bool) func didTapTemplate(isSelected: Bool) + func didTapStrikethrough(isSelected: Bool) } class WKEditorInputView: WKComponentView { @@ -102,6 +103,7 @@ class WKEditorInputView: WKComponentView { private lazy var groupedToolbarView: WKEditorToolbarGroupedView = { let view = UINib(nibName: String(describing: WKEditorToolbarGroupedView.self), bundle: Bundle.module).instantiate(withOwner: nil).first as! WKEditorToolbarGroupedView + view.delegate = delegate view.translatesAutoresizingMaskIntoConstraints = false return view }() From 55dff0bff8b7df47b960e8342987565716c9ed6c Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Mon, 8 Jan 2024 09:48:38 -0600 Subject: [PATCH 9/9] Strings changes from building --- .../he.lproj/Localizable.strings | Bin 482946 -> 482610 bytes .../ia.lproj/Localizable.strings | Bin 219310 -> 219134 bytes .../it.lproj/Localizable.strings | Bin 122574 -> 122388 bytes .../mk.lproj/Localizable.strings | Bin 612462 -> 612026 bytes .../pt.lproj/Localizable.strings | Bin 239952 -> 239774 bytes .../sl.lproj/Localizable.strings | Bin 227192 -> 227006 bytes .../sv.lproj/Localizable.strings | Bin 227250 -> 227080 bytes .../tr.lproj/Localizable.strings | Bin 251194 -> 250974 bytes .../zh-hant.lproj/Localizable.strings | Bin 277424 -> 277214 bytes 9 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Wikipedia/iOS Native Localizations/he.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/he.lproj/Localizable.strings index fb90bd8571836c8a9bfcf88b99f0642358381879..41ce491d253cf2a728ade453600ceb502fb9d2a7 100644 GIT binary patch delta 47 wcmZqLE4yiz?1lpV>3ZjwxtdQ2w4V}S1Y#y2W(HywAZ7((w(X|`*mw8>0L1+g3IG5A delta 100 zcmdnAOSWmR?1lpV>F0JbN=*(pqA_(26VG&`A8dNl9n{&>rWfclIZTi1W8|5BVINSU wAdyvSdVmCwwLz0vZ~Cuoj6BU%{Owizj6lo;#LPg<0>rF9%(lIXpM8ff06lRc3;+NC diff --git a/Wikipedia/iOS Native Localizations/ia.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/ia.lproj/Localizable.strings index 1236b8bd7c19288c99a255f847cfd557c3f63cfe..1b283395206227f1014ed2ba22b4cf6bb90e32fb 100644 GIT binary patch delta 31 lcmZ3tk@w$v-VMjtrpN4L5}2-2z^F2P)ec6U<_m1? Q7uXnqm}&b3HfFs*0234!xc~qF diff --git a/Wikipedia/iOS Native Localizations/it.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/it.lproj/Localizable.strings index ec3156c017fbedb8e3a6db84059b4fd7fd6ca906..5d3bc7337ea48820fa358b26ddb07ec9f2589924 100644 GIT binary patch delta 18 acmX@Nmwn0}_6>Gz%|F_<|7c^p77hShMG3+H delta 70 zcmbQThyC1M_6>GzlX+a+CSP#jnZ9K$qr~Kb-z?Jusu;N@3%CjirZVIJVLpQbLoq`M aLncGca+Jf7)ZtJ$ljd(|@X jG)oAzO9(LnF%u9o12GE_vjQ<25VHd@$94%J&P6T&#Nivj diff --git a/Wikipedia/iOS Native Localizations/pt.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/pt.lproj/Localizable.strings index 7d93c3a6044ad848888339e5c7af088aa30adfef..28f3d5330ea3f1cbe4b2b9404df9be0e822b36dd 100644 GIT binary patch delta 30 lcmca`iErLTz70m~lk-@)n%}Xvzhh?vVy5ly*qM_S0szRH3`_t3 delta 58 zcmbPtk?+DKz70m~)BUC~I!)go#>h9hKM-RSm~O+&tT8!T8W!^+cqhOPY! P8zT@iZ9l`t{3#y*!Xp+i diff --git a/Wikipedia/iOS Native Localizations/sv.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/sv.lproj/Localizable.strings index 2fbd790dcd733d0bd90f2858a37b2c8eae99fbdb..6bd8880be7ae5ddb53ac47703bbfaadf447cc2b9 100644 GIT binary patch delta 30 kcmdn=p10#2?}jC8li#p#HAk?wN3b&jG1K-4cIK!80K-KJtpET3 delta 54 zcmeBp$Gho0?}jC8(;Ye(ohI*l&oh0}E=H;8Yy26xrt{P?noWMi!qdEtt$iIEBM>uf KU&qEARR92WQWW6; diff --git a/Wikipedia/iOS Native Localizations/tr.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/tr.lproj/Localizable.strings index 6d2386dd534282f0543af5347427ff5739cdf027..648cc7ac3ca22a01ffd2fcc72669f8d007b6f303 100644 GIT binary patch delta 30 kcmdnBivQjU{tXHoli!JQHM4QHvvD#4G1GQ7PG*xc0H+rT3jhEB delta 57 zcmcb&f`8X4{tXHo(;u8;l$xAir#1ZnJ0sU*AttHGJW>kND;6;ZO}1gPcg-M`!5@-7)PDUVR0%GRvlQ>!Ai~w;w4>tI MG4u8f94vZ90NY0vZ2$lO