From b22539bd5b3899bedfffbb0132ec63f0151d0378 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Sun, 13 Sep 2026 00:24:41 +0100 Subject: [PATCH] feat(maestro): wire DaemonLink into MainActivity, allow cleartext traffic Reads the EXTRA_DAEMON_URL intent extra, starts DaemonLink, and shows its LinkState in the placeholder screen so the connection indicator has something to bind to. usesCleartextTraffic is required for the daemon's plain-HTTP LAN endpoint; ACCESS_NETWORK_STATE is required for ConnectivityManager.registerNetworkCallback. --- android/app/src/main/AndroidManifest.xml | 2 ++ .../main/java/pt/naps/maestro/MainActivity.kt | 25 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 68cf59c..7c98bd3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ + - PlaceholderScreen(modifier = Modifier.padding(innerPadding)) + PlaceholderScreen(modifier = Modifier.padding(innerPadding), linkState = linkState) } } } } + + override fun onDestroy() { + daemonLink.close() + super.onDestroy() + } } @Composable -fun PlaceholderScreen(modifier: Modifier = Modifier) { +fun PlaceholderScreen(modifier: Modifier = Modifier, linkState: LinkState = LinkState.CONNECTING) { Column( modifier = modifier .fillMaxSize() @@ -49,6 +67,9 @@ fun PlaceholderScreen(modifier: Modifier = Modifier) { Text( text = stringResource(id = R.string.placeholder_message), ) + Text( + text = "Daemon: ${linkState.name.lowercase()}", + ) } }