diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index accdf4bbb..d1f3b4bb7 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -33,7 +33,6 @@ 176814362564BCC000D98635 /* UnreadWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176814352564BCC000D98635 /* UnreadWidget.swift */; }; 1768143E2564BCC800D98635 /* TodayWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768143D2564BCC800D98635 /* TodayWidget.swift */; }; 176814462564BCD200D98635 /* StarredWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176814452564BCD200D98635 /* StarredWidget.swift */; }; - 1768144E2564BCE000D98635 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; }; 176814572564BD0600D98635 /* ArticleItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176814562564BD0600D98635 /* ArticleItemView.swift */; }; 1768145E2564BD7B00D98635 /* WidgetDataDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176813C92564BA5400D98635 /* WidgetDataDecoder.swift */; }; 176814652564BD7F00D98635 /* WidgetData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176813B62564B9F800D98635 /* WidgetData.swift */; }; @@ -663,7 +662,6 @@ 176814352564BCC000D98635 /* UnreadWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnreadWidget.swift; sourceTree = ""; }; 1768143D2564BCC800D98635 /* TodayWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayWidget.swift; sourceTree = ""; }; 176814452564BCD200D98635 /* StarredWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarredWidget.swift; sourceTree = ""; }; - 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartFeedSummaryWidget.swift; sourceTree = ""; }; 176814562564BD0600D98635 /* ArticleItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleItemView.swift; sourceTree = ""; }; 1768147A2564BE5400D98635 /* widget-sample.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "widget-sample.json"; sourceTree = ""; }; 176814822564C02A00D98635 /* NetNewsWire_iOS_WidgetExtension.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = NetNewsWire_iOS_WidgetExtension.entitlements; sourceTree = ""; }; @@ -1137,7 +1135,6 @@ 176814352564BCC000D98635 /* UnreadWidget.swift */, 1768143D2564BCC800D98635 /* TodayWidget.swift */, 176814452564BCD200D98635 /* StarredWidget.swift */, - 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */, 8448F1E12D1E2DA30048BA50 /* WidgetLayout.swift */, ); path = "Widget Views"; @@ -2570,7 +2567,6 @@ 17E0084625941887000C23F0 /* SizeCategories.swift in Sources */, 176814462564BCD200D98635 /* StarredWidget.swift in Sources */, 176814572564BD0600D98635 /* ArticleItemView.swift in Sources */, - 1768144E2564BCE000D98635 /* SmartFeedSummaryWidget.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Widget/Widget Views/SmartFeedSummaryWidget.swift b/Widget/Widget Views/SmartFeedSummaryWidget.swift deleted file mode 100644 index efa4fb756..000000000 --- a/Widget/Widget Views/SmartFeedSummaryWidget.swift +++ /dev/null @@ -1,107 +0,0 @@ -// -// SmartFeedSummaryWidget.swift -// NetNewsWire Widget Extension -// -// Created by Stuart Breckenridge on 18/11/20. -// Copyright © 2020 Ranchero Software. All rights reserved. -// - -import WidgetKit -import SwiftUI - - -struct SmartFeedSummaryWidgetView: View { - - @Environment(\.widgetFamily) var family: WidgetFamily - - var entry: Provider.Entry - - var body: some View { - smallWidget - .widgetURL(WidgetDeepLink.icon.url) - } - - @ViewBuilder - var smallWidget: some View { - VStack(alignment: .leading) { - Spacer() - Link(destination: WidgetDeepLink.today.url, label: { - HStack { - todayImage - 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() - } - }) - - Link(destination: WidgetDeepLink.unread.url, label: { - HStack { - unreadImage - 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() - } - }) - - Link(destination: WidgetDeepLink.starred.url, label: { - HStack { - starredImage - 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() - }.padding() - } - - func formattedCount(_ count: Int) -> String { - let formatter = NumberFormatter() - formatter.locale = Locale.current - formatter.numberStyle = .decimal - return formatter.string(from: NSNumber(value: count))! - } - - var unreadImage: some View { - Image(systemName: "largecircle.fill.circle") - .resizable() - .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.white) - } - - var nnwImage: some View { - Image("CornerIcon") - .resizable() - .frame(width: 20, height: 20, alignment: .center) - .cornerRadius(4) - } - - var starredImage: some View { - Image(systemName: "star.fill") - .resizable() - .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.white) - } - - var todayImage: some View { - Image(systemName: "sun.max.fill") - .resizable() - .frame(width: 20, height: 20, alignment: .center) - .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 7bfcba0c4..4e17b9cd7 100644 --- a/Widget/WidgetBundle.swift +++ b/Widget/WidgetBundle.swift @@ -65,25 +65,6 @@ struct StarredWidget: Widget { } } -struct SmartFeedSummaryWidget: Widget { - let kind: String = "com.ranchero.NetNewsWire.SmartFeedSummaryWidget" - - var body: some WidgetConfiguration { - - return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in - SmartFeedSummaryWidgetView(entry: entry) - .frame(maxWidth: .infinity, maxHeight: .infinity) - .containerBackground(for: .widget) { - Color.clear - } - }) - .configurationDisplayName(L10n.smartFeedSummaryWidgetTitle) - .description(L10n.smartFeedSummaryWidgetDescription) - .supportedFamilies([.systemSmall]) - } -} - - // MARK: - WidgetBundle @main struct NetNewsWireWidgets: WidgetBundle {