https://kotlinlang.org logo
#random
Title
u

ursus

11/17/2018, 7:24 AM
If I have certain actions, which are allowed in certain state, where they dont change it state, however those actions are async, so need to change "some" state to pending, in order to avoid multiple calls until the async is finished i.e. I have call states, for example one of which is Activated, and I have actions like MuteMic, where this action is only allowed in Activated state but lets say MuteMic is heavy / or async, so I need to surround it with pending state, should that pending state be part of the call state hierarchy, i.e. on the same level as Activated is, or somehow nested inside it, or separate state machine?,
Copy code
when state == Activated
   when action == MuteMic
      state = ActivatedMuteMicPending
      effect(Effect.DoMuteMic)
      state = Activated
Copy code
sealed class State {
   object Activated,
   object ActivatedMuteMicPending
}
im not sure if this is good design
l

louiscad

11/17/2018, 8:29 AM
@ursus Don't you think this is a better fit for #general or #codereview, rather than #random?
u

ursus

11/17/2018, 2:23 PM
man, i didnt know it existed 😀 thx
2 Views