Skip to content

Commit

Permalink
Use Google API for fetching fav icon of the source
Browse files Browse the repository at this point in the history
This is a temporary fix and a more robust approach will be pushed later
  • Loading branch information
msasikanth committed Aug 10, 2024
1 parent d941f0f commit c26ab49
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Binary file not shown.
55 changes: 55 additions & 0 deletions core/data/src/commonMain/sqldelight/migrations/19.sqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import kotlin.Boolean;
import kotlinx.datetime.Instant;

ALTER TABLE feed RENAME TO feed_old;

DROP INDEX feed_link_index;
DROP INDEX feed_pinned_at;
DROP INDEX feed_pinned_position;

CREATE TABLE IF NOT EXISTS feed(
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
icon TEXT NOT NULL,
description TEXT NOT NULL,
link TEXT NOT NULL,
homepageLink TEXT NOT NULL,
createdAt INTEGER AS Instant NOT NULL,
pinnedAt INTEGER AS Instant,
lastCleanUpAt INTEGER AS Instant,
alwaysFetchSourceArticle INTEGER AS Boolean NOT NULL DEFAULT 0,
pinnedPosition REAL NOT NULL DEFAULT 0.0
);

CREATE INDEX feed_link_index ON feed(link);
CREATE INDEX feed_pinned_at ON feed(pinnedAt);
CREATE INDEX feed_pinned_position ON feed(pinnedPosition);

INSERT INTO feed(
id,
name,
icon,
description,
link,
homepageLink,
createdAt,
pinnedAt,
lastCleanUpAt,
alwaysFetchSourceArticle,
pinnedPosition
)
SELECT
id,
name,
'https://www.google.com/s2/favicons?domain=' || homepageLink || '&sz=180' AS icon,
description,
link,
homepageLink,
createdAt,
pinnedAt,
lastCleanUpAt,
alwaysFetchSourceArticle,
pinnedPosition
FROM feed_old;

DROP TABLE feed_old;

0 comments on commit c26ab49

Please sign in to comment.