No third-party fetch without asking: gate GIFs, hide ML settings
build / build (push) Successful in 17m17s

- GifMessage gets autoLoad; chats pass their "images from URLs" switch
  (off by default), so a received GIF code no longer fetches from Giphy
  until tapped. Reply quotes follow the channel setting.
- Translation and image-message settings are hidden (kOnDeviceMl in
  lib/tth_fork.dart): without the native runtimes they cannot work and
  their buttons would only download models of up to 835 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-19 13:13:16 +02:00
1 parent 59b64291c4
commit bfb3ef6128
6 files changed
+43 -8

No files matched your search

+5
View File
@@ -7,6 +7,11 @@ Open-source Flutter client for MeshCore LoRa mesh networking devices.
> s upstreamem `dev`, který se slévá každou noc; co a proč je jinak:
> [`stubs/README.md`](stubs/README.md), build: `.gitea/workflows/build.yml`.
>
> **Soukromí:** žádné volání třetích stran bez tvého úkonu. GIFy (Giphy) se
> načtou jen v chatu se zapnutými obrázky z URL (výchozí stav je vypnuto),
> jinak až po klepnutí. Bez affiliate banneru. Mapa, Line of sight, GIF picker
> a síťová mapa sahají ven jen na vyžádání.
>
> **Instalace přes Obtainium:** naskenuj QR telefonem, nebo na telefonu otevři
> [tenhle odkaz](https://apps.obtainium.imranr.dev/redirect?r=obtainium%3A%2F%2Fapp%2F%257B%2522id%2522%253A%2522com.meshcore.meshcore_open%2522%252C%2522url%2522%253A%2522https%253A%252F%252Fgit.rfa.cz%252Ftth-pub%252Fmeshcore-open%2522%252C%2522author%2522%253A%2522tth%2522%252C%2522name%2522%253A%2522MeshCore%2520Open%2520%2528tth%2529%2522%252C%2522preferredApkIndex%2522%253A0%252C%2522additionalSettings%2522%253A%2522%257B%257D%2522%252C%2522overrideSource%2522%253A%2522Codeberg%2522%257D).
>
+9 -6
View File
@@ -21,6 +21,7 @@ import '../widgets/mesh_ui.dart';
import '../widgets/network_map_settings_section.dart';
import '../widgets/sync_progress_overlay.dart';
import '../widgets/translation_settings_section.dart';
import '../tth_fork.dart';
import '../helpers/snack_bar_builder.dart';
import 'map_cache_screen.dart';
@@ -80,11 +81,13 @@ class AppSettingsScreen extends StatelessWidget {
),
// IMAGE MESSAGES
SectionHeader(context.l10n.appSettings_imageMessagesSection),
MeshCard(
padding: EdgeInsets.zero,
child: _settingsCard(_buildImageMessagesContent),
),
if (kOnDeviceMl) ...[
SectionHeader(context.l10n.appSettings_imageMessagesSection),
MeshCard(
padding: EdgeInsets.zero,
child: _settingsCard(_buildImageMessagesContent),
),
],
// BATTERY
SectionHeader(context.l10n.appSettings_battery),
@@ -108,7 +111,7 @@ class AppSettingsScreen extends StatelessWidget {
),
// TRANSLATION (non-web only)
if (!kIsWeb) ...[
if (!kIsWeb && kOnDeviceMl) ...[
SectionHeader(context.l10n.translation_title),
const MeshCard(
padding: EdgeInsets.zero,
+4
View File
@@ -743,6 +743,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
child: GifMessage(
url:
'https://media.giphy.com/media/$gifId/giphy.gif',
autoLoad: urlImagesEnabled,
backgroundColor: Colors.transparent,
fallbackTextColor: textColor.withValues(
alpha: 0.7,
@@ -1055,6 +1056,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
borderRadius: BorderRadius.circular(4),
child: GifMessage(
url: 'https://media.giphy.com/media/$gifId/giphy.gif',
autoLoad: context.read<MeshCoreConnector>().isChannelUrlImagesEnabled(
widget.channel.index,
),
backgroundColor: colorScheme.surfaceContainerHighest,
fallbackTextColor: color,
maxSize: gifSize,
+1
View File
@@ -1339,6 +1339,7 @@ class _MessageBubble extends StatelessWidget {
child: GifMessage(
url:
'https://media.giphy.com/media/$gifId/giphy.gif',
autoLoad: urlImagesEnabled,
backgroundColor: Colors.transparent,
fallbackTextColor: textColor.withValues(
alpha: 0.7,
+7
View File
@@ -0,0 +1,7 @@
/// Build switches of the tth fork (git.rfa.cz/tth-pub/meshcore-open).
library;
/// On-device ML is stubbed out (stubs/README.md): translation and the neural
/// image codec cannot work, so their settings - and the model downloads
/// behind them - are hidden.
const bool kOnDeviceMl = false;
+17 -2
View File
@@ -10,12 +10,17 @@ class GifMessage extends StatefulWidget {
final Color fallbackTextColor;
final double maxSize;
/// False: show "tap to load" and fetch only on tap (tth fork, no
/// third-party request without the user asking for it).
final bool autoLoad;
const GifMessage({
super.key,
required this.url,
required this.backgroundColor,
required this.fallbackTextColor,
this.maxSize = 200,
this.autoLoad = true,
});
@override
@@ -33,7 +38,11 @@ class _GifMessageState extends State<GifMessage> {
@override
void initState() {
super.initState();
_resolveImage();
if (widget.autoLoad) {
_resolveImage();
} else {
_isLoading = false;
}
}
@override
@@ -45,7 +54,13 @@ class _GifMessageState extends State<GifMessage> {
_error = null;
_isLoading = true;
_isPaused = false;
_resolveImage();
if (widget.autoLoad) {
_resolveImage();
} else {
_isLoading = false;
}
} else if (widget.autoLoad && !oldWidget.autoLoad && _image == null) {
_retryLoad();
}
}