diff --git a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift index d1a81e611..307f5b8b5 100644 --- a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift +++ b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift @@ -24,6 +24,7 @@ final class AccountsPreferencesViewController: NSViewController { @IBOutlet weak var deleteButton: NSButton! var addAccountDelegate: AccountsPreferencesAddAccountDelegate? var addAccountWindowController: NSWindowController? + var addAccountsViewController: NSHostingController? private var sortedAccounts = [Account]() @@ -52,6 +53,7 @@ final class AccountsPreferencesViewController: NSViewController { let controller = NSHostingController(rootView: AddAccountsView(delegate: self)) controller.rootView.parent = controller presentAsSheet(controller) + addAccountsViewController = controller } @IBAction func removeAccount(_ sender: Any) { diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index f0cd1d128..243cefc4d 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -36,7 +36,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 */; }; @@ -847,8 +846,7 @@ D5F4EDB720074D6500B9E363 /* WebFeed+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */; }; D5F4EDB920074D7C00B9E363 /* Folder+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */; }; DD82AB0A231003F6002269DF /* SharingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD82AB09231003F6002269DF /* SharingTests.swift */; }; - DF2A8F33289BFBD9002455AD /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = DF2A8F32289BFBD9002455AD /* RSCore */; }; - DF2A8F34289BFBDA002455AD /* RSCore in Embed Frameworks */ = {isa = PBXBuildFile; productRef = DF2A8F32289BFBD9002455AD /* RSCore */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; }; DFD6AACF27ADE86E00463FAD /* NewsFax.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */; }; DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; DFFC199827A0D0D7004B7AEF /* NotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFFC199727A0D0D7004B7AEF /* NotificationsViewController.swift */; }; @@ -1770,10 +1768,10 @@ 176814342564BCB500D98635 /* Widget Views */ = { isa = PBXGroup; children = ( + 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */, 176814352564BCC000D98635 /* UnreadWidget.swift */, 1768143D2564BCC800D98635 /* TodayWidget.swift */, 176814452564BCD200D98635 /* StarredWidget.swift */, - 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */, ); path = "Widget Views"; sourceTree = ""; @@ -3189,7 +3187,7 @@ 849C64581ED37A5D003D8FC0 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1240; + LastSwiftUpdateCheck = 1400; LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Ranchero Software"; TargetAttributes = { @@ -3728,6 +3726,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */, 176814362564BCC000D98635 /* UnreadWidget.swift in Sources */, 1768146C2564BD8100D98635 /* WidgetDeepLinks.swift in Sources */, 1768143E2564BCC800D98635 /* TodayWidget.swift in Sources */, @@ -3739,7 +3738,6 @@ 17E0084625941887000C23F0 /* SizeCategories.swift in Sources */, 176814462564BCD200D98635 /* StarredWidget.swift in Sources */, 176814572564BD0600D98635 /* ArticleItemView.swift in Sources */, - 1768144E2564BCE000D98635 /* SmartFeedSummaryWidget.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4718,6 +4716,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 51121AA12265430A00BC0EC1 /* NetNewsWire_iOSapp_target.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; }; name = Debug; }; @@ -4725,6 +4724,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 51121AA12265430A00BC0EC1 /* NetNewsWire_iOSapp_target.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; }; name = Release; }; diff --git a/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4725e156b..bdc34ef13 100644 --- a/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Thomvis/BrightFutures.git", "state": { "branch": null, - "revision": "939858b811026f85e87847a808f0bea2f187e5c4", - "version": "8.1.0" + "revision": "fa66fa183dce7196d431244d0215748cd14c5758", + "version": "8.2.0" } }, { diff --git a/Widget/Widget Views/SmartFeedSummaryWidget.swift b/Widget/Widget Views/SmartFeedSummaryWidget.swift index b1baf3611..9b470444d 100644 --- a/Widget/Widget Views/SmartFeedSummaryWidget.swift +++ b/Widget/Widget Views/SmartFeedSummaryWidget.swift @@ -17,48 +17,37 @@ struct SmartFeedSummaryWidgetView: View { var entry: Provider.Entry var body: some View { - smallWidget + rectangleWidget .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() - } - }) + var rectangleWidget: some View { + VStack(alignment: .leading, spacing: 2) { + HStack { + todayImage + Text(L10n.today).bold().font(.body) + Spacer() + Text(formattedCount(entry.widgetData.currentTodayCount)).bold() + + } - 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() - } - }) + HStack { + unreadImage + Text(L10n.unread).bold().font(.body) + Spacer() + Text(formattedCount(entry.widgetData.currentUnreadCount)).bold() + } - 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() + HStack { + starredImage + Text(L10n.starred).bold().font(.body) + Spacer() + Text(formattedCount(entry.widgetData.currentStarredCount)).bold() + } + + } + } func formattedCount(_ count: Int) -> String { @@ -71,37 +60,37 @@ struct SmartFeedSummaryWidgetView: View { var unreadImage: some View { Image(systemName: "largecircle.fill.circle") .resizable() - .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.white) + .frame(width: 12, height: 12, alignment: .center) } var nnwImage: some View { Image("CornerIcon") .resizable() - .frame(width: 20, height: 20, alignment: .center) + .frame(width: 10, height: 10, alignment: .center) .cornerRadius(4) } var starredImage: some View { Image(systemName: "star.fill") .resizable() - .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.white) + .frame(width: 12, height: 12, alignment: .center) } var todayImage: some View { Image(systemName: "sun.max.fill") .resizable() - .frame(width: 20, height: 20, alignment: .center) - .foregroundColor(.white) + .frame(width: 12, height: 12, alignment: .center) } } +@available(iOSApplicationExtension 16.0, *) struct SmartFeedSummaryWidgetView_Previews: PreviewProvider { static var previews: some View { - SmartFeedSummaryWidgetView(entry: Provider.Entry.init(date: Date(), widgetData: WidgetDataDecoder().sampleData())) + SmartFeedSummaryWidgetView(entry: Provider.Entry.init(date: Date(), widgetData: WidgetDataDecoder.sampleData())) + .previewContext(WidgetPreviewContext(family: .accessoryRectangular)) + } } diff --git a/Widget/WidgetBundle.swift b/Widget/WidgetBundle.swift index f5060ed7e..6a4907ad9 100644 --- a/Widget/WidgetBundle.swift +++ b/Widget/WidgetBundle.swift @@ -65,6 +65,8 @@ struct StarredWidget: Widget { } } + +@available(iOSApplicationExtension 16.0, *) struct SmartFeedSummaryWidget: Widget { let kind: String = "com.ranchero.NetNewsWire.SmartFeedSummaryWidget" @@ -72,25 +74,27 @@ struct SmartFeedSummaryWidget: Widget { return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in SmartFeedSummaryWidgetView(entry: entry) - .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color("AccentColor")) - }) .configurationDisplayName(L10n.smartFeedSummaryWidgetTitle) .description(L10n.smartFeedSummaryWidgetDescription) - .supportedFamilies([.systemSmall]) - + .supportedFamilies([.accessoryRectangular]) } } - // MARK: - WidgetBundle @main struct NetNewsWireWidgets: WidgetBundle { @WidgetBundleBuilder var body: some Widget { - UnreadWidget() - TodayWidget() - StarredWidget() + widgets() } + + func widgets() -> some Widget { + if #available(iOS 16.0, *) { + return WidgetBundleBuilder.buildBlock(UnreadWidget(), TodayWidget(), StarredWidget(), SmartFeedSummaryWidget()) + } else { + return WidgetBundleBuilder.buildBlock(UnreadWidget(), TodayWidget(), StarredWidget()) + } + } + } diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 9a989cb14..43a376e47 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -265,9 +265,15 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { themeActions.append(action) } - let defaultThemeAction = UIAction(title: NSLocalizedString("Default", comment: "Default"), image: nil, identifier: nil, discoverabilityTitle: nil, attributes: [], state: ArticleThemesManager.shared.currentThemeName == AppDefaults.defaultThemeName ? .on : .off) { _ in + let defaultThemeAction = UIAction(title: NSLocalizedString("Default", comment: "Default"), + image: nil, + identifier: nil, + discoverabilityTitle: nil, + attributes: [], + state: ArticleThemesManager.shared.currentThemeName == AppDefaults.defaultThemeName ? .on : .off, + handler: { _ in ArticleThemesManager.shared.currentThemeName = AppDefaults.defaultThemeName - } + }) let defaultThemeMenu = UIMenu(title: "", image: nil, identifier: nil, options: .displayInline, children: [defaultThemeAction]) let customThemeMenu = UIMenu(title: "", image: nil, identifier: nil, options: .displayInline, children: themeActions)