-
Notifications
You must be signed in to change notification settings - Fork 20
add FavIconPresenter to handle favicon retrieval and caching #1482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors favicon handling for RSS feeds and account tabs by introducing a new FavIconPresenter with database caching and improving the favicon detection logic in RssService. The changes replace direct favicon URL generation with a more robust system that fetches, validates, and caches favicons.
- Introduces
FavIconPresenterfor fetching and caching favicons using the database - Enhances
RssService.fetchIconto intelligently select the best available icon by size and handle various URL formats - Replaces
IconType.UrlwithIconType.FavIconfor better type safety and integration
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| FavIconPresenter.kt | New presenter that fetches and caches favicons using the database |
| RssService.kt | Improved favicon detection logic with better icon selection and URL handling |
| EmojiContent.kt | Added FavIcon sealed interface member for database caching |
| Rss.kt | Replaced tryRun with standard runCatching for consistency |
| TabSettings.kt | Added IconType.FavIcon and updated HomeTimelineTabItem constructor |
| EditTabPresenter.kt | Updated to use new IconType.FavIcon instead of IconType.Url |
| HomeTimelineWithTabsPresenter.kt | Removed direct favicon URL generation, now handled by presenter |
| TabIcon.kt | Added rendering support for IconType.FavIcon with loading state |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| is Feed.RDF -> null | ||
| is Feed.Rss20 -> null | ||
| else -> null | ||
| null -> null |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null -> null branch is redundant since this is already the default behavior of a when expression that exhausts all sealed interface members. Consider using else -> null instead, or remove the explicit null handling if the sealed interface is exhaustive.
| null -> null |
| tryRun { | ||
| ktorClient( | ||
| config = {}, | ||
| ).get(url).bodyAsText() | ||
| }.getOrNull() ?: return null |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Inconsistent use of tryRun vs runCatching. The file Rss.kt was updated to use standard Kotlin runCatching, but this file still uses the custom tryRun function. For consistency across the codebase, consider using runCatching here as well, similar to the changes in Rss.kt.
No description provided.