Merge pull request #2769 from stuartbreckenridge/2737
Text position on widgets
This commit is contained in:
commit
55a9004a81
|
@ -134,6 +134,8 @@
|
||||||
17D5F19524B0C1DD00375168 /* SidebarToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */; };
|
17D5F19524B0C1DD00375168 /* SidebarToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */; };
|
||||||
17E0084625941887000C23F0 /* SizeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0084525941887000C23F0 /* SizeCategories.swift */; };
|
17E0084625941887000C23F0 /* SizeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0084525941887000C23F0 /* SizeCategories.swift */; };
|
||||||
17E4DBD624BFC53E00FE462A /* AdvancedPreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E4DBD524BFC53E00FE462A /* AdvancedPreferencesModel.swift */; };
|
17E4DBD624BFC53E00FE462A /* AdvancedPreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E4DBD524BFC53E00FE462A /* AdvancedPreferencesModel.swift */; };
|
||||||
|
17EF6A2125C4E5B4002C9F81 /* RSWeb in Frameworks */ = {isa = PBXBuildFile; productRef = 17EF6A2025C4E5B4002C9F81 /* RSWeb */; };
|
||||||
|
17EF6A2225C4E5B4002C9F81 /* RSWeb in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17EF6A2025C4E5B4002C9F81 /* RSWeb */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||||
27B86EEB25A53AAB00264340 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; };
|
27B86EEB25A53AAB00264340 /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; };
|
||||||
27B86EEC25A53AAB00264340 /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0080E25936DF6000C23F0 /* Articles */; };
|
27B86EEC25A53AAB00264340 /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0080E25936DF6000C23F0 /* Articles */; };
|
||||||
27B86EED25A53AAB00264340 /* ArticlesDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081125936DF6000C23F0 /* ArticlesDatabase */; };
|
27B86EED25A53AAB00264340 /* ArticlesDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081125936DF6000C23F0 /* ArticlesDatabase */; };
|
||||||
|
@ -1232,6 +1234,17 @@
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
17EF6A1725C4E59D002C9F81 /* Embed Frameworks */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = "";
|
||||||
|
dstSubfolderSpec = 10;
|
||||||
|
files = (
|
||||||
|
17EF6A2225C4E5B4002C9F81 /* RSWeb in Embed Frameworks */,
|
||||||
|
);
|
||||||
|
name = "Embed Frameworks";
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
5102AE7324D17FAA0050839C /* Embed Frameworks */ = {
|
5102AE7324D17FAA0050839C /* Embed Frameworks */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
|
@ -2045,6 +2058,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
17EF6A2125C4E5B4002C9F81 /* RSWeb in Frameworks */,
|
||||||
176813F72564BB2C00D98635 /* SwiftUI.framework in Frameworks */,
|
176813F72564BB2C00D98635 /* SwiftUI.framework in Frameworks */,
|
||||||
176813F52564BB2C00D98635 /* WidgetKit.framework in Frameworks */,
|
176813F52564BB2C00D98635 /* WidgetKit.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
|
@ -3705,12 +3719,16 @@
|
||||||
176813F02564BB2C00D98635 /* Frameworks */,
|
176813F02564BB2C00D98635 /* Frameworks */,
|
||||||
176813F12564BB2C00D98635 /* Resources */,
|
176813F12564BB2C00D98635 /* Resources */,
|
||||||
1701E1BF25689B44009453D8 /* SwiftGen Localization */,
|
1701E1BF25689B44009453D8 /* SwiftGen Localization */,
|
||||||
|
17EF6A1725C4E59D002C9F81 /* Embed Frameworks */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = "NetNewsWire iOS Widget Extension";
|
name = "NetNewsWire iOS Widget Extension";
|
||||||
|
packageProductDependencies = (
|
||||||
|
17EF6A2025C4E5B4002C9F81 /* RSWeb */,
|
||||||
|
);
|
||||||
productName = "NetNewsWire WidgetExtension";
|
productName = "NetNewsWire WidgetExtension";
|
||||||
productReference = 176813F32564BB2C00D98635 /* NetNewsWire iOS Widget Extension.appex */;
|
productReference = 176813F32564BB2C00D98635 /* NetNewsWire iOS Widget Extension.appex */;
|
||||||
productType = "com.apple.product-type.app-extension";
|
productType = "com.apple.product-type.app-extension";
|
||||||
|
@ -6213,6 +6231,11 @@
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = SyncDatabase;
|
productName = SyncDatabase;
|
||||||
};
|
};
|
||||||
|
17EF6A2025C4E5B4002C9F81 /* RSWeb */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 51383A3024D1F90E0027E272 /* XCRemoteSwiftPackageReference "RSWeb" */;
|
||||||
|
productName = RSWeb;
|
||||||
|
};
|
||||||
5102AE6824D17F7C0050839C /* RSCore */ = {
|
5102AE6824D17F7C0050839C /* RSCore */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 5102AE4324D17E820050839C /* XCRemoteSwiftPackageReference "RSCore" */;
|
package = 5102AE4324D17E820050839C /* XCRemoteSwiftPackageReference "RSCore" */;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public final class WidgetDataEncoder {
|
||||||
for article in unreadArticles {
|
for article in unreadArticles {
|
||||||
let latestArticle = LatestArticle(id: article.sortableArticleID,
|
let latestArticle = LatestArticle(id: article.sortableArticleID,
|
||||||
feedTitle: article.sortableName,
|
feedTitle: article.sortableName,
|
||||||
articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? article.contentHTML?.strippingHTML().trimmingWhitespace : ArticleStringFormatter.truncatedTitle(article),
|
articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? ArticleStringFormatter.truncatedSummary(article) : ArticleStringFormatter.truncatedTitle(article),
|
||||||
articleSummary: article.summary,
|
articleSummary: article.summary,
|
||||||
feedIcon: article.iconImage()?.image.dataRepresentation(),
|
feedIcon: article.iconImage()?.image.dataRepresentation(),
|
||||||
pubDate: article.datePublished!.description)
|
pubDate: article.datePublished!.description)
|
||||||
|
@ -55,7 +55,7 @@ public final class WidgetDataEncoder {
|
||||||
for article in starredArticles {
|
for article in starredArticles {
|
||||||
let latestArticle = LatestArticle(id: article.sortableArticleID,
|
let latestArticle = LatestArticle(id: article.sortableArticleID,
|
||||||
feedTitle: article.sortableName,
|
feedTitle: article.sortableName,
|
||||||
articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? article.contentHTML?.strippingHTML().trimmingWhitespace : ArticleStringFormatter.truncatedTitle(article),
|
articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? ArticleStringFormatter.truncatedSummary(article) : ArticleStringFormatter.truncatedTitle(article),
|
||||||
articleSummary: article.summary,
|
articleSummary: article.summary,
|
||||||
feedIcon: article.iconImage()?.image.dataRepresentation(),
|
feedIcon: article.iconImage()?.image.dataRepresentation(),
|
||||||
pubDate: article.datePublished!.description)
|
pubDate: article.datePublished!.description)
|
||||||
|
@ -66,7 +66,7 @@ public final class WidgetDataEncoder {
|
||||||
for article in todayArticles {
|
for article in todayArticles {
|
||||||
let latestArticle = LatestArticle(id: article.sortableArticleID,
|
let latestArticle = LatestArticle(id: article.sortableArticleID,
|
||||||
feedTitle: article.sortableName,
|
feedTitle: article.sortableName,
|
||||||
articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? article.contentHTML?.strippingHTML().trimmingWhitespace : ArticleStringFormatter.truncatedTitle(article),
|
articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? ArticleStringFormatter.truncatedSummary(article) : ArticleStringFormatter.truncatedTitle(article),
|
||||||
articleSummary: article.summary,
|
articleSummary: article.summary,
|
||||||
feedIcon: article.iconImage()?.image.dataRepresentation(),
|
feedIcon: article.iconImage()?.image.dataRepresentation(),
|
||||||
pubDate: article.datePublished!.description)
|
pubDate: article.datePublished!.description)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import RSWeb
|
||||||
|
|
||||||
struct ArticleItemView: View {
|
struct ArticleItemView: View {
|
||||||
|
|
||||||
|
|
|
@ -23,34 +23,55 @@ struct StarredWidgetView : View {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GeometryReader { metrics in
|
GeometryReader { metrics in
|
||||||
HStack(alignment: .top, spacing: 4) {
|
HStack {
|
||||||
VStack(alignment: .leading, spacing: -4) {
|
VStack {
|
||||||
starredImage
|
starredImage
|
||||||
|
.padding(.vertical, 12)
|
||||||
|
.padding(.leading, 8)
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(L10n.localizedCount(entry.widgetData.currentStarredCount)).bold().font(.callout).minimumScaleFactor(0.5).lineLimit(1)
|
|
||||||
Text(L10n.starred.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1)
|
|
||||||
}
|
}
|
||||||
.frame(width: metrics.size.width * 0.15)
|
}
|
||||||
.padding(.trailing, 4)
|
.frame(width: metrics.size.width * 0.15)
|
||||||
|
|
||||||
VStack(alignment:.leading, spacing: 0) {
|
Spacer()
|
||||||
ForEach(0..<maxCount(), content: { i in
|
|
||||||
if i != 0 {
|
|
||||||
Divider()
|
|
||||||
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
|
||||||
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
|
||||||
.padding(.top, 8)
|
|
||||||
.padding(.bottom, 4)
|
|
||||||
} else {
|
|
||||||
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
|
||||||
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
|
||||||
.padding(.bottom, 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
VStack(alignment:.leading, spacing: 0) {
|
||||||
|
ForEach(0..<maxCount(), content: { i in
|
||||||
|
if i != 0 {
|
||||||
|
Divider()
|
||||||
|
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
||||||
|
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
||||||
|
.padding(.top, 8)
|
||||||
|
.padding(.bottom, 4)
|
||||||
|
} else {
|
||||||
|
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
||||||
|
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
||||||
|
.padding(.bottom, 4)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(.leading, metrics.size.width * 0.175)
|
||||||
|
.padding([.bottom, .trailing])
|
||||||
|
.padding(.top, 12)
|
||||||
|
.overlay(
|
||||||
|
VStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
}.padding(.leading, 4)
|
HStack {
|
||||||
}.padding()
|
Spacer()
|
||||||
|
if entry.widgetData.currentStarredCount - maxCount() > 0 {
|
||||||
|
Text(L10n.starredCount(entry.widgetData.currentStarredCount - maxCount()))
|
||||||
|
.font(.caption2)
|
||||||
|
.bold()
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
.padding(.bottom, 6)
|
||||||
|
)
|
||||||
|
|
||||||
}.widgetURL(WidgetDeepLink.starred.url)
|
}.widgetURL(WidgetDeepLink.starred.url)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,34 +23,55 @@ struct TodayWidgetView : View {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GeometryReader { metrics in
|
GeometryReader { metrics in
|
||||||
HStack(alignment: .top, spacing: 4) {
|
HStack {
|
||||||
VStack(alignment: .leading, spacing: -4) {
|
VStack {
|
||||||
todayImage
|
todayImage
|
||||||
|
.padding(.vertical, 12)
|
||||||
|
.padding(.leading, 8)
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(L10n.localizedCount(entry.widgetData.currentTodayCount)).bold().font(.callout).minimumScaleFactor(0.5).lineLimit(1)
|
|
||||||
Text(L10n.today.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1)
|
|
||||||
}
|
}
|
||||||
.frame(width: metrics.size.width * 0.15)
|
}
|
||||||
.padding(.trailing, 4)
|
.frame(width: metrics.size.width * 0.15)
|
||||||
|
|
||||||
VStack(alignment:.leading, spacing: 0) {
|
Spacer()
|
||||||
ForEach(0..<maxCount(), content: { i in
|
|
||||||
if i != 0 {
|
|
||||||
Divider()
|
|
||||||
ArticleItemView(article: entry.widgetData.todayArticles[i],
|
|
||||||
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
|
||||||
.padding(.top, 8)
|
|
||||||
.padding(.bottom, 4)
|
|
||||||
} else {
|
|
||||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
|
||||||
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
|
||||||
.padding(.bottom, 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
VStack(alignment:.leading, spacing: 0) {
|
||||||
|
ForEach(0..<maxCount(), content: { i in
|
||||||
|
if i != 0 {
|
||||||
|
Divider()
|
||||||
|
ArticleItemView(article: entry.widgetData.todayArticles[i],
|
||||||
|
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
||||||
|
.padding(.top, 8)
|
||||||
|
.padding(.bottom, 4)
|
||||||
|
} else {
|
||||||
|
ArticleItemView(article: entry.widgetData.todayArticles[i],
|
||||||
|
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
||||||
|
.padding(.bottom, 4)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(.leading, metrics.size.width * 0.175)
|
||||||
|
.padding([.bottom, .trailing])
|
||||||
|
.padding(.top, 12)
|
||||||
|
.overlay(
|
||||||
|
VStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
}.padding(.leading, 4)
|
HStack {
|
||||||
}.padding()
|
Spacer()
|
||||||
|
if entry.widgetData.currentTodayCount - maxCount() > 0 {
|
||||||
|
Text(L10n.todayCount(entry.widgetData.currentTodayCount - maxCount()))
|
||||||
|
.font(.caption2)
|
||||||
|
.bold()
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
.padding(.bottom, 6)
|
||||||
|
)
|
||||||
|
|
||||||
}.widgetURL(WidgetDeepLink.today.url)
|
}.widgetURL(WidgetDeepLink.today.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,43 +23,63 @@ struct UnreadWidgetView : View {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GeometryReader { metrics in
|
GeometryReader { metrics in
|
||||||
HStack(alignment: .top, spacing: 4) {
|
HStack {
|
||||||
VStack(alignment: .leading, spacing: -4) {
|
VStack {
|
||||||
unreadImage
|
unreadImage
|
||||||
|
.padding(.vertical, 12)
|
||||||
|
.padding(.leading, 8)
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(L10n.localizedCount(entry.widgetData.currentUnreadCount)).bold().font(.callout).minimumScaleFactor(0.5).lineLimit(1)
|
|
||||||
Text(L10n.unread.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1)
|
|
||||||
}
|
}
|
||||||
.frame(width: metrics.size.width * 0.15)
|
}
|
||||||
.padding(.trailing, 4)
|
.frame(width: metrics.size.width * 0.15)
|
||||||
|
|
||||||
VStack(alignment:.leading, spacing: 0) {
|
Spacer()
|
||||||
ForEach(0..<maxCount(), content: { i in
|
|
||||||
if i != 0 {
|
|
||||||
Divider()
|
|
||||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
|
||||||
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
|
||||||
.padding(.top, 8)
|
|
||||||
.padding(.bottom, 4)
|
|
||||||
} else {
|
|
||||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
|
||||||
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
|
||||||
.padding(.bottom, 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
VStack(alignment:.leading, spacing: 0) {
|
||||||
|
ForEach(0..<maxCount(), content: { i in
|
||||||
|
if i != 0 {
|
||||||
|
Divider()
|
||||||
|
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||||
|
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
||||||
|
.padding(.top, 8)
|
||||||
|
.padding(.bottom, 4)
|
||||||
|
} else {
|
||||||
|
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||||
|
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
||||||
|
.padding(.bottom, 4)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(.leading, metrics.size.width * 0.175)
|
||||||
|
.padding([.bottom, .trailing])
|
||||||
|
.padding(.top, 12)
|
||||||
|
.overlay(
|
||||||
|
VStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
}.padding(.leading, 4)
|
HStack {
|
||||||
}.padding()
|
Spacer()
|
||||||
}.widgetURL(WidgetDeepLink.unread.url)
|
if entry.widgetData.currentUnreadCount - maxCount() > 0 {
|
||||||
|
Text(L10n.unreadCount(entry.widgetData.currentUnreadCount - maxCount()))
|
||||||
|
.font(.caption2)
|
||||||
|
.bold()
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
.padding(.bottom, 6)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.widgetURL(WidgetDeepLink.unread.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var unreadImage: some View {
|
var unreadImage: some View {
|
||||||
Image(systemName: "largecircle.fill.circle")
|
Image(systemName: "largecircle.fill.circle")
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width: 30, height: 30, alignment: .center)
|
.frame(width: 30, height: 30, alignment: .top)
|
||||||
.cornerRadius(4)
|
|
||||||
.foregroundColor(.accentColor)
|
.foregroundColor(.accentColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue