summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-08-22 01:00:02 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-08-22 01:00:02 +0000
commitfd49bacfb92ef8d29cbad56419acd016ff40f357 (patch)
tree015caea07a9c556d39705c62a77b4a25f2b79219 /app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
parentfb69196f961eeaa30432c33db3003effcdbced53 (diff)
In-app YouTube playback, shared ConfirmDialog, hardened link handling
- ReaderWebView/LinkReaderScreen/ReaderScreen: tapping a YouTube link inside an article now opens an in-app player (youtube-nocookie.com, JS scoped to just that dialog) instead of handing off to the YouTube app/browser. Falls back to external-open when a confident video ID can't be extracted (playlist/channel links). - A subframe (ad/embed iframe) auto-navigating is now blocked outright instead of being treated like a real link tap -- it fired the exact same callback as a user tap, with no interaction required. - wrapReaderHtml can now show a fallback hero image + date when the feed's own body HTML has no image of its own. - ConfirmDialog: the generic "confirm before doing something irreversible" dialog shape was independently rebuilt from scratch at FeedListScreen's unsubscribe and ArticleListScreen's mark-read-from- here confirmations. Both now share one composable; the latter also chunks its batch update (markReadBatchChunked) so a long-unread feed can't exceed SQLite's per-statement bound-variable limit.
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
index 1fe198e..b586fbc 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
@@ -188,6 +188,7 @@ private fun ReaderContent(
var showBugReportDialog by remember(articleId) { mutableStateOf(false) }
var bugReportDescription by remember(articleId) { mutableStateOf("") }
var longPressedLink by remember(articleId) { mutableStateOf<String?>(null) }
+ var youtubeVideoId by remember(articleId) { mutableStateOf<String?>(null) }
LaunchedEffect(articleId) {
val loaded = db.articleDao().getById(articleId) ?: return@LaunchedEffect
@@ -470,6 +471,9 @@ private fun ReaderContent(
}
)
}
+ youtubeVideoId?.let { videoId ->
+ YouTubePlayerDialog(videoId = videoId, onDismiss = { youtubeVideoId = null })
+ }
longPressedLink?.let { url ->
LinkActionsDialog(
url = url,
@@ -512,14 +516,19 @@ private fun ReaderContent(
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { ctx ->
- newReaderWebView(ctx, onOpenLink, onLongPressLink = { longPressedLink = it }).apply {
- loadDataWithBaseURL(baseUrl, wrapReaderHtml(content, article?.title), "text/html", "UTF-8", null)
+ newReaderWebView(
+ ctx,
+ onOpenLink,
+ onLongPressLink = { longPressedLink = it },
+ onYouTubeVideo = { youtubeVideoId = it }
+ ).apply {
+ loadDataWithBaseURL(baseUrl, wrapReaderHtml(content, article?.title, article?.publishedAt, article?.imageUrl), "text/html", "UTF-8", null)
loadedContent.value = content
}
},
update = { webView ->
if (loadedContent.value != content) {
- webView.loadDataWithBaseURL(baseUrl, wrapReaderHtml(content, article?.title), "text/html", "UTF-8", null)
+ webView.loadDataWithBaseURL(baseUrl, wrapReaderHtml(content, article?.title, article?.publishedAt, article?.imageUrl), "text/html", "UTF-8", null)
loadedContent.value = content
}
},