Tweaks design of the smart feeds summary widget

This commit is contained in:
Stuart Breckenridge 2020-11-21 17:16:21 +08:00
parent df7cd6904a
commit 4e8de59b82
No known key found for this signature in database
GPG Key ID: 1F11FD62007DC331
5 changed files with 41 additions and 22 deletions

View File

@ -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;

View File

@ -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")

View File

@ -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";

View File

@ -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()))
}
}

View File

@ -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)