Throttle pod device data for the UI, notifications or widgets.

We don't need faster updates than 1 per second.
(We keep reactions at maximum speed tho)
This commit is contained in:
darken
2022-11-05 12:11:09 +01:00
committed by Matthias Urhahn
parent b9f4992a33
commit 6340f73d61
5 changed files with 16 additions and 1 deletions
@@ -9,6 +9,7 @@ import eu.darken.capod.common.debug.autoreport.DebugSettings
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
import eu.darken.capod.common.debug.logging.log
import eu.darken.capod.common.flow.combine
import eu.darken.capod.common.flow.throttleLatest
import eu.darken.capod.common.livedata.SingleLiveEvent
import eu.darken.capod.common.permissions.Permission
import eu.darken.capod.common.uix.ViewModel3
@@ -76,7 +77,7 @@ class OverviewFragmentVM @Inject constructor(
permissionTool.missingPermissions,
debugSettings.isDebugModeEnabled.flow,
bluetoothManager.isBluetoothEnabled,
podMonitor.mainDevice,
podMonitor.mainDevice.throttleLatest(1000),
) { _, permissions, isDebugMode, isBluetoothEnabled, _ ->
val items = mutableListOf<OverviewAdapter.Item>()