summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-22 18:35:06 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-22 18:35:06 +0000
commite804e7a77a6cac048d5f6edeac0a339ca89e4d40 (patch)
tree41bc4c30b11105f5846a5fe2eaf13e2cede10adf /app/src/main/java/org/terst/feedreader/ui/MainActivity.kt
parent91edd1f5f29a3336fa9e3bd1762c70ea74e3e48d (diff)
Add site login and alternate-source search for paywalled articles
Deliberately not a paywall-bypass mechanism -- that space (archive.today-style proxies, "Bypass Paywalls" extensions) is legally grey, adversarial toward publishers, and constantly breaking. Instead: - BrowserScreen: a real interactive mini-browser (JS + DOM storage on, ordinary navigation, no Readability interception) for the two cases where the user needs to actually USE a page rather than read it. Reached from a new overflow menu on the article reader: - "Log in to this site" opens the article's own URL there so the user can sign into a site they already subscribe to. Needs no extra plumbing: Android's CookieManager is one process-wide store shared by every WebView in the app, so a session cookie set here is picked up automatically by the reader's (JS-off) extraction WebView on the next visit to that domain -- same as a normal browser remembering you're signed in. - "Find another source" runs a web search on the article's title in the same browser, so the user can pick a different, non-paywalled outlet covering the same story themselves -- plain search/discovery, not circumvention. Verified live: search opened a real, interactive Google results page with working title-bar sync; back navigation (via BackHandler, goBack() when the WebView has history, else pop the screen) returned cleanly to the article.
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui/MainActivity.kt')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/MainActivity.kt14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt b/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt
index 95ef71e..bd09393 100644
--- a/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt
@@ -1,6 +1,7 @@
package org.terst.feedreader.ui
import android.os.Bundle
+import android.webkit.CookieManager
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
@@ -28,6 +29,9 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
FeedFetchWorker.schedulePeriodic(applicationContext)
+ // Explicit, even though it defaults on -- BrowserScreen relies on cookies set
+ // during a site login surviving into the reader's later extraction requests.
+ CookieManager.getInstance().setAcceptCookie(true)
setContent {
// Dark by default -- per user request, not following system light/dark for now.
@@ -85,7 +89,8 @@ fun FeedReaderApp() {
feedId = feedId,
initialArticleId = articleId,
onBack = { navController.popBackStack() },
- onOpenLink = { url -> navController.navigate("linkReader/${encodeNavArg(url)}") }
+ onOpenLink = { url -> navController.navigate("linkReader/${encodeNavArg(url)}") },
+ onOpenBrowser = { url -> navController.navigate("browser/${encodeNavArg(url)}") }
)
}
composable(
@@ -101,6 +106,13 @@ fun FeedReaderApp() {
onOpenLink = { nextUrl -> navController.navigate("linkReader/${encodeNavArg(nextUrl)}") }
)
}
+ composable(
+ "browser/{url}",
+ arguments = listOf(navArgument("url") { type = NavType.StringType })
+ ) { backStackEntry ->
+ val url = decodeNavArg(backStackEntry.arguments?.getString("url") ?: "")
+ BrowserScreen(startUrl = url, onBack = { navController.popBackStack() })
+ }
composable("addFeed") {
AddFeedScreen(onDone = { navController.popBackStack() })
}