diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 0d8021c58..efdd3fa05 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -132,27 +132,7 @@ 17D5F17124B0BC6700375168 /* SidebarToolbarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */; }; 17D5F17224B0BC6700375168 /* SidebarToolbarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */; }; 17D5F19524B0C1DD00375168 /* SidebarToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */; }; - 17E007FA25936D7B000C23F0 /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 17E007F925936D7B000C23F0 /* RSCore */; }; - 17E007FB25936D7B000C23F0 /* RSCore in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E007F925936D7B000C23F0 /* RSCore */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0080225936D89000C23F0 /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0080125936D89000C23F0 /* RSCore */; }; - 17E0080325936D89000C23F0 /* RSCore in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0080125936D89000C23F0 /* RSCore */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0080F25936DF6000C23F0 /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0080E25936DF6000C23F0 /* Articles */; }; - 17E0081025936DF6000C23F0 /* Articles in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0080E25936DF6000C23F0 /* Articles */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0081225936DF6000C23F0 /* ArticlesDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081125936DF6000C23F0 /* ArticlesDatabase */; }; - 17E0081325936DF6000C23F0 /* ArticlesDatabase in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081125936DF6000C23F0 /* ArticlesDatabase */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0081525936DFF000C23F0 /* Secrets in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081425936DFF000C23F0 /* Secrets */; }; - 17E0081625936DFF000C23F0 /* Secrets in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081425936DFF000C23F0 /* Secrets */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0081825936DFF000C23F0 /* SyncDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081725936DFF000C23F0 /* SyncDatabase */; }; - 17E0081925936DFF000C23F0 /* SyncDatabase in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081725936DFF000C23F0 /* SyncDatabase */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0082025936E31000C23F0 /* Articles in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081F25936E31000C23F0 /* Articles */; }; - 17E0082125936E31000C23F0 /* Articles in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0081F25936E31000C23F0 /* Articles */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0082325936E31000C23F0 /* ArticlesDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0082225936E31000C23F0 /* ArticlesDatabase */; }; - 17E0082425936E31000C23F0 /* ArticlesDatabase in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0082225936E31000C23F0 /* ArticlesDatabase */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0082625936E31000C23F0 /* Secrets in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0082525936E31000C23F0 /* Secrets */; }; - 17E0082725936E31000C23F0 /* Secrets in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0082525936E31000C23F0 /* Secrets */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0082925936E31000C23F0 /* SyncDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 17E0082825936E31000C23F0 /* SyncDatabase */; }; - 17E0082A25936E31000C23F0 /* SyncDatabase in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17E0082825936E31000C23F0 /* SyncDatabase */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17E0083025936E70000C23F0 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 516B695E24D2F33B00B5702F /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 17E0084625941887000C23F0 /* SizeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0084525941887000C23F0 /* SizeCategories.swift */; }; 17E4DBD624BFC53E00FE462A /* AdvancedPreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E4DBD524BFC53E00FE462A /* AdvancedPreferencesModel.swift */; }; 3B3A32A5238B820900314204 /* FeedWranglerAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B3A328B238B820900314204 /* FeedWranglerAccountViewController.swift */; }; 3B826DCB2385C84800FC1ADB /* AccountsFeedWrangler.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3B826DB02385C84800FC1ADB /* AccountsFeedWrangler.xib */; }; @@ -1499,6 +1479,7 @@ 17D232A724AFF10A0005F075 /* AddWebFeedModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedModel.swift; sourceTree = ""; }; 17D3CEE2257C4D2300E74939 /* AddAccountSignUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountSignUp.swift; sourceTree = ""; }; 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarToolbarModel.swift; sourceTree = ""; }; + 17E0084525941887000C23F0 /* SizeCategories.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SizeCategories.swift; sourceTree = ""; }; 17E4DBD524BFC53E00FE462A /* AdvancedPreferencesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedPreferencesModel.swift; sourceTree = ""; }; 3B3A328B238B820900314204 /* FeedWranglerAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedWranglerAccountViewController.swift; sourceTree = ""; }; 3B826DB02385C84800FC1ADB /* AccountsFeedWrangler.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AccountsFeedWrangler.xib; sourceTree = ""; }; @@ -2318,6 +2299,7 @@ isa = PBXGroup; children = ( 176814562564BD0600D98635 /* ArticleItemView.swift */, + 17E0084525941887000C23F0 /* SizeCategories.swift */, ); path = "Shared Views"; sourceTree = ""; @@ -4577,6 +4559,7 @@ 176814652564BD7F00D98635 /* WidgetData.swift in Sources */, 1768145E2564BD7B00D98635 /* WidgetDataDecoder.swift in Sources */, 176814132564BC8A00D98635 /* WidgetBundle.swift in Sources */, + 17E0084625941887000C23F0 /* SizeCategories.swift in Sources */, 176814462564BCD200D98635 /* StarredWidget.swift in Sources */, 176814572564BD0600D98635 /* ArticleItemView.swift in Sources */, 1768144E2564BCE000D98635 /* SmartFeedSummaryWidget.swift in Sources */, diff --git a/Widget/Shared Views/SizeCategories.swift b/Widget/Shared Views/SizeCategories.swift new file mode 100644 index 000000000..ecc1d632f --- /dev/null +++ b/Widget/Shared Views/SizeCategories.swift @@ -0,0 +1,26 @@ +// +// SizeCategories.swift +// NetNewsWire iOS Widget Extension +// +// Created by Stuart Breckenridge on 24/12/2020. +// Copyright © 2020 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct SizeCategories { + + let largeSizeCategories: [ContentSizeCategory] = [.extraExtraLarge, + .extraExtraExtraLarge, + .accessibilityMedium, + .accessibilityLarge, + .accessibilityExtraLarge, + .accessibilityExtraExtraLarge, + .accessibilityExtraExtraExtraLarge] + + + func isSizeCategoryLarge(category: ContentSizeCategory) -> Bool { + largeSizeCategories.filter{ $0 == category }.count == 1 + } + +} diff --git a/Widget/Widget Views/StarredWidget.swift b/Widget/Widget Views/StarredWidget.swift index 945fc041e..0928a322a 100644 --- a/Widget/Widget Views/StarredWidget.swift +++ b/Widget/Widget Views/StarredWidget.swift @@ -12,6 +12,7 @@ import SwiftUI struct StarredWidgetView : View { @Environment(\.widgetFamily) var family: WidgetFamily + @Environment(\.sizeCategory) var sizeCategory: ContentSizeCategory var entry: Provider.Entry @@ -58,16 +59,21 @@ struct StarredWidgetView : View { var starredImage: some View { Image(systemName: "star.fill") .resizable() - .frame(width: 25, height: 25, alignment: .center) + .frame(width: 30, height: 30, alignment: .center) .cornerRadius(4) .foregroundColor(.yellow) } func maxCount() -> Int { - if family == .systemLarge { - return entry.widgetData.currentStarredCount > 7 ? 7 : entry.widgetData.currentStarredCount + var reduceAccessibilityCount: Int = 0 + if SizeCategories().isSizeCategoryLarge(category: sizeCategory) { + reduceAccessibilityCount = 1 } - return entry.widgetData.currentStarredCount > 3 ? 3 : entry.widgetData.currentStarredCount + + if family == .systemLarge { + return entry.widgetData.currentStarredCount >= 7 ? (7 - reduceAccessibilityCount) : entry.widgetData.currentStarredCount + } + return entry.widgetData.currentStarredCount >= 3 ? (3 - reduceAccessibilityCount) : entry.widgetData.currentStarredCount } var inboxZero: some View { diff --git a/Widget/Widget Views/TodayWidget.swift b/Widget/Widget Views/TodayWidget.swift index 5e1fdd9ab..436782689 100644 --- a/Widget/Widget Views/TodayWidget.swift +++ b/Widget/Widget Views/TodayWidget.swift @@ -12,6 +12,7 @@ import SwiftUI struct TodayWidgetView : View { @Environment(\.widgetFamily) var family: WidgetFamily + @Environment(\.sizeCategory) var sizeCategory: ContentSizeCategory var entry: Provider.Entry @@ -57,16 +58,21 @@ struct TodayWidgetView : View { var todayImage: some View { Image(systemName: "sun.max.fill") .resizable() - .frame(width: 25, height: 25, alignment: .center) + .frame(width: 30, height: 30, alignment: .center) .cornerRadius(4) .foregroundColor(.orange) } func maxCount() -> Int { - if family == .systemLarge { - return entry.widgetData.todayArticles.count > 7 ? 7 : entry.widgetData.todayArticles.count + var reduceAccessibilityCount: Int = 0 + if SizeCategories().isSizeCategoryLarge(category: sizeCategory) { + reduceAccessibilityCount = 1 } - return entry.widgetData.todayArticles.count > 3 ? 3 : entry.widgetData.todayArticles.count + + if family == .systemLarge { + return entry.widgetData.todayArticles.count >= 7 ? (7 - reduceAccessibilityCount) : entry.widgetData.todayArticles.count + } + return entry.widgetData.todayArticles.count >= 3 ? (3 - reduceAccessibilityCount) : entry.widgetData.todayArticles.count } var inboxZero: some View { diff --git a/Widget/Widget Views/UnreadWidget.swift b/Widget/Widget Views/UnreadWidget.swift index 924be016e..38d0c179b 100644 --- a/Widget/Widget Views/UnreadWidget.swift +++ b/Widget/Widget Views/UnreadWidget.swift @@ -12,6 +12,7 @@ import SwiftUI struct UnreadWidgetView : View { @Environment(\.widgetFamily) var family: WidgetFamily + @Environment(\.sizeCategory) var sizeCategory: ContentSizeCategory var entry: Provider.Entry @@ -57,16 +58,21 @@ struct UnreadWidgetView : View { var unreadImage: some View { Image(systemName: "largecircle.fill.circle") .resizable() - .frame(width: 25, height: 25, alignment: .center) + .frame(width: 30, height: 30, alignment: .center) .cornerRadius(4) .foregroundColor(.accentColor) } func maxCount() -> Int { - if family == .systemLarge { - return entry.widgetData.unreadArticles.count > 7 ? 7 : entry.widgetData.unreadArticles.count + var reduceAccessibilityCount: Int = 0 + if SizeCategories().isSizeCategoryLarge(category: sizeCategory) { + reduceAccessibilityCount = 1 } - return entry.widgetData.unreadArticles.count > 3 ? 3 : entry.widgetData.unreadArticles.count + + if family == .systemLarge { + return entry.widgetData.unreadArticles.count >= 7 ? (7 - reduceAccessibilityCount) : entry.widgetData.unreadArticles.count + } + return entry.widgetData.unreadArticles.count >= 3 ? (3 - reduceAccessibilityCount) : entry.widgetData.unreadArticles.count } var inboxZero: some View {