@@ -463,12 +463,25 @@ object UDPDiscoveryManager {
463463
464464 val deviceId = DeviceInfoUtil .getDeviceId(context)
465465
466+ val autoConnect = try {
467+ runBlocking { ds.getAutoReconnectEnabled().first() }
468+ } catch (e: Exception ) {
469+ true
470+ }
471+ val bleAutoConnect = try {
472+ runBlocking { ds.getBleAutoConnectEnabled().first() }
473+ } catch (e: Exception ) {
474+ true
475+ }
476+
466477 val json = JSONObject ()
467478 json.put(" type" , " presence" )
468479 json.put(" deviceType" , " android" )
469480 json.put(" id" , deviceId)
470481 json.put(" name" , deviceName)
471482 json.put(" ips" , FilteredIpArray (filteredLocalIps)) // Send FILTERED IPs
483+ json.put(" autoConnect" , autoConnect)
484+ json.put(" bleAutoConnect" , bleAutoConnect)
472485 val payload = json.toString()
473486 val data = payload.toByteArray()
474487
@@ -583,12 +596,26 @@ object UDPDiscoveryManager {
583596 if (filteredIps.isEmpty()) return
584597
585598 val deviceId = DeviceInfoUtil .getDeviceId(context)
599+
600+ val autoConnect = try {
601+ runBlocking { ds.getAutoReconnectEnabled().first() }
602+ } catch (e: Exception ) {
603+ true
604+ }
605+ val bleAutoConnect = try {
606+ runBlocking { ds.getBleAutoConnectEnabled().first() }
607+ } catch (e: Exception ) {
608+ true
609+ }
610+
586611 val json = JSONObject ()
587612 json.put(" type" , " presence" )
588613 json.put(" deviceType" , " android" )
589614 json.put(" id" , deviceId)
590615 json.put(" name" , deviceName)
591616 json.put(" ips" , FilteredIpArray (filteredIps))
617+ json.put(" autoConnect" , autoConnect)
618+ json.put(" bleAutoConnect" , bleAutoConnect)
592619 val payload = json.toString()
593620
594621 sendUnicast(targetIp, payload)
@@ -623,11 +650,24 @@ object UDPDiscoveryManager {
623650 val deviceName = if (customName.isNotBlank()) customName else android.os.Build .MODEL
624651 val deviceId = DeviceInfoUtil .getDeviceId(context)
625652
653+ val autoConnect = try {
654+ runBlocking { ds.getAutoReconnectEnabled().first() }
655+ } catch (e: Exception ) {
656+ true
657+ }
658+ val bleAutoConnect = try {
659+ runBlocking { ds.getBleAutoConnectEnabled().first() }
660+ } catch (e: Exception ) {
661+ true
662+ }
663+
626664 val json = JSONObject ()
627665 json.put(" type" , " peerExchange" )
628666 json.put(" deviceType" , " android" )
629667 json.put(" id" , deviceId)
630668 json.put(" name" , deviceName)
669+ json.put(" autoConnect" , autoConnect)
670+ json.put(" bleAutoConnect" , bleAutoConnect)
631671
632672 // Include all IPs based on settings
633673 val ipsToSend = if (expandNetworkingEnabled) allIps else allIps.filter { ! it.startsWith(" 100." ) }
0 commit comments