summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-24 03:28:31 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-24 03:28:31 +0000
commit72f76cc41ae406e00a4dd9d448e2b552f9a6baaa (patch)
tree5f23e410b2ac4f8dddf89422ab57e738b3b04b2f /app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt
parentab392e2ab983a4c87e241b457c98244251b2206a (diff)
Collapsible folders, long-press link menu, YouTube thumbnails, strip more Ars sequel chrome
- Feed list: folders now collapse (start collapsed, with a per-folder unread count so collapsing doesn't hide "is there anything new") - Long-pressing a link inside an article shows an action menu (open in browser, share, save to Stash, save for later) instead of WebView's default text-selection popup -- confirmed live end to end, including the Stash/save-for-later paths creating a real standalone article - New shared ensureStandaloneArticle() helper (data/ArticleSaving.kt), factored out of ShareReceiverActivity, now also used by the long-press menu - YouTube iframe embeds become tap-to-open thumbnails (JS is off in the reader WebView, so the real player never worked anyway); tapping one goes straight to the YouTube app/browser instead of our own article-extraction pipeline - Fixed back navigation through a chain of links-within-links: each hop was stacking a new backstack entry, so back stepped through the chain one link at a time instead of returning straight to the source article. Confirmed live: A -> link -> B -> link -> C, one back-press now goes straight to A - Extended the <header> chrome-stripping from last round: also strip <footer>, an author bio card, and a "Most Read" trending-stories widget -- confirmed live one of the latter showed up as a giant unrelated photo plus an empty numbered list (its lazy-loaded items never populate in this hidden, off-screen extraction WebView) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ7ikw2ukGJFTHE3bJS7zL
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt25
1 files changed, 6 insertions, 19 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt b/app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt
index 656bebc..1a383ae 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ShareReceiverActivity.kt
@@ -22,13 +22,11 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import org.terst.feedreader.data.AppDatabase
-import org.terst.feedreader.data.ArticleEntity
import org.terst.feedreader.data.Net
import org.terst.feedreader.data.Settings
-import org.terst.feedreader.readability.ReaderExtractor
+import org.terst.feedreader.data.ensureStandaloneArticle
import org.terst.feedreader.stash.StashClient
import org.terst.feedreader.stash.StashSaveResult
-import java.security.MessageDigest
private val URL_REGEX = Regex("""https?://\S+""")
@@ -63,29 +61,18 @@ private fun ShareReceiverContent(url: String?, onDone: () -> Unit) {
if (url == null) return@LaunchedEffect
val db = AppDatabase.get(context)
- val extracted = ReaderExtractor.extract(context, url)
- val id = MessageDigest.getInstance("SHA-256").digest(url.toByteArray()).joinToString("") { "%02x".format(it) }
- db.articleDao().upsert(
- ArticleEntity(
- id = id,
- feedId = null,
- title = extracted?.title ?: url,
- link = url,
- extractedContent = extracted?.content,
- isSaved = true,
- createdAt = System.currentTimeMillis()
- )
- )
+ val entity = ensureStandaloneArticle(context, db, url)
+ if (!entity.isSaved) db.articleDao().setSaved(entity.id, true)
val settings = Settings(context)
val client = StashClient(Net.client, settings.stashBaseUrlNow(), settings.stashApiKeyNow())
- status = when (val result = client.saveArticle(url, extracted?.title)) {
+ status = when (val result = client.saveArticle(url, entity.title)) {
is StashSaveResult.Saved -> {
- db.articleDao().setStashArtifactId(id, result.artifact.id)
+ db.articleDao().setStashArtifactId(entity.id, result.artifact.id)
"Saved for offline reading and archived to Stash"
}
is StashSaveResult.AlreadySaved -> {
- db.articleDao().setStashArtifactId(id, result.existingId)
+ db.articleDao().setStashArtifactId(entity.id, result.existingId)
"Saved for offline reading (already in Stash)"
}
is StashSaveResult.Failed ->