Skip to content

add low-bandwidth mode#2111

Open
KiaraGrouwstra wants to merge 12 commits intoLemmyNet:mainfrom
KiaraGrouwstra:feat/low-bandwidth-mode
Open

add low-bandwidth mode#2111
KiaraGrouwstra wants to merge 12 commits intoLemmyNet:mainfrom
KiaraGrouwstra:feat/low-bandwidth-mode

Conversation

@KiaraGrouwstra
Copy link
Copy Markdown

@KiaraGrouwstra KiaraGrouwstra commented Apr 10, 2026

closes #1594.

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

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 ![alt](url) 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.
@MV-GH
Copy link
Copy Markdown
Collaborator

MV-GH commented Apr 10, 2026

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 CompositionLocalProvider Dessalines prefers prop drilling instead, all though to reach that markwon stuff might not be easy

Also i think it would be better if setting was like this

  • "auto" -> when connected to metered network enable it (like now)
  • "enabled"
  • "disabled"

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add low-bandwidth mode

3 participants