No third-party fetch without asking: gate GIFs, hide ML settings
build / build (push) Successful in 17m17s
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:
1 parent
59b64291c4
commit
bfb3ef6128
6 files changed
+43
-8
No files matched your search
@@ -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:
|
> 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`.
|
> [`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
|
> **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).
|
> [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).
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import '../widgets/mesh_ui.dart';
|
|||||||
import '../widgets/network_map_settings_section.dart';
|
import '../widgets/network_map_settings_section.dart';
|
||||||
import '../widgets/sync_progress_overlay.dart';
|
import '../widgets/sync_progress_overlay.dart';
|
||||||
import '../widgets/translation_settings_section.dart';
|
import '../widgets/translation_settings_section.dart';
|
||||||
|
import '../tth_fork.dart';
|
||||||
import '../helpers/snack_bar_builder.dart';
|
import '../helpers/snack_bar_builder.dart';
|
||||||
import 'map_cache_screen.dart';
|
import 'map_cache_screen.dart';
|
||||||
|
|
||||||
@@ -80,11 +81,13 @@ class AppSettingsScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// IMAGE MESSAGES
|
// IMAGE MESSAGES
|
||||||
SectionHeader(context.l10n.appSettings_imageMessagesSection),
|
if (kOnDeviceMl) ...[
|
||||||
MeshCard(
|
SectionHeader(context.l10n.appSettings_imageMessagesSection),
|
||||||
padding: EdgeInsets.zero,
|
MeshCard(
|
||||||
child: _settingsCard(_buildImageMessagesContent),
|
padding: EdgeInsets.zero,
|
||||||
),
|
child: _settingsCard(_buildImageMessagesContent),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
// BATTERY
|
// BATTERY
|
||||||
SectionHeader(context.l10n.appSettings_battery),
|
SectionHeader(context.l10n.appSettings_battery),
|
||||||
@@ -108,7 +111,7 @@ class AppSettingsScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// TRANSLATION (non-web only)
|
// TRANSLATION (non-web only)
|
||||||
if (!kIsWeb) ...[
|
if (!kIsWeb && kOnDeviceMl) ...[
|
||||||
SectionHeader(context.l10n.translation_title),
|
SectionHeader(context.l10n.translation_title),
|
||||||
const MeshCard(
|
const MeshCard(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
|
|||||||
@@ -743,6 +743,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
child: GifMessage(
|
child: GifMessage(
|
||||||
url:
|
url:
|
||||||
'https://media.giphy.com/media/$gifId/giphy.gif',
|
'https://media.giphy.com/media/$gifId/giphy.gif',
|
||||||
|
autoLoad: urlImagesEnabled,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
fallbackTextColor: textColor.withValues(
|
fallbackTextColor: textColor.withValues(
|
||||||
alpha: 0.7,
|
alpha: 0.7,
|
||||||
@@ -1055,6 +1056,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
child: GifMessage(
|
child: GifMessage(
|
||||||
url: 'https://media.giphy.com/media/$gifId/giphy.gif',
|
url: 'https://media.giphy.com/media/$gifId/giphy.gif',
|
||||||
|
autoLoad: context.read<MeshCoreConnector>().isChannelUrlImagesEnabled(
|
||||||
|
widget.channel.index,
|
||||||
|
),
|
||||||
backgroundColor: colorScheme.surfaceContainerHighest,
|
backgroundColor: colorScheme.surfaceContainerHighest,
|
||||||
fallbackTextColor: color,
|
fallbackTextColor: color,
|
||||||
maxSize: gifSize,
|
maxSize: gifSize,
|
||||||
|
|||||||
@@ -1339,6 +1339,7 @@ class _MessageBubble extends StatelessWidget {
|
|||||||
child: GifMessage(
|
child: GifMessage(
|
||||||
url:
|
url:
|
||||||
'https://media.giphy.com/media/$gifId/giphy.gif',
|
'https://media.giphy.com/media/$gifId/giphy.gif',
|
||||||
|
autoLoad: urlImagesEnabled,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
fallbackTextColor: textColor.withValues(
|
fallbackTextColor: textColor.withValues(
|
||||||
alpha: 0.7,
|
alpha: 0.7,
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -10,12 +10,17 @@ class GifMessage extends StatefulWidget {
|
|||||||
final Color fallbackTextColor;
|
final Color fallbackTextColor;
|
||||||
final double maxSize;
|
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({
|
const GifMessage({
|
||||||
super.key,
|
super.key,
|
||||||
required this.url,
|
required this.url,
|
||||||
required this.backgroundColor,
|
required this.backgroundColor,
|
||||||
required this.fallbackTextColor,
|
required this.fallbackTextColor,
|
||||||
this.maxSize = 200,
|
this.maxSize = 200,
|
||||||
|
this.autoLoad = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -33,7 +38,11 @@ class _GifMessageState extends State<GifMessage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_resolveImage();
|
if (widget.autoLoad) {
|
||||||
|
_resolveImage();
|
||||||
|
} else {
|
||||||
|
_isLoading = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -45,7 +54,13 @@ class _GifMessageState extends State<GifMessage> {
|
|||||||
_error = null;
|
_error = null;
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
_isPaused = false;
|
_isPaused = false;
|
||||||
_resolveImage();
|
if (widget.autoLoad) {
|
||||||
|
_resolveImage();
|
||||||
|
} else {
|
||||||
|
_isLoading = false;
|
||||||
|
}
|
||||||
|
} else if (widget.autoLoad && !oldWidget.autoLoad && _image == null) {
|
||||||
|
_retryLoad();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user