From 4e8de59b82b050fca0aa467e8b22dae22b319515 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sat, 21 Nov 2020 17:16:21 +0800 Subject: [PATCH] Tweaks design of the smart feeds summary widget --- NetNewsWire.xcodeproj/project.pbxproj | 2 +- Widget/Resources/Localized.swift | 16 +++++---- Widget/Resources/en.lproj/Localizable.strings | 8 +++-- .../Widget Views/SmartFeedSummaryWidget.swift | 35 +++++++++++++------ Widget/WidgetBundle.swift | 2 +- 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 61e6c5814..504100318 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -4201,7 +4201,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#swiftgen run strings -t structured-swift5 \"$PROJECT_DIR/Widget/Resources/en.lproj/Localizable.strings\" \"$PROJECT_DIR/Widget/Resources/Localizable.stringsdict\" --output \"$PROJECT_DIR/Widget/Resources/Localized.swift\";\n"; + shellScript = "swiftgen run strings -t structured-swift5 \"$PROJECT_DIR/Widget/Resources/en.lproj/Localizable.strings\" \"$PROJECT_DIR/Widget/Resources/Localizable.stringsdict\" --output \"$PROJECT_DIR/Widget/Resources/Localized.swift\";\n"; }; 515D50802326D02600EE1167 /* Run Script: Verify No Build Settings */ = { isa = PBXShellScriptBuildPhase; diff --git a/Widget/Resources/Localized.swift b/Widget/Resources/Localized.swift index 8ba5f1045..5124e6ab9 100644 --- a/Widget/Resources/Localized.swift +++ b/Widget/Resources/Localized.swift @@ -10,13 +10,13 @@ import Foundation // swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces internal enum L10n { - /// Smartfeeds - internal static let smartfeedTitle = L10n.tr("Localizable", "Smartfeed_Title") - /// A count of your smart feeds. + /// Your smart feeds, summarized. internal static let smartFeedSummaryWidgetDescription = L10n.tr("Localizable", "SmartFeedSummary_Widget_Description") /// Your Smart Feed Summary internal static let smartFeedSummaryWidgetTitle = L10n.tr("Localizable", "SmartFeedSummary_Widget_Title") - /// A sneak peak at your starred articles. + /// Starred + internal static let starred = L10n.tr("Localizable", "Starred") + /// A sneak peek at your starred articles. internal static let starredWidgetDescription = L10n.tr("Localizable", "Starred_Widget_Description") /// You've not starred any artices. internal static let starredWidgetNoItems = L10n.tr("Localizable", "Starred_Widget_NoItems") @@ -26,7 +26,9 @@ internal enum L10n { internal static func starredCount(_ p1: Int) -> String { return L10n.tr("Localizable", "StarredCount", p1) } - /// A sneak peak at recently published unread articles. + /// Today + internal static let today = L10n.tr("Localizable", "Today") + /// A sneak peek at recently published unread articles. internal static let todayWidgetDescription = L10n.tr("Localizable", "Today_Widget_Description") /// There are no recent articles to read. internal static let todayWidgetNoItems = L10n.tr("Localizable", "Today_Widget_NoItems") @@ -36,7 +38,9 @@ internal enum L10n { internal static func todayCount(_ p1: Int) -> String { return L10n.tr("Localizable", "TodayCount", p1) } - /// A sneak peak at your unread articles. + /// Unread + internal static let unread = L10n.tr("Localizable", "Unread") + /// A sneak peek at your unread articles. internal static let unreadWidgetDescription = L10n.tr("Localizable", "Unread_Widget_Description") /// There's nothing to read right now. internal static let unreadWidgetNoItems = L10n.tr("Localizable", "Unread_Widget_NoItems") diff --git a/Widget/Resources/en.lproj/Localizable.strings b/Widget/Resources/en.lproj/Localizable.strings index 8e9f4c6db..ca6a31ae4 100644 --- a/Widget/Resources/en.lproj/Localizable.strings +++ b/Widget/Resources/en.lproj/Localizable.strings @@ -17,7 +17,7 @@ "Starred_Widget_Description" = "A sneak peek at your starred articles."; "SmartFeedSummary_Widget_Title" = "Your Smart Feed Summary"; -"SmartFeedSummary_Widget_Description" = "A count of your smart feeds."; +"SmartFeedSummary_Widget_Description" = "Your smart feeds, summarized."; /* Unread Widget */ "Unread_Widget_NoItems" = "There's nothing to read right now."; @@ -28,5 +28,7 @@ /* Starred Widget */ "Starred_Widget_NoItems" = "You've not starred any artices."; -/* Smart Feed Summary */ -"Smartfeed_Title" = "Smart Feeds"; +/* Smart Feed Summary Widget */ +"Unread" = "Unread"; +"Today" = "Today"; +"Starred" = "Starred"; diff --git a/Widget/Widget Views/SmartFeedSummaryWidget.swift b/Widget/Widget Views/SmartFeedSummaryWidget.swift index abe74a74e..a59391e87 100644 --- a/Widget/Widget Views/SmartFeedSummaryWidget.swift +++ b/Widget/Widget Views/SmartFeedSummaryWidget.swift @@ -32,10 +32,14 @@ struct SmartFeedSummaryWidgetView: View { @ViewBuilder var smallWidget: some View { VStack(alignment: .leading) { + Spacer() Link(destination: WidgetDeepLink.today.url, label: { HStack { todayImage - Text(formattedCount(entry.widgetData.currentTodayCount) + " Today").font(.caption) + VStack(alignment: .leading, spacing: nil, content: { + Text(formattedCount(entry.widgetData.currentTodayCount)).font(Font.system(.caption, design: .rounded)).bold() + Text(L10n.today).bold().font(.caption).textCase(.uppercase) + }).foregroundColor(.white) Spacer() } }) @@ -43,7 +47,10 @@ struct SmartFeedSummaryWidgetView: View { Link(destination: WidgetDeepLink.unread.url, label: { HStack { unreadImage - Text(formattedCount(entry.widgetData.currentUnreadCount) + " Unread").font(.caption) + VStack(alignment: .leading, spacing: nil, content: { + Text(formattedCount(entry.widgetData.currentUnreadCount)).font(Font.system(.caption, design: .rounded)).bold() + Text(L10n.unread).bold().font(.caption).textCase(.uppercase) + }).foregroundColor(.white) Spacer() } }) @@ -51,16 +58,14 @@ struct SmartFeedSummaryWidgetView: View { Link(destination: WidgetDeepLink.starred.url, label: { HStack { starredImage - Text(formattedCount(entry.widgetData.currentStarredCount) + " Starred").font(.caption) + VStack(alignment: .leading, spacing: nil, content: { + Text(formattedCount(entry.widgetData.currentStarredCount)).font(Font.system(.caption, design: .rounded)).bold() + Text(L10n.starred).bold().font(.caption).textCase(.uppercase) + }).foregroundColor(.white) Spacer() } }) Spacer() - HStack { - Spacer() - Text(L10n.smartfeedTitle).bold().textCase(.uppercase).font(.caption2) - Spacer() - } }.padding() } @@ -75,7 +80,7 @@ struct SmartFeedSummaryWidgetView: View { Image(systemName: "largecircle.fill.circle") .resizable() .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.accentColor) + .foregroundColor(.white) } var nnwImage: some View { @@ -89,14 +94,22 @@ struct SmartFeedSummaryWidgetView: View { Image(systemName: "star.fill") .resizable() .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.yellow) + .foregroundColor(.white) } var todayImage: some View { Image(systemName: "sun.max.fill") .resizable() .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.orange) + .foregroundColor(.white) } } + + +struct SmartFeedSummaryWidgetView_Previews: PreviewProvider { + + static var previews: some View { + SmartFeedSummaryWidgetView(entry: Provider.Entry.init(date: Date(), widgetData: WidgetDataDecoder.sampleData())) + } +} diff --git a/Widget/WidgetBundle.swift b/Widget/WidgetBundle.swift index 7e88a65d5..84f531f18 100644 --- a/Widget/WidgetBundle.swift +++ b/Widget/WidgetBundle.swift @@ -73,7 +73,7 @@ struct SmartFeedSummaryWidget: Widget { return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in SmartFeedSummaryWidgetView(entry: entry) .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color("WidgetBackground")) + .background(Color("AccentColor")) }) .configurationDisplayName(L10n.smartFeedSummaryWidgetTitle)