Skip to content

Commit

Permalink
Revert "Implement fever favicon (Ashinch#496)"
Browse files Browse the repository at this point in the history
This reverts commit 4d5d9ef.
  • Loading branch information
mbestavros committed Jan 10, 2024
1 parent 705b3d0 commit 5a00a46
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ class FeverRssService @Inject constructor(
* obtained is 0 or their quantity exceeds 250, at which point the pulling process stops.
*
* 1. Fetch the Fever groups
* 2. Fetch the Fever feeds (including favicons)
* 2. Fetch the Fever feeds
* 3. Fetch the Fever articles
* 4. Synchronize read/unread and starred/un-starred items
* 5. TODO: Fetch the Fever favicons
*/
override suspend fun sync(coroutineWorker: CoroutineWorker): ListenableWorker.Result = supervisorScope {
coroutineWorker.setProgress(SyncWorker.setIsSyncing(true))
Expand Down Expand Up @@ -126,9 +127,6 @@ class FeverRssService @Inject constructor(
}
}
}

// Fetch the Fever favicons
val faviconsById = feverAPI.getFavicons().favicons?.associateBy { it.id } ?: emptyMap()
feedDao.insertOrUpdate(
feedsBody.feeds?.map {
Feed(
Expand All @@ -137,7 +135,6 @@ class FeverRssService @Inject constructor(
url = it.url!!,
groupId = accountId.spacerDollar(feedsGroupsMap[it.id.toString()]!!),
accountId = accountId,
icon = faviconsById[it.favicon_id]?.data
)
} ?: emptyList()
)
Expand Down Expand Up @@ -194,6 +191,7 @@ class FeverRssService @Inject constructor(
}
}

// TODO: 5. Fetch the Fever favicons

Log.i("RLog", "onCompletion: ${System.currentTimeMillis() - preTime}")
accountDao.update(account.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ object FeverDTO {
val api_version: Int?,
val auth: Int?,
val last_refreshed_on_time: Long?,
val favicons: List<Favicon>?,
val favicons: Map<String, Favicon>,
)

data class Favicon(
val id: Int,
val data: String?,
val mime_type: String,
val data: String,
)

/**
Expand Down
11 changes: 1 addition & 10 deletions app/src/main/java/me/ash/reader/ui/component/FeedIcon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import me.ash.reader.ui.component.base.Base64Image
import me.ash.reader.ui.component.base.RYAsyncImage

@Composable
Expand All @@ -27,7 +26,7 @@ fun FeedIcon(
if (iconUrl == null) {
Box(
modifier = Modifier
.size(size)
.size(20.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.primary),
contentAlignment = Alignment.Center,
Expand All @@ -39,14 +38,6 @@ fun FeedIcon(
fontSize = 10.sp,
)
}
}
// e.g. image/gif;base64,R0lGODlh...
else if ("^image/.*;base64,.*".toRegex().matches(iconUrl)) {
Base64Image(
modifier = Modifier
.size(size)
.clip(CircleShape),
base64Uri = iconUrl)
} else {
RYAsyncImage(
modifier = Modifier
Expand Down
30 changes: 0 additions & 30 deletions app/src/main/java/me/ash/reader/ui/component/base/Base64Image.kt

This file was deleted.

0 comments on commit 5a00a46

Please sign in to comment.