diff --git a/README.md b/README.md index cb096734..9bb7640a 100644 --- a/README.md +++ b/README.md @@ -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). > diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 4516731c..f9a05fa1 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -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, diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index 358ea298..0aff0bed 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -743,6 +743,7 @@ class _ChannelChatScreenState extends State { 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 { borderRadius: BorderRadius.circular(4), child: GifMessage( url: 'https://media.giphy.com/media/$gifId/giphy.gif', + autoLoad: context.read().isChannelUrlImagesEnabled( + widget.channel.index, + ), backgroundColor: colorScheme.surfaceContainerHighest, fallbackTextColor: color, maxSize: gifSize, diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index c0c503b4..2c4378bc 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -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, diff --git a/lib/tth_fork.dart b/lib/tth_fork.dart new file mode 100644 index 00000000..96b54b48 --- /dev/null +++ b/lib/tth_fork.dart @@ -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; diff --git a/lib/widgets/gif_message.dart b/lib/widgets/gif_message.dart index 9108f53f..5e71b844 100644 --- a/lib/widgets/gif_message.dart +++ b/lib/widgets/gif_message.dart @@ -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 { @override void initState() { super.initState(); - _resolveImage(); + if (widget.autoLoad) { + _resolveImage(); + } else { + _isLoading = false; + } } @override @@ -45,7 +54,13 @@ class _GifMessageState extends State { _error = null; _isLoading = true; _isPaused = false; - _resolveImage(); + if (widget.autoLoad) { + _resolveImage(); + } else { + _isLoading = false; + } + } else if (widget.autoLoad && !oldWidget.autoLoad && _image == null) { + _retryLoad(); } }