From 108ab8468bb875fb0b9c286da54de050c1caebf4 Mon Sep 17 00:00:00 2001 From: ospab Date: Sun, 12 Jul 2026 02:04:09 +0300 Subject: [PATCH] fix(flutter): show Junk/TCP-Frag controls only when transport is UoT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Junk packets and TCP fragmentation only take effect on the UoT (TCP) transport — the UDP path applies neither — so showing them (with an implicit "UoT only" caveat) while UDP is selected was misleading. The whole DPI OBFUSCATION section is now gated on transportMode == 'uot' and appears/disappears reactively when the Transport dropdown changes (setDialogState already rebuilds the dialog). --- ostp-flutter/lib/ui/settings_screen.dart | 61 +++++++++++++----------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/ostp-flutter/lib/ui/settings_screen.dart b/ostp-flutter/lib/ui/settings_screen.dart index aeb7bd0..8a65bcb 100644 --- a/ostp-flutter/lib/ui/settings_screen.dart +++ b/ostp-flutter/lib/ui/settings_screen.dart @@ -265,39 +265,42 @@ class _SettingsScreenState extends State { if (v != null) setDialogState(() => transportMode = v); }, ), - const Divider(height: 32), - // Junk packets + TCP fragmentation moved into their own - // modals (tap to configure) — this dialog was carrying too - // many fields at once; these two are advanced/occasional - // settings, not something every profile edit needs to see. - const Text('DPI OBFUSCATION', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13, color: Colors.white54, letterSpacing: 1.0)), - const SizedBox(height: 12), - Row( - children: [ - Expanded( - child: OutlinedButton.icon( - icon: const Icon(Icons.shuffle_rounded, size: 18), - label: const Text('Junk Packets'), - onPressed: () => _showJunkPacketsModal( - context, junkPcMinCtrl, junkPcMaxCtrl, junkPsMinCtrl, junkPsMaxCtrl, + // Junk packets and TCP fragmentation only take effect on the + // UoT (TCP) transport — the UDP path applies neither — so the + // whole section is hidden under UDP instead of shown with a + // "UoT only" caveat. Reactive: switching Transport above calls + // setDialogState, which rebuilds this and shows/hides it. + if (transportMode == 'uot') ...[ + const Divider(height: 32), + const Text('DPI OBFUSCATION', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13, color: Colors.white54, letterSpacing: 1.0)), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: OutlinedButton.icon( + icon: const Icon(Icons.shuffle_rounded, size: 18), + label: const Text('Junk Packets'), + onPressed: () => _showJunkPacketsModal( + context, junkPcMinCtrl, junkPcMaxCtrl, junkPsMinCtrl, junkPsMaxCtrl, + ), ), ), - ), - const SizedBox(width: 12), - Expanded( - child: OutlinedButton.icon( - icon: Icon(tcpFragmentation ? Icons.call_split_rounded : Icons.horizontal_rule_rounded, size: 18), - label: Text(tcpFragmentation ? 'TCP Frag: On' : 'TCP Frag: Off'), - onPressed: () => _showTcpFragModal( - context, - tcpFragmentation, - (v) => setDialogState(() => tcpFragmentation = v), - fragChunkCtrl, fragSleepCtrl, + const SizedBox(width: 12), + Expanded( + child: OutlinedButton.icon( + icon: Icon(tcpFragmentation ? Icons.call_split_rounded : Icons.horizontal_rule_rounded, size: 18), + label: Text(tcpFragmentation ? 'TCP Frag: On' : 'TCP Frag: Off'), + onPressed: () => _showTcpFragModal( + context, + tcpFragmentation, + (v) => setDialogState(() => tcpFragmentation = v), + fragChunkCtrl, fragSleepCtrl, + ), ), ), - ), - ], - ), + ], + ), + ], ], ), ),