add low-bandwidth mode#2111
Conversation
Adds a "Low bandwidth mode on metered connections" toggle in Look and Feel. When enabled and the device is on a metered connection, images and videos are not loaded in post listings.
Image and video posts in card view now show a tappable outlined card with an icon where the expanded media would normally appear. Tapping opens the media viewer; long-pressing shows the link popup.
The post detail screen uses SmallCard mode with expandedImage=false, which skipped the placeholder. Now sets expandedImage=true when both fullBody and lowBandwidthMode are active so the placeholder renders.
Low bandwidth mode now also activates when Android's system-wide Data Saver is enabled and the app isn't whitelisted, even if the user setting is off. Still gated on a metered connection.
Adds a LocalLowBandwidthMode CompositionLocal and a second markwon instance without ClickableCoilImagesPlugin. Inline markdown images (comments, post bodies, private messages, etc.) render as their alt text instead of being fetched.
The alternate markwon parser still went through the default image visitor for markdown  syntax, so images kept loading. Preprocess the markdown source in low bandwidth mode to rewrite both markdown image syntax and HTML img tags as plain links.
|
run the formatter If I understand correctly, the "low bandwith mode" just disables the images and videos? If so can you add a disable image setting and low band with mode. the low band mode then disables the images and video setting when enabled. Then use those settings to disable the features. For video it should already be there. Also remove the Also i think it would be better if setting was like this
|
Signed-off-by: cinereal <cinereal@riseup.net>
Previously the SmallCard call site used `expandedImage = fullBody && lowBandwidthMode` as an indirect way to force the low-bandwidth media placeholder in the post detail view, which conflated two unrelated concepts. PostTitleBlock now takes fullBody explicitly and the placeholder branch checks `expandedImage || fullBody`, letting the SmallCard caller revert to `expandedImage = false`.
Extract the shared link/thumbnail rendering into a private ThumbnailBox helper so the low bandwidth path can reuse the same placeholder the normal path already falls back to when a thumbnail is absent. This drops the added mid-function `return` in favor of an if/else.
Replace the isVideo boolean parameter of PostTitleAndMediaPlaceholder with a PostLinkType directly, and swap the hard-coded 48.dp icon size for the existing LINK_ICON_SIZE constant.
Replace the regex-based stripInlineImages preprocessing with a small markwon plugin (LinkOnlyImagesPlugin) that installs a SpanFactory returning a URLSpan for commonmark Image nodes. Collapse the two markwon parser fields into one and pick the image plugin at init time based on lowBandwidthMode. Drop the LocalLowBandwidthMode CompositionLocal: MainActivity already computes the effective mode, and now passes it directly to MarkdownHelper.init and to BottomNavScreen so components just receive the boolean instead of recomputing it themselves or reading it from a CompositionLocal.
Introduces a LowBandwidthMode enum (Auto, Always, Never) to replace the previous boolean. Auto activates on metered connections or when Data Saver is enabled; the other states are unconditional. The LookAndFeel screen now exposes this as a dropdown, matching reviewer feedback on the PR.
dessalines
left a comment
There was a problem hiding this comment.
LGTM, great job!
After @MV-GH has a look, we can merge then do another release.
| val loader = context.imageLoader | ||
| // main markdown parser has coil + html on | ||
| val imagesPlugin = if (lowBandwidthMode) { | ||
| // Render `` as a plain clickable link — no network load. |
| shape = MaterialTheme.shapes.large, | ||
| @OptIn(ExperimentalFoundationApi::class) | ||
| @Composable | ||
| private fun ThumbnailBox( |
|
I'll review it this weekend |
|
Also the feature doesn't hide avatars/logos isn't that like the biggest consumption? scrolling through the comments you will download far more images than going through the feed? |
Signed-off-by: cinereal <cinereal@riseup.net>
Signed-off-by: cinereal <cinereal@riseup.net>



closes #1594.
disclaimer i used a coding agent in the creation of this patch.