Address review: trace request size and contact-share translation
- Manual path trace validates the request that will actually be sent (round trips become 2n-1 hops, 3-byte hops go out as 4-byte prefixes) against the 172-byte frame and 64-hop firmware limits, and disables Run with an explanation when it does not fit. PathTraceMapScreen also refuses to send an oversized request. - Contact-share tokens are never passed through message translation, so the share cannot be mangled before sending.
This commit is contained in:
1 parent
c939f7a29c
commit
80ead2fc2d
45 files changed
+210
-2
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_open/services/app_settings_service.dart';
|
||||
import 'package:meshcore_open/services/translation_service.dart';
|
||||
import 'package:meshcore_open/storage/prefs_manager.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
test('outgoing translation skips contact-share tokens', () async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
await PrefsManager.initialize();
|
||||
final settings = AppSettingsService();
|
||||
await settings.loadSettings();
|
||||
await settings.setComposerTranslationEnabled(true);
|
||||
final translation = TranslationService(settings);
|
||||
const token =
|
||||
'<50ba28f599799142622d188469a63f3890d495cdcedd24239052abd364c0283d:1:CC>';
|
||||
|
||||
expect(
|
||||
translation.shouldTranslateOutgoing(
|
||||
text: token,
|
||||
targetLanguageCode: 'de',
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
expect(
|
||||
translation.shouldTranslateOutgoing(
|
||||
text: 'hello there',
|
||||
targetLanguageCode: 'de',
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user