mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
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:
co-authored by
Claude Opus 4.8
parent
87af782985
commit
40a7f3a432
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:frontend/theme/catppuccin_mocha_theme.dart';
|
||||
import 'package:frontend/utils/local_network_permission.dart';
|
||||
import 'package:frontend/utils/pref_utils.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'navigation.dart';
|
||||
@@ -30,6 +31,10 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
// Settle iOS's local-network permission now, at launch, so it isn't
|
||||
// still being decided when the user first taps "Test" in settings.
|
||||
unawaited(requestLocalNetworkPermission());
|
||||
|
||||
runApp(const MainApp());
|
||||
},
|
||||
(error, stack) {
|
||||
|
||||
Reference in New Issue
Block a user