mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-21 09:31:20 -08:00
Consistency
This commit is contained in:
1 parent
943d51dbdc
commit
3336f6dff1
4 files changed
+7
-6
No files matched your search
@@ -45,7 +45,7 @@ class Context<S, A>(
|
||||
mutableStateFlow.update { currentState ->
|
||||
actions.fold(currentState) { s, action -> reducer(s, action) }
|
||||
}
|
||||
debugMiddleware.onDispatchBatch(caller, before, actions, mutableStateFlow.value)
|
||||
debugMiddleware.onDispatchAll(caller, before, actions, mutableStateFlow.value)
|
||||
}
|
||||
|
||||
fun <C> observeAll(receiver: C) = behaviours.forEach { behaviour ->
|
||||
|
||||
@@ -2,5 +2,5 @@ package dev.slimevr.context.debug
|
||||
|
||||
interface DebugMiddleware<S, A> {
|
||||
fun onDispatch(caller: String?, before: S, action: A, after: S)
|
||||
fun onDispatchBatch(caller: String?, before: S, actions: List<A>, after: S)
|
||||
fun onDispatchAll(caller: String?, before: S, actions: List<A>, after: S)
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class LoggingMiddleware<S, A>(
|
||||
println(formatLine("$tag $actionName$callerSuffix", before, after))
|
||||
}
|
||||
|
||||
override fun onDispatchBatch(caller: String?, before: S, actions: List<A>, after: S) {
|
||||
override fun onDispatchAll(caller: String?, before: S, actions: List<A>, after: S) {
|
||||
val visible = actions.filter { action -> isAllowed(action) }
|
||||
if (visible.isEmpty()) return
|
||||
if (!logNoOps && before == after) return
|
||||
|
||||
@@ -2,9 +2,9 @@ package dev.slimevr.tracker
|
||||
|
||||
import dev.slimevr.VRServer
|
||||
import dev.slimevr.config.Settings
|
||||
import dev.slimevr.config.TrackerConfig
|
||||
import dev.slimevr.context.Behaviour
|
||||
import dev.slimevr.context.Context
|
||||
import dev.slimevr.context.debug.DiffStyle
|
||||
import dev.slimevr.context.debug.LoggingMiddleware
|
||||
import dev.slimevr.device.DeviceOrigin
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
@@ -99,9 +99,10 @@ class Tracker(
|
||||
initialState = trackerState,
|
||||
scope = scope,
|
||||
behaviours = behaviours,
|
||||
LoggingMiddleware(
|
||||
debugMiddleware = LoggingMiddleware(
|
||||
"Tracker[$hardwareId]",
|
||||
// block = setOf(TrackerActions.SetRotation::class)
|
||||
block = setOf(TrackerActions.SetRotation::class),
|
||||
diffStyle = DiffStyle.MULTILINE
|
||||
),
|
||||
)
|
||||
val tracker = Tracker(context = context, server)
|
||||
|
||||
Reference in new issue
Block a user