From b4a6647db0c0d2983b102816acd229b1f7941613 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Tue, 30 Jan 2024 15:56:50 -0600 Subject: [PATCH 1/8] Fix duplicate string key warning --- WMF Framework/CommonStrings.swift | 2 +- .../ReadingThemesControlsViewController.swift | 2 +- .../qqq.lproj/Localizable.strings | 2 +- .../en.lproj/Localizable.strings | Bin 447156 -> 446966 bytes 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WMF Framework/CommonStrings.swift b/WMF Framework/CommonStrings.swift index 91ad2250590..0b09c30aec8 100644 --- a/WMF Framework/CommonStrings.swift +++ b/WMF Framework/CommonStrings.swift @@ -120,7 +120,7 @@ public class CommonStrings: NSObject { @objc public static let dismissButtonTitle = WMFLocalizedString("announcements-dismiss", value: "Dismiss", comment: "Button text indicating a user wants to dismiss an announcement {{Identical|No thanks}}") - @objc public static let textSizeSliderAccessibilityLabel = WMFLocalizedString("reading-themes-controls-accessibility-text-size-slider", value: "Text size slider", comment: "Accessibility label for the text size slider that adjusts article text size.") + @objc public static let textSizeSliderAccessibilityLabel = WMFLocalizedString("reading-themes-controls-accessibility-text-size-slider", value: "Text size slider", comment: "Accessibility label for the text size slider that adjusts text size.") @objc public static let deleteActionTitle = WMFLocalizedString("article-delete", value: "Delete", comment: "Title of the action that deletes the selected articles article.") diff --git a/Wikipedia/Code/ReadingThemesControlsViewController.swift b/Wikipedia/Code/ReadingThemesControlsViewController.swift index ae2fc16b4c2..93e954c9d69 100644 --- a/Wikipedia/Code/ReadingThemesControlsViewController.swift +++ b/Wikipedia/Code/ReadingThemesControlsViewController.swift @@ -72,7 +72,7 @@ class ReadingThemesControlsViewController: UIViewController { } brightnessSlider.value = Float(UIScreen.main.brightness) - slider.accessibilityLabel = WMFLocalizedString("reading-themes-controls-accessibility-text-size-slider", value: "Text size slider", comment: "Accessibility label for the text size slider in the Reading Themes Controls popover") + slider.accessibilityLabel = CommonStrings.textSizeSliderAccessibilityLabel brightnessSlider.accessibilityLabel = WMFLocalizedString("reading-themes-controls-accessibility-brightness-slider", value: "Brightness slider", comment: "Accessibility label for the brightness slider in the Reading Themes Controls popover") lightThemeButton.accessibilityLabel = WMFLocalizedString("reading-themes-controls-accessibility-light-theme-button", value: "Light theme", comment: "Accessibility label for the light theme button in the Reading Themes Controls popover") sepiaThemeButton.accessibilityLabel = WMFLocalizedString("reading-themes-controls-accessibility-sepia-theme-button", value: "Sepia theme", comment: "Accessibility label for the sepia theme button in the Reading Themes Controls popover") diff --git a/Wikipedia/Localizations/qqq.lproj/Localizable.strings b/Wikipedia/Localizations/qqq.lproj/Localizable.strings index 3f71a381d11..918014a4b0d 100644 --- a/Wikipedia/Localizations/qqq.lproj/Localizable.strings +++ b/Wikipedia/Localizations/qqq.lproj/Localizable.strings @@ -950,7 +950,7 @@ "reading-themes-controls-accessibility-light-theme-button" = "Accessibility label for the light theme button in the Reading Themes Controls popover"; "reading-themes-controls-accessibility-sepia-theme-button" = "Accessibility label for the sepia theme button in the Reading Themes Controls popover"; "reading-themes-controls-accessibility-syntax-highlighting-switch" = "Accessibility text for the syntax highlighting toggle in the Reading Themes Controls popover"; -"reading-themes-controls-accessibility-text-size-slider" = "Accessibility label for the text size slider in the Reading Themes Controls popover"; +"reading-themes-controls-accessibility-text-size-slider" = "Accessibility label for the text size slider that adjusts text size."; "reading-themes-controls-syntax-highlighting" = "Text for syntax highlighting label in the Reading Themes Controls popover"; "reference-section-button-accessibility-label" = "Voiceover label for the top button (that jumps to article's reference section) when viewing a reference's details"; "reference-title" = "Title shown above reference/citation popover. $1 is replaced with the reference link text - i.e. '[1]' {{Identical|Reference}}"; diff --git a/Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings index ddd6f053e8d8f6991744972363e50b2773e04093..935b9a24ae49af4f7d17fe10975f240434c70671 100644 GIT binary patch delta 36 ucmV+<0Nekxr5pC68-RoXgaU*Ev;GOa%%6AOIkj@$&?ClN6L7hj{b^w|Mjg Fe%;D)6R7|I From b122417905df203a1ff6fcf7ab9bd38c184229a7 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Tue, 30 Jan 2024 15:56:59 -0600 Subject: [PATCH 2/8] PR feedback - remove unused parameter --- Components/Sources/Components/Style/WKIcon.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Components/Sources/Components/Style/WKIcon.swift b/Components/Sources/Components/Style/WKIcon.swift index 7b9ccf37b70..b866a9940ba 100644 --- a/Components/Sources/Components/Style/WKIcon.swift +++ b/Components/Sources/Components/Style/WKIcon.swift @@ -71,7 +71,7 @@ public enum WKSFSymbolIcon { case textFormatSize case textFormat - public static func `for`(symbol: WKSFSymbolIcon, font: WKFont = .subheadline, compatibleWith traitCollection: UITraitCollection = WKAppEnvironment.current.traitCollection, renderingMode: UIImage.RenderingMode = .alwaysTemplate, paletteColors: [UIColor]? = nil) -> UIImage? { + public static func `for`(symbol: WKSFSymbolIcon, font: WKFont = .subheadline, compatibleWith traitCollection: UITraitCollection = WKAppEnvironment.current.traitCollection, paletteColors: [UIColor]? = nil) -> UIImage? { let font = WKFont.for(font) let configuration = UIImage.SymbolConfiguration(font: font) From 0e86df07c9953fe0ab1cfe54aa0ae75b560b1181 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Tue, 30 Jan 2024 16:21:53 -0600 Subject: [PATCH 3/8] Crash fix - add missing safety to comment formatter --- .../WKSourceEditorFormatterComment.m | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Components/Sources/ComponentsObjC/WKSourceEditorFormatterComment.m b/Components/Sources/ComponentsObjC/WKSourceEditorFormatterComment.m index 0361a7557f2..4e0f7fd0ffb 100644 --- a/Components/Sources/ComponentsObjC/WKSourceEditorFormatterComment.m +++ b/Components/Sources/ComponentsObjC/WKSourceEditorFormatterComment.m @@ -37,6 +37,10 @@ - (instancetype)initWithColors:(WKSourceEditorColors *)colors fonts:(WKSourceEdi - (void)addSyntaxHighlightingToAttributedString:(nonnull NSMutableAttributedString *)attributedString inRange:(NSRange)range { + if (![self canEvaluateAttributedString:attributedString againstRange:range]) { + return; + } + [attributedString removeAttribute:WKSourceEditorCustomKeyCommentMarkup range:range]; [attributedString removeAttribute:WKSourceEditorCustomKeyCommentContent range:range]; @@ -72,6 +76,10 @@ - (void)updateColors:(WKSourceEditorColors *)colors inAttributedString:(NSMutabl NSMutableDictionary *mutContentAttributes = [[NSMutableDictionary alloc] initWithDictionary:self.commentContentAttributes]; [mutContentAttributes setObject:colors.grayForegroundColor forKey:NSForegroundColorAttributeName]; self.commentContentAttributes = [[NSDictionary alloc] initWithDictionary:mutContentAttributes]; + + if (![self canEvaluateAttributedString:attributedString againstRange:range]) { + return; + } [attributedString enumerateAttribute:WKSourceEditorCustomKeyCommentMarkup inRange:range @@ -105,6 +113,11 @@ - (void)updateFonts:(WKSourceEditorFonts *)fonts inAttributedString:(NSMutableAt #pragma mark - Public - (BOOL)attributedString:(NSMutableAttributedString *)attributedString isCommentInRange:(NSRange)range { + + if (![self canEvaluateAttributedString:attributedString againstRange:range]) { + return NO; + } + __block BOOL isContentKey = NO; if (range.length == 0) { @@ -116,8 +129,9 @@ - (BOOL)attributedString:(NSMutableAttributedString *)attributedString isComment isContentKey = YES; } else { // Edge case, check previous character if we are up against closing string - if (attrs[WKSourceEditorCustomKeyCommentMarkup] && attributedString.length > range.location - 1) { - attrs = [attributedString attributesAtIndex:range.location - 1 effectiveRange:nil]; + NSRange newRange = NSMakeRange(range.location - 1, 0); + if (attrs[WKSourceEditorCustomKeyCommentMarkup] && [self canEvaluateAttributedString:attributedString againstRange:newRange]) { + attrs = [attributedString attributesAtIndex:newRange.location effectiveRange:nil]; if (attrs[WKSourceEditorCustomKeyCommentContent] != nil) { isContentKey = YES; } From 0e0ddcf2f766b627cf47904a6c8cf1dc4d31a3a2 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Tue, 30 Jan 2024 16:22:15 -0600 Subject: [PATCH 4/8] Design feedback - update toolbar background color and selected button color --- .../Common Views/Base/WKEditorToolbarButton.swift | 5 ++--- .../Common Views/Base/WKEditorToolbarView.swift | 3 +-- .../Common Views/Input Views/WKEditorMultiButton.swift | 2 +- Components/Sources/Components/Style/WKTheme.swift | 10 +++++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarButton.swift b/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarButton.swift index b10a7623b57..8bd12fb60e7 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarButton.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarButton.swift @@ -113,7 +113,7 @@ class WKEditorToolbarButton: WKComponentView { private func createButtonConfig(image: UIImage? = nil) -> UIButton.Configuration { var buttonConfig = UIButton.Configuration.plain() - buttonConfig.baseForegroundColor = (button?.isSelected ?? false) ? theme.inputAccessoryButtonSelectedTint : theme.inputAccessoryButtonTint + buttonConfig.baseForegroundColor = theme.text buttonConfig.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0) buttonConfig.background.cornerRadius = 0 if let image { @@ -125,8 +125,7 @@ class WKEditorToolbarButton: WKComponentView { private func buttonConfigurationUpdateHandler(button: UIButton) { var buttonConfig = button.configuration - buttonConfig?.baseForegroundColor = button.isSelected ? theme.inputAccessoryButtonSelectedTint : theme.inputAccessoryButtonTint - buttonConfig?.background.backgroundColor = button.isSelected ? theme.inputAccessoryButtonSelectedBackgroundColor : theme.accessoryBackground + buttonConfig?.background.backgroundColor = button.isSelected ? self.theme.editorButtonSelectedBackground : theme.paperBackground button.configuration = buttonConfig } diff --git a/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift b/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift index 9fe2eb37f79..4e13220d12b 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift @@ -31,8 +31,7 @@ class WKEditorToolbarView: WKComponentView { // MARK: - Private Helpers private func updateColors() { - tintColor = WKAppEnvironment.current.theme.link - backgroundColor = WKAppEnvironment.current.theme.accessoryBackground + backgroundColor = WKAppEnvironment.current.theme.paperBackground layer.shadowOffset = CGSize(width: 0, height: -2) layer.shadowRadius = 10 diff --git a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorMultiButton.swift b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorMultiButton.swift index fe114a566db..14cd09d366b 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorMultiButton.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Input Views/WKEditorMultiButton.swift @@ -126,7 +126,7 @@ final class WKEditorMultiButton: WKComponentView { private func buttonConfigurationUpdateHandler(button: UIButton) { var buttonConfig = button.configuration - buttonConfig?.background.backgroundColor = button.isSelected ? self.theme.editorMultiButtonSelectedBackground : self.theme.midBackground + buttonConfig?.background.backgroundColor = button.isSelected ? self.theme.editorButtonSelectedBackground : self.theme.midBackground button.configuration = buttonConfig } diff --git a/Components/Sources/Components/Style/WKTheme.swift b/Components/Sources/Components/Style/WKTheme.swift index e04449e88f8..aec529ec3d1 100644 --- a/Components/Sources/Components/Style/WKTheme.swift +++ b/Components/Sources/Components/Style/WKTheme.swift @@ -33,7 +33,7 @@ public struct WKTheme: Equatable { public let editorMatchBackground: UIColor public let editorSelectedMatchBackground: UIColor public let editorReplacedMatchBackground: UIColor - public let editorMultiButtonSelectedBackground: UIColor + public let editorButtonSelectedBackground: UIColor public let editorKeyboardShadow: UIColor public static let light = WKTheme( @@ -67,7 +67,7 @@ public struct WKTheme: Equatable { editorMatchBackground: WKColor.lightMatchBackground, editorSelectedMatchBackground: WKColor.yellow600, editorReplacedMatchBackground: WKColor.matchReplacedBackground, - editorMultiButtonSelectedBackground: WKColor.gray200, + editorButtonSelectedBackground: WKColor.gray200, editorKeyboardShadow: WKColor.gray200 ) @@ -102,7 +102,7 @@ public struct WKTheme: Equatable { editorMatchBackground: WKColor.lightMatchBackground, editorSelectedMatchBackground: WKColor.yellow600, editorReplacedMatchBackground: WKColor.matchReplacedBackground, - editorMultiButtonSelectedBackground: WKColor.beige400, + editorButtonSelectedBackground: WKColor.beige400, editorKeyboardShadow: WKColor.taupe200 ) @@ -137,7 +137,7 @@ public struct WKTheme: Equatable { editorMatchBackground: WKColor.darkMatchBackground, editorSelectedMatchBackground: WKColor.yellow600, editorReplacedMatchBackground: WKColor.matchReplacedBackground, - editorMultiButtonSelectedBackground: WKColor.gray600, + editorButtonSelectedBackground: WKColor.gray600, editorKeyboardShadow: WKColor.gray800 ) @@ -172,7 +172,7 @@ public struct WKTheme: Equatable { editorMatchBackground: WKColor.darkMatchBackground, editorSelectedMatchBackground: WKColor.yellow600, editorReplacedMatchBackground: WKColor.matchReplacedBackground, - editorMultiButtonSelectedBackground: WKColor.gray600, + editorButtonSelectedBackground: WKColor.gray600, editorKeyboardShadow: WKColor.gray700 ) From 7ad06f65ecfb0dcea8d8641eb15dd96434f01776 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Tue, 30 Jan 2024 20:09:32 -0600 Subject: [PATCH 5/8] Make separators more uniform --- .../separator.imageset/separator.pdf | Bin 3857 -> 4382 bytes .../Base/WKEditorToolbarView.swift | 19 ++- .../WKEditorToolbarExpandingView.swift | 1 + .../WKEditorToolbarExpandingView.xib | 134 ++++++++++-------- .../WKEditorToolbarHighlightView.xib | 32 +++-- .../Extensions/UIImage+Extensions.swift | 21 +++ .../Sources/Components/Style/WKTheme.swift | 5 + WMF Framework/Theme.swift | 32 ++--- ...ectionEditorNavigationItemController.swift | 9 +- 9 files changed, 155 insertions(+), 98 deletions(-) create mode 100644 Components/Sources/Components/Extensions/UIImage+Extensions.swift diff --git a/Components/Sources/Components/Assets.xcassets/separator.imageset/separator.pdf b/Components/Sources/Components/Assets.xcassets/separator.imageset/separator.pdf index 04d07b798e41b2ae44e87833b995f2edac9998b5..5270506042e3958a321fbf084ab4f9fff2767a7e 100644 GIT binary patch delta 477 zcmYk3&1xGl5Xa9In36+!YZ(e5HiY$PB&~Lf*{~m8$e|?Nlpd1wu(g%qkgSYWE^aP< zhT?mlp^sRtb7%)K3^QovH}n7X?)UpYN3VAr5bU=HHk-lp%Gu>+VH}K~+QsEHd@-(H z*$%jj1l)~_&FXOpBq|l(P2kg}b^aNys=BnDH(P%O`Fd@-T|2ZIjSA;3Vd{^h)DSC7UW&UR73?W`<$ky9x&<-ABFQXQvUmm2F*)u@VWhN#mt zPUfWQn(|sFMOw_OGDo3{iqt#{DAUGT5BwZowz^(Dhf|6{8S?{#lwrS%?%u+nS_4@I VtoK2Ntuyybauu_allf)M{sNsXe2xGB delta 7 OcmbQIG*NDYAU^;KvjRW> diff --git a/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift b/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift index 4e13220d12b..cbffa947fae 100644 --- a/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift +++ b/Components/Sources/Components/Components/Editors/Common Views/Base/WKEditorToolbarView.swift @@ -5,7 +5,8 @@ class WKEditorToolbarView: WKComponentView { // MARK: - Properties - @IBOutlet var separatorViews: [UIView] = [] + @IBOutlet var separatorImageViews: [UIImageView] = [] + @IBOutlet var separatorImageWidthConstraints: [NSLayoutConstraint] = [] @IBOutlet var buttons: [WKEditorToolbarButton] = [] // MARK: - Lifecycle @@ -13,6 +14,18 @@ class WKEditorToolbarView: WKComponentView { override func awakeFromNib() { super.awakeFromNib() accessibilityElements = buttons + + let width = (1.0 / UIScreen.main.scale) * 2 + for separatorImageView in self.separatorImageViews { + + let image = UIImage.roundedRectImage(with: .black, cornerRadius: 0, width: width, height: 32) + separatorImageView.image = image?.withRenderingMode(.alwaysTemplate) + } + + for separatorWidthConstraint in separatorImageWidthConstraints { + separatorWidthConstraint.constant = width + } + updateColors() maximumContentSizeCategory = .accessibilityMedium } @@ -37,5 +50,9 @@ class WKEditorToolbarView: WKComponentView { layer.shadowRadius = 10 layer.shadowOpacity = 1.0 layer.shadowColor = theme.editorKeyboardShadow.cgColor + + for separatorImageView in separatorImageViews { + separatorImageView.tintColor = theme.newBorder + } } } 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 b4ebce3079d..3fd2b468154 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 @@ -73,6 +73,7 @@ class WKEditorToolbarExpandingView: WKEditorToolbarView { override func awakeFromNib() { super.awakeFromNib() + stackView.isLayoutMarginsRelativeArrangement = true stackView.layoutMargins = UIEdgeInsets(top: 5, left: 0, bottom: 5, right: 0) 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 4b9c61e75cc..c71e2b9ec9b 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 @@ - + - + @@ -13,57 +13,61 @@ - + - + - + - + - + - + - + - - + + - - - - - - + + + + + + + + - - + + - - + + - - + + - - - - - - + + + + + + + + @@ -77,49 +81,53 @@ - + - + - - + + - - + + - - - - - - + + + + + + + + - - + + - - - - - - + + + + + + + + - - + + - - + + - - + + @@ -186,7 +194,7 @@ - + @@ -286,10 +294,6 @@ - - - - @@ -304,8 +308,16 @@ + + + + + + + + - + 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 37ecb6e927b..c81e01bf161 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 @@ - + - + @@ -32,10 +32,12 @@ - - - - + + + + + + @@ -44,10 +46,12 @@ - - - - + + + + + + @@ -96,20 +100,20 @@ - - - - + + + + diff --git a/Components/Sources/Components/Extensions/UIImage+Extensions.swift b/Components/Sources/Components/Extensions/UIImage+Extensions.swift new file mode 100644 index 00000000000..9eac7bb6562 --- /dev/null +++ b/Components/Sources/Components/Extensions/UIImage+Extensions.swift @@ -0,0 +1,21 @@ +import Foundation +import UIKit + +public extension UIImage { + public static func roundedRectImage(with color: UIColor, cornerRadius: CGFloat, width: CGFloat? = nil, height: CGFloat? = nil) -> UIImage? { + let minDimension = 2 * cornerRadius + 1 + let rect = CGRect(x: 0, y: 0, width: width ?? minDimension, height: height ?? minDimension) + let scale = UIScreen.main.scale + UIGraphicsBeginImageContextWithOptions(rect.size, false, scale) + guard let context = UIGraphicsGetCurrentContext() else { + return nil + } + context.setFillColor(color.cgColor) + let path = UIBezierPath(roundedRect: rect, cornerRadius: cornerRadius) + path.fill() + let capInsets = UIEdgeInsets(top: cornerRadius, left: cornerRadius, bottom: cornerRadius, right: cornerRadius) + let image = UIGraphicsGetImageFromCurrentImageContext()?.resizableImage(withCapInsets: capInsets) + UIGraphicsEndImageContext() + return image + } +} diff --git a/Components/Sources/Components/Style/WKTheme.swift b/Components/Sources/Components/Style/WKTheme.swift index aec529ec3d1..63ae01ce1a5 100644 --- a/Components/Sources/Components/Style/WKTheme.swift +++ b/Components/Sources/Components/Style/WKTheme.swift @@ -13,6 +13,7 @@ public struct WKTheme: Equatable { public let accent: UIColor public let destructive: UIColor public let border: UIColor + public let newBorder: UIColor public let paperBackground: UIColor public let midBackground: UIColor public let baseBackground: UIColor @@ -47,6 +48,7 @@ public struct WKTheme: Equatable { accent: WKColor.green600, destructive: WKColor.red600, border: WKColor.gray400, + newBorder: WKColor.gray300, paperBackground: WKColor.white, midBackground: WKColor.gray100, baseBackground: WKColor.gray200, @@ -82,6 +84,7 @@ public struct WKTheme: Equatable { accent: WKColor.green600, destructive: WKColor.red700, border: WKColor.taupe200, + newBorder: WKColor.taupe200, paperBackground: WKColor.beige100, midBackground: WKColor.beige300, baseBackground: WKColor.beige400, @@ -117,6 +120,7 @@ public struct WKTheme: Equatable { accent: WKColor.green600, destructive: WKColor.red600, border: WKColor.gray650, + newBorder: WKColor.gray500, paperBackground: WKColor.gray675, midBackground: WKColor.gray700, baseBackground: WKColor.gray800, @@ -152,6 +156,7 @@ public struct WKTheme: Equatable { accent: WKColor.green600, destructive: WKColor.red600, border: WKColor.gray675, + newBorder: WKColor.gray500, paperBackground: WKColor.black, midBackground: WKColor.gray700, baseBackground: WKColor.gray800, diff --git a/WMF Framework/Theme.swift b/WMF Framework/Theme.swift index 80fcc6e476c..3721f578c9b 100644 --- a/WMF Framework/Theme.swift +++ b/WMF Framework/Theme.swift @@ -400,6 +400,19 @@ public class Colors: NSObject { return .gray675 } } + + public var newBorder: UIColor { + switch identifier { + case .light, .widgetLight: + return .gray300 + case .sepia: + return .taupe200 + case .dark, .widgetDark: + return .gray500 + case .black: + return .gray500 + } + } @objc public var shadow: UIColor { switch identifier { @@ -875,25 +888,8 @@ public class Theme: NSObject { public static let exploreCardCornerRadius: CGFloat = 10 - static func roundedRectImage(with color: UIColor, cornerRadius: CGFloat, width: CGFloat? = nil, height: CGFloat? = nil) -> UIImage? { - let minDimension = 2 * cornerRadius + 1 - let rect = CGRect(x: 0, y: 0, width: width ?? minDimension, height: height ?? minDimension) - let scale = UIScreen.main.scale - UIGraphicsBeginImageContextWithOptions(rect.size, false, scale) - guard let context = UIGraphicsGetCurrentContext() else { - return nil - } - context.setFillColor(color.cgColor) - let path = UIBezierPath(roundedRect: rect, cornerRadius: cornerRadius) - path.fill() - let capInsets = UIEdgeInsets(top: cornerRadius, left: cornerRadius, bottom: cornerRadius, right: cornerRadius) - let image = UIGraphicsGetImageFromCurrentImageContext()?.resizableImage(withCapInsets: capInsets) - UIGraphicsEndImageContext() - return image - } - @objc public lazy var searchFieldBackgroundImage: UIImage? = { - return Theme.roundedRectImage(with: colors.searchFieldBackground, cornerRadius: 10, height: 36) + return UIImage.roundedRectImage(with: colors.searchFieldBackground, cornerRadius: 10, height: 36) }() @objc public lazy var navigationBarTitleTextAttributes: [NSAttributedString.Key: Any] = { diff --git a/Wikipedia/Code/SectionEditorNavigationItemController.swift b/Wikipedia/Code/SectionEditorNavigationItemController.swift index bdc828bedd5..4aca85c08b4 100644 --- a/Wikipedia/Code/SectionEditorNavigationItemController.swift +++ b/Wikipedia/Code/SectionEditorNavigationItemController.swift @@ -29,7 +29,7 @@ class SectionEditorNavigationItemController: NSObject, Themeable { redoButton.tintColor = theme.colors.inputAccessoryButtonTint readingThemesControlsButton.tintColor = theme.colors.inputAccessoryButtonTint editNoticesButton.tintColor = theme.colors.inputAccessoryButtonTint - separatorButton.tintColor = theme.colors.chromeText + (separatorButton.customView as? UIImageView)?.tintColor = theme.colors.newBorder progressButton.tintColor = theme.colors.link } @@ -71,11 +71,12 @@ class SectionEditorNavigationItemController: NSObject, Themeable { }() private lazy var separatorButton: UIBarButtonItem = { - let button = UIButton(type: .system) - button.setImage(WKIcon.separator, for: .normal) + let width = (1.0 / UIScreen.main.scale) * 2 + let image = UIImage.roundedRectImage(with: .black, cornerRadius: 0, width: width, height: 32)?.withRenderingMode(.alwaysTemplate) + let button = UIBarButtonItem(customView: UIImageView(image: image)) button.isEnabled = false button.isAccessibilityElement = false - return UIBarButtonItem(customView: button) + return button }() @objc private func progress(_ sender: UIBarButtonItem) { From d180839bd877439a324fa642c696bd1d5881f406 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Tue, 30 Jan 2024 20:11:08 -0600 Subject: [PATCH 6/8] Delete unused code --- .../separator.imageset/Contents.json | 15 -------- .../separator.imageset/separator.pdf | Bin 4382 -> 0 bytes .../Common Views/WKToolbarSeparatorView.swift | 33 ------------------ .../Sources/Components/Style/WKIcon.swift | 3 -- 4 files changed, 51 deletions(-) delete mode 100644 Components/Sources/Components/Assets.xcassets/separator.imageset/Contents.json delete mode 100644 Components/Sources/Components/Assets.xcassets/separator.imageset/separator.pdf delete mode 100644 Components/Sources/Components/Components/Editors/Common Views/WKToolbarSeparatorView.swift diff --git a/Components/Sources/Components/Assets.xcassets/separator.imageset/Contents.json b/Components/Sources/Components/Assets.xcassets/separator.imageset/Contents.json deleted file mode 100644 index 68b1578a788..00000000000 --- a/Components/Sources/Components/Assets.xcassets/separator.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "separator.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "template-rendering-intent" : "template" - } -} diff --git a/Components/Sources/Components/Assets.xcassets/separator.imageset/separator.pdf b/Components/Sources/Components/Assets.xcassets/separator.imageset/separator.pdf deleted file mode 100644 index 5270506042e3958a321fbf084ab4f9fff2767a7e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4382 zcmai22{=^k`?gGB2$jfEon$S>na!B8&R7y$($ zGs%_;i6L7OS(E=6rRD0o{=ak0HRqk@JoB9UeV+Twb>AatsHrWFM4;i4^^DJq@tm3K zFX|iN7ytxlWGA??GN7POb+h+!0I*QV7*No5bn&8kKxY?{7gdu=q1jRaRaLmBmj{*P z3io4`|5p!QtIiWVP?@u!0KTr*C3hElp0FEWtq;2%*0p?ISSI8XL*xFvBBPRx4O(U4 z13M=acHZUm%`To9etDKKZuajMYh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Q1SSJGp KiB Date: Wed, 31 Jan 2024 07:41:28 -0600 Subject: [PATCH 7/8] Fix bug where subheading1 was larger than heading on larger text sizes --- Components/Sources/Components/Style/WKFont.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Components/Sources/Components/Style/WKFont.swift b/Components/Sources/Components/Style/WKFont.swift index 8286dd8aa78..36bc71da65a 100644 --- a/Components/Sources/Components/Style/WKFont.swift +++ b/Components/Sources/Components/Style/WKFont.swift @@ -81,7 +81,7 @@ public enum WKFont { } return UIFont(descriptor: descriptor, size: 0) case .editorHeading: - return UIFontMetrics(forTextStyle: .headline).scaledFont(for: UIFont.systemFont(ofSize: 28, weight: .semibold), maximumPointSize: 32, compatibleWith: traitCollection) + return UIFontMetrics(forTextStyle: .headline).scaledFont(for: UIFont.systemFont(ofSize: 28, weight: .semibold), compatibleWith: traitCollection) case .editorSubheading1: return UIFontMetrics(forTextStyle: .headline).scaledFont(for: UIFont.systemFont(ofSize: 26, weight: .semibold), compatibleWith: traitCollection) case .editorSubheading2: From e8584575c557feb1e0c19f15f3c1dd3940465f69 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Thu, 1 Feb 2024 13:52:15 -0600 Subject: [PATCH 8/8] PR feedback, strings changes from building --- .../Extensions/UIImage+Extensions.swift | 2 +- .../en.lproj/Localizable.strings | Bin 446938 -> 446748 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Components/Sources/Components/Extensions/UIImage+Extensions.swift b/Components/Sources/Components/Extensions/UIImage+Extensions.swift index 9eac7bb6562..6edd0a8f81b 100644 --- a/Components/Sources/Components/Extensions/UIImage+Extensions.swift +++ b/Components/Sources/Components/Extensions/UIImage+Extensions.swift @@ -2,7 +2,7 @@ import Foundation import UIKit public extension UIImage { - public static func roundedRectImage(with color: UIColor, cornerRadius: CGFloat, width: CGFloat? = nil, height: CGFloat? = nil) -> UIImage? { + static func roundedRectImage(with color: UIColor, cornerRadius: CGFloat, width: CGFloat? = nil, height: CGFloat? = nil) -> UIImage? { let minDimension = 2 * cornerRadius + 1 let rect = CGRect(x: 0, y: 0, width: width ?? minDimension, height: height ?? minDimension) let scale = UIScreen.main.scale diff --git a/Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings b/Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings index 664de8cd62094ef6800fc27025852c8b1b3ef260..ab5f9613a912d8edd8085d44870700d0becd8f74 100644 GIT binary patch delta 36 ucmV+<0NelCqZ^!}8-RoXgaU*Ev;@HOmu~a~8j~cH5QnJr1h=U41v1?x{19&d delta 66 zcmV-I0KNa5q8r+y8-RoXgaU*Ev;@HOm-y@iOa%%6AOIkf(XBg|p7R7emxhc44wtYp Y1q7Gs`T+`)Fq8y`>hlD*>hlFM-I!z?YXATM