Add custom smart feeds with a rule-based criteria builder#2
Open
davidfwatson wants to merge 2 commits into
Open
Add custom smart feeds with a rule-based criteria builder#2davidfwatson wants to merge 2 commits into
davidfwatson wants to merge 2 commits into
Conversation
Users can now create their own smart feeds — not just the three built-in ones (Today, All Unread, Starred). A smart feed is defined by a set of conditions combined with Match All / Match Any. v1 conditions: read status (unread/read), starred status, and feed is / feed is not. The motivating example — "all unread except certain feeds" — is expressible as Match All of [unread, feed is not X, feed is not Y]. Design: - SmartFeedCriteria (Codable/Sendable/Hashable) lives in the ArticlesDatabase module so both FetchType (Account) and the SQL builder can reference it. It builds a bounded WHERE clause; feed conditions are account-scoped (a feedID from another account reduces to a constant), keeping cross-account feeds correct as each account is queried in turn. - New FetchType.smartFeedCriteria(_:) reuses AccountManager's cross-account fetch aggregation and SmartFeed's per-account unread counting for free. - CustomSmartFeedDelegate + UserSmartFeed, persisted as JSON in AppConfig.dataFolder; SmartFeedsController now loads/adds/updates/removes them and posts .ChildrenDidChange so both sidebars rebuild. find(by:) resolves custom UUIDs for state restoration. - A shared SwiftUI editor (SmartFeedEditorView) is hosted in a UIHostingController on iOS and an NSHostingController on Mac. - iOS: Add Smart Feed in the + menu / action sheet; swipe + context-menu edit/delete for custom feeds only; custom removal path (DeleteCommand rejects pseudo-feeds); built-ins stay non-deletable. - Mac: New Smart Feed… in the File menu and no-selection sidebar menu; Edit/Delete in the smart-feed context menu, gated to custom feeds. Unit tests cover the WHERE-clause building, cross-account scoping, match all/any, negation, and Codable round-tripping. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hyatbnytz2qnLuJsiYQYb4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hyatbnytz2qnLuJsiYQYb4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the ability to create your own smart feeds, instead of only the three built-ins (Today, All Unread, Starred). A custom smart feed is defined by a set of conditions combined with Match All / Match Any.
v1 conditions: read status (unread/read), starred status, and feed is / feed is not.
The motivating example — "all unread except certain feeds" — is just Match All of
[unread, feed is not X, feed is not Y].How it works
SmartFeedCriteria(Codable/Sendable/Hashable) lives in the ArticlesDatabase module so bothFetchType(Account) and the SQL builder can see it. It builds a boundedWHEREclause. Feed conditions are account-scoped: afeedIDfrom another account reduces to a constant (0/1), so a cross-account smart feed stays correct as each account's database is queried in turn.FetchType.smartFeedCriteria(_:)reusesAccountManager's cross-account fetch aggregation andSmartFeed's per-account unread counting — no new fan-out plumbing.UserSmartFeed+CustomSmartFeedDelegate, persisted as JSON inAppConfig.dataFolder.SmartFeedsControllernow loads/adds/updates/removes them and posts.ChildrenDidChangeso both sidebars rebuild;find(by:)resolves custom UUIDs for state restoration.SmartFeedEditorView) hosted in aUIHostingController(iOS) andNSHostingController(Mac).+menu / action sheet; swipe + context-menu edit/delete for custom feeds only (built-ins stay non-deletable); custom removal path sinceDeleteCommandrejects pseudo-feeds.Testing
SmartFeedCriteriaTests, 14 cases) cover WHERE-clause building, cross-account scoping, match all/any, negation, the "unread excluding feeds" example, and Codable round-tripping — all passing viaswift test.Out of scope (possible follow-ups)
Text/body-contains (the FTS index is available), date windows, folder conditions, author/URL matching, reordering custom feeds, and syncing definitions across devices.
🤖 Generated with Claude Code