mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
Only use IRK match for main device if IRK is configured
This commit modifies `PodMonitor.kt` to ensure that the `isIRKMatch` flag is only used to determine the main device if an Identity Resolving Key (IRK) is actually configured in the general settings. If no IRK is set, the main device determination will fall back to other logic, preventing a device from being incorrectly selected as "main" solely based on an IRK match when no specific IRK is being looked for.
This commit is contained in:
@@ -198,9 +198,10 @@ class PodMonitor @Inject constructor(
|
||||
}
|
||||
|
||||
private fun determineMainDevice(pods: List<PodDevice>): PodDevice? {
|
||||
val irkHit = pods.filterIsInstance<ApplePods>().firstOrNull { it.flags.isIRKMatch }
|
||||
if (irkHit != null) {
|
||||
log(TAG) { "Main device determined via IRK: $irkHit" }
|
||||
val identityKey = generalSettings.mainDeviceIdentityKey.value
|
||||
if (identityKey != null) {
|
||||
val irkHit = pods.filterIsInstance<ApplePods>().firstOrNull { it.flags.isIRKMatch }
|
||||
log(TAG) { "IRK is configured, main device irkHit=$irkHit" }
|
||||
return irkHit
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user