mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
Fix comparison that determines which list item is the primary device. (#54)
This commit is contained in:
@@ -12,6 +12,7 @@ import eu.darken.capod.common.debug.logging.asLog
|
||||
import eu.darken.capod.common.debug.logging.log
|
||||
import eu.darken.capod.common.debug.logging.logTag
|
||||
import eu.darken.capod.common.flow.replayingShare
|
||||
import eu.darken.capod.common.flow.setupCommonEventHandlers
|
||||
import eu.darken.capod.main.core.GeneralSettings
|
||||
import eu.darken.capod.main.core.PermissionTool
|
||||
import eu.darken.capod.pods.core.PodDevice
|
||||
@@ -79,6 +80,7 @@ class PodMonitor @Inject constructor(
|
||||
|
||||
val mainDevice: Flow<PodDevice?> = devices
|
||||
.map { determineMainDevice(it) }
|
||||
.setupCommonEventHandlers(TAG) { "mainDevice" }
|
||||
.replayingShare(appScope)
|
||||
|
||||
private fun createBleScanner() = combine(
|
||||
|
||||
@@ -130,24 +130,25 @@ class OverviewFragmentVM @Inject constructor(
|
||||
if (permissions.isEmpty() && isBluetoothEnabled) {
|
||||
pods.map {
|
||||
val now = Instant.now()
|
||||
val isMainPod = it.identifier == mainPod?.identifier
|
||||
when (it) {
|
||||
is DualPodDevice -> DualPodsCardVH.Item(
|
||||
now = now,
|
||||
device = it,
|
||||
showDebug = isDebugMode,
|
||||
isMainPod = it == mainPod,
|
||||
isMainPod = isMainPod,
|
||||
)
|
||||
is SinglePodDevice -> SinglePodsCardVH.Item(
|
||||
now = now,
|
||||
device = it,
|
||||
showDebug = isDebugMode,
|
||||
isMainPod = it == mainPod,
|
||||
isMainPod = isMainPod,
|
||||
)
|
||||
else -> UnknownPodDeviceCardVH.Item(
|
||||
now = now,
|
||||
device = it,
|
||||
showDebug = isDebugMode,
|
||||
isMainPod = it == mainPod,
|
||||
isMainPod = isMainPod,
|
||||
)
|
||||
}
|
||||
}.run { items.addAll(this) }
|
||||
|
||||
Reference in New Issue
Block a user