Request iOS local-network permission at app launch

The iOS local-network permission prompt fires on the first local-network
access. That used to be the user's "Test" tap in settings, so the prompt
appeared mid-request and the first connection attempt always failed.

Provoke the prompt at launch instead via an mDNS multicast datagram, so the
permission is settled before the user reaches settings. Platform exclusion is
handled with a conditional import: web gets a no-op stub (keeping dart:io out
of web builds) and the native path no-ops off iOS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-07 15:33:06 -04:00
co-authored by Claude Opus 4.8
parent 87af782985
commit 40a7f3a432
6 changed files with 63 additions and 0 deletions
@@ -0,0 +1,10 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:frontend/utils/local_network_permission.dart';
void main() {
test('is a no-op off iOS and never throws', () async {
// Tests run on the host VM (not iOS), so this exercises the guard: it must
// return cleanly without touching the network or raising.
await expectLater(requestLocalNetworkPermission(), completes);
});
}