SpaceOrderUtils

object SpaceOrderUtils

Adds some utilities to compute correct string orders when ordering spaces. After moving a space (e.g via DnD), client should limit the number of room account data update. For example if the space is moved between two other spaces with orders, just update the moved space order by computing a mid point between the surrounding orders. If the space is moved after a space with no order, all the previous spaces should be then ordered, and the computed orders should be chosen so that there is enough gaps in between them to facilitate future re-order. Re numbering (i.e change all spaces m.space.order account data) should be avoided as much as possible, as the updates might not be atomic for other clients and would makes spaces jump around.

Types

Link copied to clipboard
data class SpaceReOrderCommand(val spaceId: String, val order: String)

Functions

Link copied to clipboard
fun orderCommandsForMove(    orderedSpacesToOrderMap: List<Pair<String, String?>>,     movedSpaceId: String,     delta: Int): List<SpaceOrderUtils.SpaceReOrderCommand>

Returns a minimal list of order change in order to re order the space list as per given move.