fix(macos): trigger Local Network permission prompt before server connect
The Local Network permission prompt (NWBrowser for _ts3._tcp) was never actually triggered anywhere in the app. The service defined triggerLocalNetworkPrompt() but no code called it. Now _onConnect() checks the local network state before connecting. If the state is unknown or notDetermined, it triggers the NWBrowser scan which shows the system Local Network Privacy dialog on macOS 15+. This ensures the prompt appears before the connection attempt so the user can grant permission and the connection succeeds in one flow. Non-macOS platforms are unaffected (short-circuited by the service).
This commit is contained in:
@@ -1067,6 +1067,18 @@ class _BetaHomeState extends State<_BetaHome> with WidgetsBindingObserver {
|
|||||||
String? password,
|
String? password,
|
||||||
}) async {
|
}) async {
|
||||||
final connectEpoch = ++_connectionEpoch;
|
final connectEpoch = ++_connectionEpoch;
|
||||||
|
|
||||||
|
// Trigger macOS Local Network permission prompt before connecting.
|
||||||
|
// On macOS 15+ the first network connection triggers the system
|
||||||
|
// dialog; triggering it via NWBrowser here ensures the prompt
|
||||||
|
// appears *before* the actual connect attempt so the user can grant
|
||||||
|
// permission and the connection succeeds in one flow.
|
||||||
|
final lnState = _macOSPermissions.localNetworkState.value;
|
||||||
|
if (lnState == MacOSLocalNetworkState.unknown ||
|
||||||
|
lnState == MacOSLocalNetworkState.notDetermined) {
|
||||||
|
await _macOSPermissions.triggerLocalNetworkPrompt();
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_phase = ConnectionPhase.connecting;
|
_phase = ConnectionPhase.connecting;
|
||||||
_snapshot = null;
|
_snapshot = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user