From ec0bef1f301c688c830b1af28f1d20b1a380cc33 Mon Sep 17 00:00:00 2001 From: Matt Bumgardner Date: Wed, 14 Nov 2018 09:23:28 -0600 Subject: [PATCH 1/2] Removed NukeMe struct --- .../Tools/StringFormatter/StringStyles.swift | 40 ++++++------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift b/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift index e888a91861d..4a1796feb30 100644 --- a/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift +++ b/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift @@ -64,7 +64,7 @@ extension StringStyles { let bold: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.bold] let blockquote: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics] let italics: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics] - let noticon: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.noticon(forStyle: .subheadline), .foregroundColor: NukeMe.subjectNoticonColor] + let noticon: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.noticon(forStyle: .subheadline), .foregroundColor: StyleManager.defaultTextColor] return StringStyles(regular: regular, bold: bold, blockquote: blockquote, italics: italics, match: nil, noticon: noticon) }() @@ -82,9 +82,9 @@ extension StringStyles { /// Styles: Notification Defailts / Header Block /// static let header: StringStyles = { - let regular: Style = [.font: UIFont.body, .foregroundColor: NukeMe.bodyTextColor] - let bold: Style = [.font: UIFont.body.bold, .foregroundColor: NukeMe.bodyTextColor] - let italics: Style = [.font: UIFont.body.italics, .foregroundColor: NukeMe.headerItalicsColor] + let regular: Style = [.font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor] + let bold: Style = [.font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor] + let italics: Style = [.font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor] return StringStyles(regular: regular, bold: bold, italics: italics) }() @@ -93,7 +93,7 @@ extension StringStyles { /// Styles: Notification Defailts / Footer Block /// static let footer: StringStyles = { - let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: NukeMe.footerTextColor] + let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor] return StringStyles(regular: regular, noticon: body.noticon) }() @@ -102,30 +102,14 @@ extension StringStyles { /// Styles: Notification Defailts / Body Blocks /// static let body: StringStyles = { - let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: NukeMe.bodyTextColor] - let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: NukeMe.bodyTextColor] - let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: NukeMe.bodyBlockquotedColor] - let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: NukeMe.bodyLinkColor] - let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: NukeMe.bodyNoticonColor] - let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: NukeMe.bodyTextColor] - let link: Style = [.foregroundColor: NukeMe.bodyLinkColor] + let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor] + let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor] + let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor] + let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor] + let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.defaultTextColor] + let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor] + let link: Style = [.foregroundColor: StyleManager.defaultTextColor] return StringStyles(regular: regular, bold: bold, blockquote: blockquote, match: match, noticon: noticon, link: link) }() } - - -// MARK: - TODO: Nuke this. Map the Colors, as required, from the StyleManager -// -private struct NukeMe { - static let subjectNoticonColor = UIColor.black - - static let headerItalicsColor = UIColor.gray - - static let bodyTextColor = UIColor.black - static let bodyBlockquotedColor = UIColor.black - static let bodyLinkColor = UIColor.black - static let bodyNoticonColor = UIColor.black - - static let footerTextColor = UIColor.black -} From 2254a3ec4443252242800a9440c37f94ca73b5a0 Mon Sep 17 00:00:00 2001 From: Matt Bumgardner Date: Thu, 15 Nov 2018 10:40:55 -0600 Subject: [PATCH 2/2] Design updates to notifications StringStyles --- .../Classes/Extensions/NSParagraphStyle+Woo.swift | 6 ++++++ .../Tools/StringFormatter/StringStyles.swift | 15 +++++++-------- .../Notifications/Cells/NoteTableViewCell.xib | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/WooCommerce/Classes/Extensions/NSParagraphStyle+Woo.swift b/WooCommerce/Classes/Extensions/NSParagraphStyle+Woo.swift index f1bf451ee32..dbd7b800992 100644 --- a/WooCommerce/Classes/Extensions/NSParagraphStyle+Woo.swift +++ b/WooCommerce/Classes/Extensions/NSParagraphStyle+Woo.swift @@ -18,6 +18,12 @@ extension NSParagraphStyle { return NSMutableParagraphStyle(standardLineHeightUsingFont: UIFont.body) } + /// Returns a ParagraphStyle with it's minimum Line Height set to accomodate `UIFont.footnote` + /// + static var footnote: NSParagraphStyle { + return NSMutableParagraphStyle(standardLineHeightUsingFont: UIFont.footnote) + } + /// Returns a ParagraphStyle with it's minimum Line Height set to accomodate `UIFont.body` / Centered /// static var badge: NSParagraphStyle { diff --git a/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift b/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift index 4a1796feb30..1f025a6479d 100644 --- a/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift +++ b/WooCommerce/Classes/Tools/StringFormatter/StringStyles.swift @@ -60,11 +60,11 @@ extension StringStyles { /// Styles: Notifications List / Subject Block /// static let subject: StringStyles = { - let regular: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline, .foregroundColor: StyleManager.defaultTextColor] - let bold: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.bold] - let blockquote: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics] - let italics: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.subheadline.italics] - let noticon: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.noticon(forStyle: .subheadline), .foregroundColor: StyleManager.defaultTextColor] + let regular: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body, .foregroundColor: StyleManager.defaultTextColor] + let bold: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold] + let blockquote: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics] + let italics: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics] + let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.wooGreyMid] return StringStyles(regular: regular, bold: bold, blockquote: blockquote, italics: italics, match: nil, noticon: noticon) }() @@ -73,8 +73,7 @@ extension StringStyles { /// Styles: Notifications List / Snippet Block /// static let snippet: StringStyles = { - let regular: Style = [.paragraphStyle: NSParagraphStyle.subheadline, .font: UIFont.footnote, .foregroundColor: StyleManager.defaultTextColor] - + let regular: Style = [.paragraphStyle: NSParagraphStyle.footnote, .font: UIFont.footnote, .foregroundColor: StyleManager.defaultTextColor] return StringStyles(regular: regular) }() @@ -108,7 +107,7 @@ extension StringStyles { let match: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.bold, .foregroundColor: StyleManager.defaultTextColor] let noticon: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.noticon(forStyle: .body), .foregroundColor: StyleManager.defaultTextColor] let italic: Style = [.paragraphStyle: NSParagraphStyle.body, .font: UIFont.body.italics, .foregroundColor: StyleManager.defaultTextColor] - let link: Style = [.foregroundColor: StyleManager.defaultTextColor] + let link: Style = [.foregroundColor: StyleManager.wooCommerceBrandColor] return StringStyles(regular: regular, bold: bold, blockquote: blockquote, match: match, noticon: noticon, link: link) }() diff --git a/WooCommerce/Classes/ViewRelated/Notifications/Cells/NoteTableViewCell.xib b/WooCommerce/Classes/ViewRelated/Notifications/Cells/NoteTableViewCell.xib index 50166890bc6..ba08a9216c6 100644 --- a/WooCommerce/Classes/ViewRelated/Notifications/Cells/NoteTableViewCell.xib +++ b/WooCommerce/Classes/ViewRelated/Notifications/Cells/NoteTableViewCell.xib @@ -27,8 +27,8 @@ - - + +